#!/usr/bin/env bash COL=${COL-9} # # Log # # # log(){ echo "... $@" } # # Output gnuplot script for line graph. # # <node> <express> <sinatra> # function line() { cat <<-EOF set terminal png set output "benchmarks/graphs/$1.png" set title "$1" set size 1,0.7 set grid y set key left top set xlabel "request" set ylabel "response time (ms)" plot "benchmarks/$2" using $COL smooth sbezier with lines title "node", \\ "benchmarks/$3" using $COL smooth sbezier with lines title "express", \\ "benchmarks/$4" using $COL smooth sbezier with lines title "sinatra thin" EOF } # # Output gnuplot script for bar graph. # # <title> <node> <express> <sinatra> # function bar() { cat <<-EOF set terminal png set output "benchmarks/graphs/$1.rps.png" set title "$1" set size 0.7,0.5 set grid y set key left top set ylabel "requests per second" plot "benchmarks/$1.rps.dat" using 2: xtic(1) with histogram title "" EOF } mkdir -p benchmarks/graphs for type in simple haml sass static static.large; do plot=benchmarks/graphs/$type.p log generating benchmarks/graphs/$type.png line $type \ node/$type.js.dat \ express/$type.js.dat \ thin/$type.ru.dat \ > $plot gnuplot $plot log generating benchmarks/graphs/$type.rps.png plot=benchmarks/graphs/$type.rps.p dat=benchmarks/$type.rps.dat :> $dat for server in node express thin; do case $server in node|express) ext=js ;; thin) ext=ru ;; esac rps=$(cat benchmarks/$server/$type.$ext.out | grep "Requests per second:" | awk '{ print $4 }') echo $server $rps >> $dat done bar $type > $plot gnuplot $plot done rm benchmarks/graphs/*.p