ry / ebb fork watch download tarball
public
Description: web server
Homepage: http://ebb.rubyforge.org
Clone URL: git://github.com/ry/ebb.git
Ryan Dahl (author)
Mon Mar 03 06:31:30 -0800 2008
commit  9bccca53b6ae1533edf3211ad0ba83a48ed9b5a9
tree    a658a2fc4b9d92df6e72291c32dfc17cb24c23f7
parent  6b67ca61e0da5ad0b69ee5aff0a116ca5c6db8d2
ebb / benchmark / bench_results.rb
100644 46 lines (39 sloc) 1.089 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# supply the benchmark dump file as an argumetn to this program
require 'rubygems'
require 'google_chart'
require 'server_test'
 
class Array
  def avg
    sum.to_f / length
  end
  def sum
    inject(0) { |i, s| s += i }
  end
end
 
 
 
colors = %w{F74343 444130 7DA478 E4AC3D}
max_x = 0
max_y = 0
results = ServerTestResults.open(ARGV[0])
all_m = []
response_chart = GoogleChart::LineChart.new('400x300', Time.now.strftime('%Y.%m.%d'), true)
results.servers.each do |server|
  data = results.data(server).sort
  response_chart.data(server, data, colors.shift)
  x = data.map { |d| d[0] }.max
  y = data.map { |d| d[1] }.max
  max_x = x if x > max_x
  max_y = y if y > max_y
end
 
label = case results.benchmark
when "response_size"
  "kilobytes served"
when "wait_fib", "concurrency"
  "concurrency"
when "post_size"
  "kilobytes uploaded"
end
 
response_chart.axis(:y, :range => [0,max_y])
response_chart.axis(:y, :labels => ['req/s'], :positions => [50])
response_chart.axis(:x, :range => [0,max_x])
response_chart.axis(:x, :labels => [label], :positions => [50])
puts response_chart.to_url