New ask Hacker News story: Print RAM Usage of process including children
Print RAM Usage of process including children
2 by sean_pedersen | 0 comments on Hacker News.
Prints resident set size (RAM) usage of processes including $1 in their name (includes children): function ram() {pgrep -f $1 | xargs -I{} pmap -x {} | grep total | python -c "import sys; print('%.2f' % (sum([float([c for c in line.strip().split(' ') if c][3]) for line in list(sys.stdin)])/1024), 'MB RAM')"} Been looking for a way to see total RAM usage of processes including their children, after a bit of googling I came up with this ugly one liner, but hey it works!
2 by sean_pedersen | 0 comments on Hacker News.
Prints resident set size (RAM) usage of processes including $1 in their name (includes children): function ram() {pgrep -f $1 | xargs -I{} pmap -x {} | grep total | python -c "import sys; print('%.2f' % (sum([float([c for c in line.strip().split(' ') if c][3]) for line in list(sys.stdin)])/1024), 'MB RAM')"} Been looking for a way to see total RAM usage of processes including their children, after a bit of googling I came up with this ugly one liner, but hey it works!
Comments
Post a Comment