mirror of
https://github.com/zebrajr/express.git
synced 2026-01-15 12:15:27 +00:00
Added graphing capabilities (gnuplot must be installed)
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,4 +2,6 @@
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.out
|
||||
*.plot
|
||||
*.out
|
||||
benchmarks/graphs
|
||||
6
Makefile
6
Makefile
@@ -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
35
benchmarks/graph
Executable 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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
require 'rubygems'
|
||||
require 'sinatra'
|
||||
|
||||
get '/' do
|
||||
'Hello World'
|
||||
end
|
||||
|
||||
run Sinatra::Application
|
||||
Reference in New Issue
Block a user