smem——内存检测工具

 

smem is a tool that can give numerous reports on memory usage on Linux systems. Unlike existing tools, smem can report proportional set size (PSS), which is a more meaningful representation of the amount of memory used by libraries and applications in a virtual memory system.

 

Because large portions of physical memory are typically shared among multiple applications, the standard measure of memory usage known as resident set size (RSS) will significantly overestimate memory usage. PSS instead measures each application's "fair share" of each shared area to give a realistic measure.

 

 


 

smem是一个基于Python的检测Linux系统内存使用情况的工具,smem可以给出每个程序或库的USS、PSS和RSS。

 

USS(unique set size):进程独自占用的内存,不包括共享库占用的内存。这个数值应该最为重要,USS也正是杀死这个进程后可以释放的内存。

PSS(proportiaonal set size):所有使用某共享库的程序均分该共享库占用的内存时,每个进程占用的内存。显然所有进程的PSS之和就是系统的内存使用量。

RSS (resident set size):实际占用的内存,包括独自占用的内存和共享库占用的所有内存。RSS具有一定的误导性,它并不能完全体现出一个进程的内存使用情况,因为共享库所占用的那部分内存的分配和释放很有可能与是否运行这个进程没有关系。

 

 


 

Using smem

Show basic process information smem
Show library-oriented view smem -m
Show user-oriented view smem -u
Show system view smem -R 4G -K /path/to/vmlinux -w
Show totals and percentages smem -t -p
Show different columns smem -c "name user pss"
Sort by reverse RSS smem -s rss -r
Show processes filtered by mapping smem -M libxml
Show mappings filtered by process smem -m -P [e]volution
Read data from capture tarball smem --source capture.tar.gz
Show a bar chart labeled by pid smem --bar pid -c "pss uss"
Show a pie chart of RSS labeled by name smem --pie name -s rss

 

See also:http://www.selenic.com/smem/

你可能感兴趣的:(Performance)