Skip to content

Instantly share code, notes, and snippets.

@Perlence
Last active October 27, 2016 12:09
Show Gist options
  • Save Perlence/671e0f561d96c422701daef23c835cb8 to your computer and use it in GitHub Desktop.
Save Perlence/671e0f561d96c422701daef23c835cb8 to your computer and use it in GitHub Desktop.
Log memory usage and average load each 5 seconds
free -s 5 | stdbuf -o0 awk '/^Mem/ {mem = $3}; /buffers\/cache/ {buffers = $3}; /^Swap/ {swap = $3; print mem ";" buffers ";" swap}' > free.log &
fish -c 'while true; cat /proc/loadavg; sleep 5s; end' | stdbuf -o0 awk '{print $1}' > loadavg.log &
program
kill %1 %2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment