Created
June 21, 2014 12:26
-
-
Save itiut/8ae1943f185e656acaee to your computer and use it in GitHub Desktop.
ビルトインのtimeコマンドの出力からrealの時間を抽出してプロットする
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/sh | |
set -eu | |
cd $(dirname $0) | |
if [ $# -ne 1 ]; then | |
echo "Usage: [$0] directory" | |
exit | |
fi | |
cd $1 | |
sumarize() { | |
echo '# query, seconds' > execution_time.dat | |
for i in $(seq 1 22); do | |
if [ ! -f time$i.out ]; then | |
continue | |
fi | |
grep -e '^real' time$i.out \ | |
| sed -r 's/^[^0-9]*([0-9]+)m([0-9.]+)s/\1 \2/g' \ | |
| awk -v i="$i" '{ printf "%d %f\n", i, $1*60 + $2 }' \ | |
>> execution_time.dat | |
done | |
echo "[$0] Write $PWD/execution_time.dat" | |
} | |
plot() { | |
gnuplot <<EOPLT | |
set mytics 2.5; | |
unset key; | |
set xlabel 'Queries'; | |
set ylabel 'Execution Time [sec]'; | |
set boxwidth 0.5 relative; | |
set style fill solid 0.5; | |
set terminal postscript eps enhanced color; | |
set output 'execution_time.eps' | |
plot 'execution_time.dat' u 0:2:xtic(1) w boxes, , '' u 0:(\$2):(sprintf("%.0f",\$2)) w labels; | |
set terminal emf enhanced; | |
set output 'execution_time.emf' | |
replot; | |
EOPLT | |
echo "[$0] Write $PWD/execution_time.eps" | |
echo "[$0] Write $PWD/execution_time.emf" | |
} | |
sumarize | |
plot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment