DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Linux System Memory Probe


Using top

Run top then press "M" (which means "Shift-m"). Press "P" for sorting by CPU usage. Press "f" to define which columns you want to display or hide on screen. You can also try "x", "<", ">" to demonstrate their functions. Using "R" to determine sort styles between high-to-low and low-to-high sorts. See "SORTING of task window" in section 4c of man top for details.

GUI Utility

On Ubuntu 14.04, press Win key then input "system" to run "System Monitor". In "Processes" tab page, click "Memeory" column.

Using smem

smem is a tool that can give accurate reports on memory usage of one/all process(es) on Linux systems. Install it with apt install smem or yum install smem.

Pandas 和 PySpark 内存使用情况分析

本地纯 Pandas 实现的算法,使用 pytest 运行测试用例: smem -k -t -c "pid name command user pss" -P pytest

基于 PySpark + Pandas 方案运行: smem -k -t -c "pid name command user pss" -P spark

其中 -k 表示显示数字单位,-t 表示现实汇总值,-c 指定输出哪些列, -P 表示用后面的关键字过滤线程,这里线程的名字可以通过 htop 或者 ps 查出来。

Notes:

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

  • List all process's memory consumption of a user: smem -u <username>

  • 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



Published

Dec 25, 2014

Last Updated

Dec 18, 2018

Category

Tech

Tags

  • linux 158
  • memory 3

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor