Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pixelb/ps_mem
A utility to accurately report the in core memory usage for a program
https://github.com/pixelb/ps_mem
memory process ram shared usage
Last synced: 9 days ago
JSON representation
A utility to accurately report the in core memory usage for a program
- Host: GitHub
- URL: https://github.com/pixelb/ps_mem
- Owner: pixelb
- License: lgpl-2.1
- Created: 2013-09-06T16:15:41.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-10-19T01:37:40.000Z (about 2 years ago)
- Last Synced: 2024-04-25T16:03:01.621Z (7 months ago)
- Topics: memory, process, ram, shared, usage
- Language: Python
- Size: 111 KB
- Stars: 1,509
- Watchers: 76
- Forks: 285
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - ps_mem - A utility to accurately report the in core memory usage for a program. (Debugging & Profiling & Tracing / For Python)
- jimsghstars - pixelb/ps_mem - A utility to accurately report the in core memory usage for a program (Python)
README
ps_mem
======A utility to accurately report the core memory usage for a program
Yes the name is a bit weird. coremem would be more appropriate,
but for backwards compatible reasons the ps_mem name remains.Install:
`pip install ps_mem` is supported, or rpm and deb packages
are available for most distros. Also the ps_mem.py script
can be run directly.Usage:
```
ps_mem [-h|--help] [-p PID,...] [-s|--split-args] [-t|--total] [-w N]
[-d|--discriminate-by-pid] [-S|--swap]
```Example output:
```
Private + Shared = RAM used Program34.6 MiB + 1.0 MiB = 35.7 MiB gnome-terminal
139.8 MiB + 2.3 MiB = 142.1 MiB firefox
291.8 MiB + 2.5 MiB = 294.3 MiB gnome-shell
272.2 MiB + 43.9 MiB = 316.1 MiB chrome (12)
913.9 MiB + 3.2 MiB = 917.1 MiB thunderbird
---------------------------------
1.9 GiB
=================================
```The [-p PID,...] option allows filtering the results.
For example to restrict output to the current $USER you could:```
sudo ps_mem -p $(pgrep -d, -u $USER)
```or to summarize the total RAM usage per user you could:
```sh
for i in $(ps -e -o user= | sort | uniq); do
printf '%-20s%10s\n' $i $(sudo ps_mem --total -p $(pgrep -d, -u $i))
done
```