未加星标

smem Linux Memory Reporting/Statistics Tool

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Monitoring memory utilization on linux box is one of the important task for Linux Administrator to make the system up and running smoothly. There are plenty of commands/tools are available to monitor memory utilization on Linux, each one is working in different manner, today we are going to show you

about 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), Unique Set Size (USS) & Resident Set Size (RSS).

Proportional Set Size (PSS) :Representation of the amount of memory used by libraries and applications in a virtual memory system.

Unique Set Size (USS) :Unshared memory is reported as the USS (Unique Set Size).

Resident Set Size (RSS) :The standard measure of physical memory (it typically shared among multiple applications) usage known as resident set size (RSS) will significantly overestimate memory usage.

The USS and PSS only include physical memory usage. They do not include memory that has been swapped out to disk. Memory can be reported by process, by user, by mapping, or system wide and possible to get the output via text mode and graphical mode.

PSS measures each applications & libraries fair share memory for realistic measure. It pull most of the data from the /proc file system.

smem has a utility called smemcap which used to capture memory statistics on running systems. smemcap captures all /proc entries required by smem and store the data as a uncompressed .tar file. smem can analyze the output using the source option.

By default most of the modern system fulfill the basic requirements for smem like kernel (> 2.6.27) & python (2.4 or later) except matplotlib library package for chart generation that to for optional.

Suggested Read : Free A Standard Tool to check Memory Statistics vmstat A Standard Nifty Tool to Report Virtual Memory Statistics

smem 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 Install smem in Linux

Most of the distributions (Debian, Ubuntu, Mint, Fedora, suse, openSUSE, Arch Linux, Manjaro, Mageia, etc.) has the smem package so, we can easily install it from distribution official repository. For RHEL/CentOS enable epel repository .

[Install smem on CentOS/RHEL]
$ sudo yum install smem
$ sudo yum install python-matplotlib
[Install smem on Fedora]
$ sudo dnf install smem
$ sudo dnf install python-matplotlib
[Install smem on Debian/Ubuntu]
$ sudo apt-get install smem
$ sudo apt-get install python-matplotlib
[Install smem on Arch Linux]
$ sudo pacman -S smem
$ sudo pacman -S python2-matplotlib
[Install smem on Mageia]
$ sudo urpmi smem
$ sudo urpmi python-matplotlib
[Install smem on openSUSE]
$ sudo zypper install smem
$ sudo zypper install python-matplotlib Run smem without any options

After successfully smem installed with help of above command. Just fire the below command on terminal to mesure memory usage.

