Skip to content

Instantly share code, notes, and snippets.

@egernst
Last active September 25, 2018 16:26
Show Gist options
  • Select an option

  • Save egernst/cafbe20662425828c436eec76a5fc00b to your computer and use it in GitHub Desktop.

Select an option

Save egernst/cafbe20662425828c436eec76a5fc00b to your computer and use it in GitHub Desktop.
debug script for measuring some perf stats ..
#!/bin/bash
idx=0;
iterations=$2
sleeptime=$1
# If we're in L1, let's measure vhost/qemu specifically
nestedlevel=$3
echo "Nested Level: L$3"
if [ $nestedlevel == 1 ]
then
echo " vhost thread(s) perf stat:"
for c in `ps -aeT |grep -E "vhost" | cut -c -6`; do str=$c,$str; done;
sudo perf stat -p $str -D 50 sleep 1
echo " qemu thread(s) perf stat:"
for c in `ps -aeT |grep -E "qemu" | cut -c -6`; do str=$c,$str; done;
sudo perf stat -p $str -D 50 sleep 1
fi
while [ $idx -lt $iterations ]
do
echo "--iteration $idx --"
ss -tin
mpstat -I CPU
sar -n DEV -u ALL -P ALL 1 1
idx=$[$idx+1]
sleep $sleeptime
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment