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 17:46:11 -0800 2008
commit  5b6d59ac6933821590e887157931a712a88e95c4
tree    b8524885e855add8e5223e22b348d3803d4895e1
parent  1fce3d5204583fde37459771e75d65a5f926db26
ebb / benchmark / concurrency_chart.rb
100644 37 lines (34 sloc) 1.078 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
# 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] || 'concurrency_results.dump')
all_m = []
concurrency_chart = GoogleChart::LineChart.new('400x300',
      Time.now.strftime('%Y.%m.%d, 20 kbyte responses'),
      true)
results.servers.each do |server|
  data = results.data(server, :concurrency).sort
  concurrency_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
concurrency_chart.axis(:y, :range => [0,max_y])
concurrency_chart.axis(:y, :labels => ['req/s'], :positions => [50])
concurrency_chart.axis(:x, :range => [0,max_x])
concurrency_chart.axis(:x, :labels => ['concurrency'], :positions => [50])
puts concurrency_chart.to_url