smem memory reporting tool

smem是一款用于分析Linux系统中内存使用的工具,它能够提供比传统RSS更准确的PSS报告,真实反映应用及库占用的内存。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 has many features:

 

  • system overview listing
  • listings by process, mapping, user
  • filtering by process, mapping, or user
  • configurable columns from multiple data sources
  • configurable output units and percentages
  • configurable headers and totals
  • reading live data from /proc
  • reading data snapshots from directory mirrors or compressed tarballs
  • lightweight capture tool for embedded systems
  • built-in chart generation

smem has a few requirements:

 

  • a reasonably modern kernel (> 2.6.27 or so)
  • a reasonably recent version of Python (2.4 or so)
  • the matplotlib library for chart generation (optional, auto-detected)

Sample output

Here are some smem graphs showing how RSS exaggerates memory usage. Note how apps that share libraries are over-reported on the RSS side and nearly vanish on the PSS side. The X server is also shares memory heavily, it's real memory usage is about 5 times smaller.

 

Using smem

Show basic process informationsmem
Show library-oriented viewsmem -m
Show user-oriented viewsmem -u
Show system viewsmem -R 4G -K /path/to/vmlinux -w
Show totals and percentagessmem -t -p
Show different columnssmem -c "name user pss"
Sort by reverse RSSsmem -s rss -r
Show processes filtered by mappingsmem -M libxml
Show mappings filtered by processsmem -m -P [e]volution
Read data from capture tarballsmem --source capture.tar.gz
Show a bar chart labeled by pidsmem --bar pid -c "pss uss"
Show a pie chart of RSS labeled by namesmem --pie name -s rss

Getting smem

To get the latest release version, click here.

The latest source code can be grabbed from smem's Mercurial repository here with the command:

hg clone http://selenic.com/repo/smem

Feedback

Write to the smem list at smem@selenic.com.

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值