Skip to content

Instantly share code, notes, and snippets.

@phiros
Last active August 29, 2015 14:24
Show Gist options
  • Save phiros/1b3521a833394a984d97 to your computer and use it in GitHub Desktop.
Save phiros/1b3521a833394a984d97 to your computer and use it in GitHub Desktop.
Simple benchmark script using sysstat programs (monitors memory, io and cpu core usage)
#!/bin/bash
mkdir -p ~/log
LOGINTERVAL=$1
PROGRAM=$2
mpstat -P ALL $LOGINTERVAL > ~/log/mpstat.log 2>/dev/null &
MPSTAT_PID=$!
iostat sda $LOGINTERVAL > ~/log/iostat.log 2>/dev/null &
IOSTAT_PID=$!
sar -r $LOGINTERVAL > ~/log/memory.log 2>/dev/null &
SAR_PID=$!
sleep 60
eval $PROGRAM
sleep 60
kill $MPSTAT_PID
kill $IOSTAT_PID
kill $SAR_PID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment