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)
Tue Feb 26 15:14:24 -0800 2008
commit  bdee84b3f95a6ac6e9632090f7095bd655af3288
tree    cbdacdbe44ff0ce7c99ec84ebe61a2cd82b90bf7
parent  02b6f662e1a4fec2a15807ce1d76e48aa9067b0b
ebb / benchmark / digest.rb
100644 35 lines (32 sloc) 0.996 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
# supply the benchmark dump file as an argumetn to this program
require 'rubygems'
require 'google_response_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, :size).sort
  response_chart.data(server, data, colors.shift)
 # data.delete_if { |d| d[0] > 100.kilobytes }
  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
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 => ['bytes served'], :positions => [50])
puts response_chart.to_url