Skip to content

Instantly share code, notes, and snippets.

@JordiCorbilla
Last active April 10, 2017 20:23
Show Gist options
  • Save JordiCorbilla/7e99417d4614034c87b1c4a254bb3f60 to your computer and use it in GitHub Desktop.
Save JordiCorbilla/7e99417d4614034c87b1c4a254bb3f60 to your computer and use it in GitHub Desktop.
#!/bin/bash
# @Author: Jordi Corbilla
while true; do
(echo "%CPU %MEM ARGS $(date)" && ps -e -o pcpu,pmem,args --sort=pcpu | cut -d" " -f1-5 | tail) >> cpu.log; sleep 0.1;
done
#Example results;
#%CPU %MEM ARGS Fri 12 Aug 19:11:20 UTC 2016
#87.0 1.8 python /home/pi/mpi4py-2.0.0/demo/matrixmultiplication.py
#90.0 1.8 python /home/pi/mpi4py-2.0.0/demo/matrixmultiplication.py
#90.5 1.9 python /home/pi/mpi4py-2.0.0/demo/matrixmultiplication.py
#92.5 1.8 python /home/pi/mpi4py-2.0.0/demo/matrixmultiplication.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment