有的时候我们需要统计不同的进程实际物理内存的消耗,常见的几个参数如下:

VSS (reported as VSZ from ps) is the total accessible address space of a process. This size also includes memory that may not be resident in RAM like mallocs that have been allocated but not written to. VSS is of very little use for determing real memory usage of a process.

RSS is the total memory actually held in RAM for a process. RSS can be misleading, because it reports the total all of the shared libraries that the process uses, even though a shared library is only loaded into memory once regardless of how many processes use it. RSS is not an accurate representation of the memory usage for a single process.

PSS differs from RSS in that it reports the proportional size of its shared libraries, i.e. if three processes all use a shared library that has 30 pages, that library will only contribute 10 pages to the PSS that is reported for each of the three processes. PSS is a very useful number because when the PSS for all processes in the system are summed together, that is a good representation for the total memory usage in the system. When a process is killed, the shared libraries that contributed to its PSS will be proportionally distributed to the PSS totals for the remaining processes still using that library. In this way PSS can be slightly misleading, because when a process is killed, PSS does not accurately represent the memory returned to the overall system.

USS is the total private memory for a process, i.e. that memory that is completely unique to that process. USS is an extremely useful number because it indicates the true incremental cost of running a particular process. When a process is killed, the USS is the total memory that is actually returned to the system. USS is the best number to watch when initially suspicious of memory leaks in a process.

其中VSS>RSS>PSS>USS

对于RSS PSS USS的统计,可以通过代码简单的

system/extras/libpagemap/pm_map.c

usage.rss += (count >= 1) ? map->proc->ker->pagesize : (0);

usage.pss += (count >= 1) ? (map->proc->ker->pagesize / count) : (0);

usage.uss += (count == 1) ? (map->proc->ker->pagesize) : (0);

通过上面的算法可以看出,USS部分是进程独占的部分,PSS是USS+共享/count, RSS是USS+共享部分

如果我们要对进程退出后内存回收的统计的话,应该使用USS部分

linux 进程pss,Linux 进程内存使用统计VSS RSS PSS USSS相关推荐

  1. 【转】内存耗用:VSS/RSS/PSS/USS

    [转]内存耗用:VSS/RSS/PSS/USS Terms VSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存) RSS- Resident Set Size 实际使用物理 ...

  2. 内存耗用:VSS/RSS/PSS/USS 介绍

    参考:内存耗用:VSS/RSS/PSS/USS 的介绍 - 简书 内存耗用:VSS/RSS/PSS/USS_adaptiver的博客-CSDN博客_rss uss VSS- Virtual Set S ...

  3. 内存耗用:VSS/RSS/PSS/USS

    http://hi.baidu.com/donghaozheng/blog/item/235da701ab70f60a1c95832e.html Terms VSS- Virtual Set Size ...

  4. 内存耗用:VSS/RSS/PSS/USS 的介绍

    https://www.cnblogs.com/jycboy/p/5453533.html VSS:Virtual Set Size,虚拟耗用内存.它是一个进程能访问的所有内存空间地址的大小.这个大小 ...

  5. 内存:VSS/RSS/PSS/USS区别和监控

    软件开发的最后阶段就是测试,了解软件整体的cpu和mem使用情况,之前一直用ps来确定cpu使用率和rss内存,最近监控python多进程软件时,累积rss竟然超过了节点物理内存126G,原因在此处梳 ...

  6. linux 进程的vss rss uss,内核/内存管理中的VSS/RSS/PSS/USS

    转自:http://www.douban.com/note/161471809/ RSS is the total memory actually held in RAM for a process. ...

  7. linux vss rss区别,关于VSS / RSS / PSS / USS的解释是否准确?

    我阅读了有关VSS / RSS / PSS / USS的说明: 这篇文章的目的是提供信息,以帮助解释来自各种工具的内存报告,以便可以确定Linux进程和系统的实际内存使用情况. Android有一个称 ...

  8. linux中pss用法,[Linux] Memory: VSS/RSS/PSS/USS

    Terms VSS- Virtual Set Size 虚拟耗用内存(包含共享库占用的内存) RSS- Resident Set Size 实际使用物理内存(包含共享库占用的内存) PSS- Prop ...

  9. android 内存uss rss,内存VSS/RSS/PSS/USS名词解释

    VSS(virtual set size)虚拟耗用内存(包含共享库占用的内存) RSS(Resident set size)实际使用物理内存(包含共享库占用的内存) RSS是进程实际驻存在物理内存的部 ...

最新文章

  1. 测试常用shell语句——数值,数组类型;函数创建
  2. 给定一个年份,判断这一年是不是闰年。
  3. 华三交换机接口配置access_二层交换——交换机的基础和VLAN
  4. pytorch torch.utils.data.TensorDataset
  5. apk当安装程序将文件复制到手机自带的指定文件夹
  6. set python_Python的set集合详解
  7. iCloud 照片如何转移至谷歌相册?
  8. GOOD AI Example GREAT AI Company
  9. IOS测试版全版本固件下载集合
  10. 作业一 统计软件简介与数据操作
  11. luogu p1330封锁阳光大学
  12. c语言实现动画的方法,C语言动画技术的实现方法
  13. git推送拉取需要验证信息
  14. linux a卡怎么切换n卡,手把手教您win10系统a卡切换独显的具体办法
  15. 2022哪些蓝牙耳机适合学生党?适合学生党的平价蓝牙耳机推荐
  16. 三、GAMIT解算之分步处理
  17. 电动车充电软件测试,电动车充电分为哪几个过程
  18. 几个优质的涵盖了各种语言的项目,快来看看吧
  19. linux查看单词个数,Linux怎么统计文本的的行数/单词数和字符数?
  20. Kata Containers介绍

热门文章

  1. oracle soa 12c 教程,Oracle SOA Suite 12c Handbook
  2. 《JavaScript高级程序设计(第三版)》读后感--持续更新
  3. Day 20: Sorting
  4. android卡片式网格,CardView(卡片式布局)
  5. 我们专访了神龙云服务器产品负责人,看懂阿里云发布的“神龙”到底“神”在哪里
  6. 从点点点到年薪30W的心理历程--测试君请进,绝对让你不虚此行!
  7. 蓝桥杯国信长天单片机实战--呼吸灯设计
  8. 【狂神说Java笔记】Java基础
  9. Android Linux Alarm 对功耗的影响
  10. Cloudin云英面试题:0的阶乘自然数e的意义