# smem
PID User Command Swap USS PSS RSS
7510 root /sbin/mingetty /dev/tty1 0 72 89 540
7518 root /sbin/mingetty /dev/tty4 0 72 89 540
7524 root /sbin/mingetty /dev/tty5 0 72 89 540
7526 root /sbin/mingetty /dev/tty6 0 72 89 540
7514 root /sbin/mingetty /dev/tty2 0 76 93 544
7516 root /sbin/mingetty /dev/tty3 0 76 93 544
2487 root /sbin/portreserve 0 104 122 584
7278 root /usr/sbin/mcelog --daemon 0 128 131 272
2685 root /usr/sbin/acpid 0 172 189 536
7460 root /usr/bin/rhsmcertd 0 156 216 616
7444 root /usr/sbin/atd 0 212 224 500
21554 root /sbin/udevd -d 0 92 227 720
2743 haldaemon hald-addon-acpi: listening 0 156 238 1040
21553 root /sbin/udevd -d 0 100 243 760
1168 root /sbin/udevd -d 0 108 253 852
2730 root hald-addon-input: Listening 0 176 301 1072
2698 root hald-runner 0 220 354 1180
2463 root auditd 0 344 362 836
2591 rpc rpcbind 0 312 368 896
2573 root irqbalance --pid=/var/run/i 0 464 490 924
2613 rpcuser rpc.statd 0 516 586 1308
2647 dbus dbus-daemon --system 0 592 615 1004
1 root /sbin/init 0 556 638 1520
7429 root crond 0 684 713 1276
21729 root /sbin/dhclient -H 2daygeeks 0 732 744 1024
7295 root /usr/sbin/sshd 0 728 785 1248
28150 zenoss sshd: [email protected] 0 340 948 2116
10364 nobody /usr/bin/nmon -f -t -m /var 0 932 965 1328
7477 root /usr/sbin/certmonger -S -p 0 960 994 1452
2768 root automount --pid-file /var/r 0 1028 1085 1816
20091 root -bash 0 1124 1205 1928
7415 root /usr/libexec/postfix/master 0 1032 1524 3440
28148 root sshd: zenoss [priv 0 220 1604 4524
29914 postfix pickup -l -t fifo -u 0 1228 1604 3416
7422 postfix qmgr -l -t fifo -u 0 1140 1636 3556
20087 root sshd: [email protected]/0 0 1400 2409 4956
2697 haldaemon hald 0 3132 3303 4380
2497 root /sbin/rsyslogd -i /var/run/ 0 3360 3392 4000
31076 root python /usr/bin/smem 0 6360 6418 7112 Show the output in MB

By default memory usage output shows on KB which may get confuse, add k option with smem to get the ouput in MB .

# smem -k
PID User Command Swap USS PSS RSS
7510 root /sbin/mingetty /dev/tty1 0 72.0K 89.0K 540.0K
7518 root /sbin/mingetty /dev/tty4 0 72.0K 89.0K 540.0K
7524 root /sbin/mingetty /dev/tty5 0 72.0K 89.0K 540.0K
7526 root /sbin/mingetty /dev/tty6 0 72.0K 89.0K 540.0K
7514 root /sbin/mingetty /dev/tty2 0 76.0K 93.0K 544.0K
7516 root /sbin/mingetty /dev/tty3 0 76.0K 93.0K 544.0K
2487 root /sbin/portreserve 0 104.0K 122.0K 584.0K
7278 root /usr/sbin/mcelog --daemon 0 128.0K 131.0K 272.0K
2685 root /usr/sbin/acpid 0 172.0K 189.0K 536.0K
7460 root /usr/bin/rhsmcertd 0 156.0K 216.0K 616.0K
7444 root /usr/sbin/atd 0 212.0K 224.0K 500.0K
21554 root /sbin/udevd -d 0 92.0K 227.0K 720.0K
2743 haldaemon hald-addon-acpi: listening 0 156.0K 238.0K 1.0M
21553 root /sbin/udevd -d 0 100.0K 243.0K 760.0K
1168 root /sbin/udevd -d 0 108.0K 253.0K 852.0K
2730 root hald-addon-input: Listening 0 176.0K 301.0K 1.0M
2698 root hald-runner 0 220.0K 354.0K 1.2M
2463 root auditd 0 344.0K 362.0K 836.0K
2591 rpc rpcbind 0 312.0K 368.0K 896.0K
2573 root irqbalance --pid=/var/run/i 0 464.0K 490.0K 924.0K
2613 rpcuser rpc.statd 0 516.0K 586.0K 1.3M
2647 dbus dbus-daemon --system 0 592.0K 615.0K 1004.0K
1 root /sbin/init 0 556.0K 638.0K 1.5M
7429 root crond 0 684.0K 713.0K 1.2M
21729 root /sbin/dhclient -H 2daygeeks 0 732.0K 744.0K 1.0M
7295 root /usr/sbin/sshd 0 728.0K 785.0K 1.2M
28150 zenoss sshd: [email protected] 0 340.0K 948.0K 2.1M
10364 nobody /usr/bin/nmon -f -t -m /var 0 932.0K 965.0K 1.3M
7477 root /usr/sbin/certmonger -S -p 0 960.0K 994.0K 1.4M
2768 root automount --pid-file /var/r 0 1.0M 1.1M 1.8M
20091 root -bash 0 1.1M 1.2M 1.9M
7415 root /usr/libexec/postfix/master 0 1.0M 1.5M 3.4M
28148 root sshd: zenoss [priv 0 220.0K 1.6M 4.4M
29914 postfix pickup -l -t fifo -u 0 1.2M 1.6M 3.3M
7422 postfix qmgr -l -t fifo -u 0 1.1M 1.6M 3.5M
20087 root sshd: [email protected]/0 0 1.4M 2.4M 4.8M
2697 haldaemon hald 0 3.1M 3.2M 4.3M
2497 root /sbin/rsyslogd -i /var/run/ 0 3.3M 3.3M 3.9M
32131 root python /usr/bin/smem -k 0 6.2M 6.3M 6.9M show total memory usage

Even the output shows in MB , to get the total memory with smem, add t option.

# smem -tk
PID User Command Swap USS PSS RSS
7510 root /sbin/mingetty /dev/tty1 0 72.0K 89.0K 540.0K
7518 root /sbin/mingetty /dev/tty4 0 72.0K 89.0K 540.0K
7524 root /sbin/mingetty /dev/tty5 0 72.0K 89.0K 540.0K
7526 root /sbin/mingetty /dev/tty6 0 72.0K 89.0K 540.0K
7514 root /sbin/mingetty /dev/tty2 0 76.0K 93.0K 544.0K
7516 root /sbin/mingetty /dev/tty3 0 76.0K 93.0K 544.0K
2487 root /sbin/portreserve 0 104.0K 122.0K 584.0K
7278 root /usr/sbin/mcelog --daemon 0 128.0K 131.0K 272.0K
2685 root /usr/sbin/acpid 0 172.0K 189.0K 536.0K
7460 root /usr/bin/rhsmcertd 0 156.0K 216.0K 616.0K
7444 root /usr/sbin/atd 0 212.0K 224.0K 500.0K
21554 root /sbin/udevd -d 0 92.0K 227.0K 720.0K
2743 haldaemon hald-addon-acpi: listening 0 156.0K 238.0K 1.0M
21553 root /sbin/udevd -d 0 100.0K 243.0K 760.0K
1168 root /sbin/udevd -d 0 108.0K 253.0K 852.0K
2730 root hald-addon-input: Listening 0 176.0K 301.0K 1.0M
2698 root hald-runner 0 220.0K 354.0K 1.2M
2463 root auditd 0 344.0K 362.0K 836.0K
2591 rpc rpcbind 0 312.0K 368.0K 896.0K
2573 root irqbalance --pid=/var/run/i 0 464.0K 490.0K 924.0K
2613 rpcuser rpc.statd 0 516.0K 586.0K 1.3M
2647 dbus dbus-daemon --system 0 592.0K 615.0K 1004.0K
1 root /sbin/init 0 556.0K 638.0K 1.5M
7429 root crond 0 684.0K 713.0K 1.2M
21729 root /sbin/dhclient -H 2daygeeks 0 732.0K 744.0K 1.0M
7295 root /usr/sbin/sshd 0 728.0K 785.0K 1.2M
28150 zenoss sshd: [email protected] 0 340.0K 948.0K 2.1M
10364 nobody /usr/bin/nmon -f -t -m /var 0 932.0K 965.0K 1.3M
7477 root /usr/sbin/certmonger -S -p 0 960.0K 994.0K 1.4M
2768 root automount --pid-file /var/r 0 1.0M 1.1M 1.8M
20091 root -bash 0 1.1M 1.2M 1.9M
7415 root /usr/libexec/postfix/master 0 1.0M 1.5M 3.4M
28148 root sshd: zenoss [priv 0 220.0K 1.6M 4.4M
29914 postfix pickup -l -t fifo -u 0 1.2M 1.6M 3.3M
7422 postfix qmgr -l -t fifo -u 0 1.1M 1.6M 3.5M
20087 root sshd: [email protected]/0 0 1.4M 2.4M 4.8M
2697 haldaemon hald 0 3.1M 3.2M 4.3M
2497 root /sbin/rsyslogd -i /var/run/ 0 3.3M 3.3M 3.9M
32132 root python /usr/bin/smem -tk 0 6.2M 6.3M 6.9M
-------------------------------------------------------------------------------
39 8 0 28.6M 34.6M 63.9M

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: LinuxDebian360UbuntuSUPython
分页:12
转载请注明
本文标题:smem Linux Memory Reporting/Statistics Tool
本站链接:http://www.codesec.net/view/530544.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(12)