Added graphing capabilities (gnuplot must be installed)

This commit is contained in:
visionmedia
2010-04-22 12:04:28 -07:00
parent 2dc5afd018
commit 59c4e35691
8 changed files with 50 additions and 19 deletions

4
.gitignore vendored
View File

@@ -2,4 +2,6 @@
*.seed
*.log
*.csv
*.out
*.plot
*.out
benchmarks/graphs

View File

@@ -35,5 +35,9 @@ compile-coffee:
benchmark: benchmarks/run
@./benchmarks/run
@./benchmarks/graph
.PHONY: install test app
graphs:
@./benchmarks/graph
.PHONY: install test app benchmark graphs

35
benchmarks/graph Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
#
# Output gnuplot script.
#
# <title> <node> <express> <sinatra>
#
function plot() {
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 percentage"
set xlabel "response time (ms)"
plot "benchmarks/$2" using 10 with lines title "node", \\
"benchmarks/$3" using 10 with lines title "express", \\
"benchmarks/$4" using 10 with lines title "sinatra thin"
EOF
}
mkdir -p benchmarks/graphs
for type in simple static static.large; do
echo ... generating benchmarks/graphs/$type.png
plot $type \
express/$type.js.plot \
node/$type.js.plot \
thin/$type.ru.plot \
> benchmarks/graphs/$type.p
gnuplot benchmarks/graphs/$type.p
done

View File

@@ -40,7 +40,7 @@ bm(){
esac
pid=$!
sleep $SLEEP
$AB $ABFLAGS -e benchmarks/$type/$file.csv $ADDR > benchmarks/$type/$file.out
$AB $ABFLAGS -g benchmarks/$type/$file.plot $ADDR > benchmarks/$type/$file.out
log $(cat benchmarks/$type/$file.out | grep Requests)
kill -KILL $pid
}
@@ -53,6 +53,5 @@ bm express simple.js
bm express static.js
bm express static.large.js
bm thin simple.ru
bm thin simple.sinatra.ru
bm thin static.sinatra.ru
bm thin static.sinatra.large.ru
bm thin static.ru
bm thin static.large.ru

View File

@@ -1,9 +1,9 @@
require 'rubygems'
require 'rack'
require 'sinatra'
app = lambda do |env|
[200, { 'Content-Type' => 'text/plain' }, 'Hello World']
get '/' do
'Hello World'
end
run app
run Sinatra::Application

View File

@@ -1,9 +0,0 @@
require 'rubygems'
require 'sinatra'
get '/' do
'Hello World'
end
run Sinatra::Application