Created
December 3, 2012 19:47
-
-
Save ffeldhaus/4197449 to your computer and use it in GitHub Desktop.
Script for measuring the duration of nova get-vnc-console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# first parameter is the ID of a nova instance | |
# second parameter may be the amount of runs | |
count=${2:-100} | |
timefile=/tmp/vnctime.out | |
fmt="%e" | |
# mv out file to old | |
mv $timefile $timefile.old | |
for i in `seq 1 $count`; do | |
/usr/bin/time -f "$fmt" -o $timefile -a nova get-vnc-console $1 novnc > /dev/null | |
sleep 1 | |
done | |
min=`awk 'min=="" || $1 < min {min=$1} END{ print min}' /tmp/vnctime.out` | |
max=`awk 'max=="" || $1 > max {max=$1} END{ print max}' /tmp/vnctime.out` | |
sum=`awk '{ sum+=$1 } END {print sum}' /tmp/vnctime.out` | |
average=$(bc <<<"scale=2;$sum/$count") | |
echo "Minimum duration: $min seconds" | |
echo "Maximum duration: $max seconds" | |
echo "Total duration: $sum seconds" | |
printf "Average duration: %0g seconds\n" $average |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment