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)
Sun Feb 24 09:15:07 -0800 2008
commit  1fce3d5204583fde37459771e75d65a5f926db26
tree    d0274880200d318ad32cd266a4c40a7a7144cfc6
parent  3d4a4f70abc7eb097d4f5b8c6a4e4cdd52ae08f6
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