railsbench 0.9.2 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGELOG +1808 -451
  2. data/GCPATCH +73 -0
  3. data/INSTALL +5 -0
  4. data/Manifest.txt +23 -13
  5. data/PROBLEMS +0 -0
  6. data/README +23 -7
  7. data/Rakefile +1 -2
  8. data/bin/railsbench +7 -1
  9. data/config/benchmarking.rb +0 -0
  10. data/config/benchmarks.rb +3 -2
  11. data/config/benchmarks.yml +0 -0
  12. data/images/empty.png +0 -0
  13. data/images/minus.png +0 -0
  14. data/images/plus.png +0 -0
  15. data/install.rb +1 -1
  16. data/latest_changes.txt +18 -0
  17. data/lib/benchmark.rb +0 -0
  18. data/lib/railsbench/benchmark.rb +576 -0
  19. data/lib/railsbench/benchmark_specs.rb +63 -63
  20. data/lib/railsbench/gc_info.rb +38 -3
  21. data/lib/railsbench/perf_info.rb +1 -1
  22. data/lib/railsbench/perf_utils.rb +202 -179
  23. data/lib/railsbench/railsbenchmark.rb +213 -55
  24. data/lib/railsbench/version.rb +9 -9
  25. data/lib/railsbench/write_headers_only.rb +15 -15
  26. data/postinstall.rb +0 -0
  27. data/ruby185gc.patch +56 -29
  28. data/ruby186gc.patch +564 -0
  29. data/ruby19gc.patch +2425 -0
  30. data/script/convert_raw_data_files +49 -49
  31. data/script/generate_benchmarks +14 -4
  32. data/script/perf_bench +12 -8
  33. data/script/perf_comp +1 -1
  34. data/script/perf_comp_gc +9 -1
  35. data/script/perf_diff +2 -2
  36. data/script/perf_diff_gc +2 -2
  37. data/script/perf_html +1 -1
  38. data/script/perf_plot +192 -75
  39. data/script/perf_plot_gc +213 -74
  40. data/script/perf_prof +29 -10
  41. data/script/perf_run +2 -2
  42. data/script/perf_run_gc +2 -2
  43. data/script/perf_table +2 -2
  44. data/script/perf_tex +1 -1
  45. data/script/perf_times +6 -6
  46. data/script/perf_times_gc +14 -2
  47. data/script/run_urls +16 -10
  48. data/setup.rb +0 -0
  49. data/test/railsbench_test.rb +0 -0
  50. data/test/test_helper.rb +2 -0
  51. metadata +77 -55
@@ -1,49 +1,49 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
-
5
- require 'fileutils'
6
- require 'railsbench/benchmark_specs'
7
-
8
- ARGV.each do |file_name|
9
- backup_file_name = file_name + '~'
10
- FileUtils.mv(file_name, backup_file_name)
11
- File.open(backup_file_name) do |infile|
12
- bench_name = Hash.new{ |hash,key| hash[key] = key }
13
- File.open(file_name, "w") do |outfile|
14
- infile.each_line do |line|
15
- case line
16
- when /-bm=([^\s]+)/
17
- # $stderr.puts "-bm=#{$1}"
18
- outfile.puts(line)
19
- benchmarks = BenchmarkSpec.load($1)
20
- benchmarks.each{|spec| bench_name[spec.uri] = spec.name}
21
- when /^(.*)(\s+[\d\.]+\s+[\d\.]+\s+[\d\.]+\s+\(\s*[\d\.]+\s*\))$/
22
- l = $1.length
23
- # $stderr.printf "%-#{l}s%s\n", $1.strip, $2
24
- outfile.printf "%-#{l}s%s\n", bench_name[$1.strip], $2
25
- else
26
- outfile.puts(line)
27
- end
28
- end
29
- end
30
- end
31
- end
32
-
33
- __END__
34
-
35
- # Copyright (C) 2007 Stefan Kaes
36
- #
37
- # This program is free software; you can redistribute it and/or modify
38
- # it under the terms of the GNU General Public License as published by
39
- # the Free Software Foundation; either version 2 of the License, or
40
- # (at your option) any later version.
41
- #
42
- # This program is distributed in the hope that it will be useful,
43
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
44
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45
- # GNU General Public License for more details.
46
- #
47
- # You should have received a copy of the GNU General Public License
48
- # along with this program; if not, write to the Free Software
49
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
+
5
+ require 'fileutils'
6
+ require 'railsbench/benchmark_specs'
7
+
8
+ ARGV.each do |file_name|
9
+ backup_file_name = file_name + '~'
10
+ FileUtils.mv(file_name, backup_file_name)
11
+ File.open(backup_file_name) do |infile|
12
+ bench_name = Hash.new{ |hash,key| hash[key] = key }
13
+ File.open(file_name, "w") do |outfile|
14
+ infile.each_line do |line|
15
+ case line
16
+ when /-bm=([^\s]+)/
17
+ # $stderr.puts "-bm=#{$1}"
18
+ outfile.puts(line)
19
+ benchmarks = BenchmarkSpec.load($1)
20
+ benchmarks.each{|spec| bench_name[spec.uri] = spec.name}
21
+ when /^(.*)(\s+[\d\.]+\s+[\d\.]+\s+[\d\.]+\s+\(\s*[\d\.]+\s*\))$/
22
+ l = $1.length
23
+ # $stderr.printf "%-#{l}s%s\n", $1.strip, $2
24
+ outfile.printf "%-#{l}s%s\n", bench_name[$1.strip], $2
25
+ else
26
+ outfile.puts(line)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ __END__
34
+
35
+ # Copyright (C) 2007, 2008 Stefan Kaes
36
+ #
37
+ # This program is free software; you can redistribute it and/or modify
38
+ # it under the terms of the GNU General Public License as published by
39
+ # the Free Software Foundation; either version 2 of the License, or
40
+ # (at your option) any later version.
41
+ #
42
+ # This program is distributed in the hope that it will be useful,
43
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
44
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45
+ # GNU General Public License for more details.
46
+ #
47
+ # You should have received a copy of the GNU General Public License
48
+ # along with this program; if not, write to the Free Software
49
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -1,5 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ unless ENV['RAILS_ROOT']
4
+ if File.directory?("config") && File.exists?("config/environment.rb")
5
+ ENV['RAILS_ROOT'] = File.expand_path(".")
6
+ else
7
+ $stderr.puts("\nperf_bench: can't generate benchmarks unless RAILS_ROOT is set")
8
+ $stderr.puts("\nbenchmarking aborted!")
9
+ exit 1
10
+ end
11
+ end
12
+
3
13
  require "#{ENV['RAILS_ROOT']}/config/environment"
4
14
  require 'application'
5
15
 
@@ -40,7 +50,7 @@ def dump_entry(name, entry, io = $stdout)
40
50
  io.puts "#{name}:"
41
51
  if entry.is_a? Hash
42
52
  VALID_KEYS.each do |key|
43
- io.printf " %15-s %s\n", key + ':', entry[key] if entry.has_key? key
53
+ io.printf " %-15s %s\n", key + ':', entry[key] if entry.has_key? key
44
54
  end
45
55
  io.puts
46
56
  elsif entry.is_a? String
@@ -50,8 +60,8 @@ def dump_entry(name, entry, io = $stdout)
50
60
  end
51
61
  end
52
62
 
53
- unless Rails::VERSION::MAJOR >= 1 && Rails::VERSION::MINOR >= 2
54
- $stderr.puts "Rails version #{Rails::VERSION::STRING} is not supported. please use a 1.2.x variety."
63
+ unless Rails::VERSION::STRING >= "1.2"
64
+ $stderr.puts "Rails version #{Rails::VERSION::STRING} is not supported. please use a 1.2.x or later variety."
55
65
  exit 1
56
66
  end
57
67
 
@@ -144,7 +154,7 @@ out.close unless out.nil?
144
154
 
145
155
  __END__
146
156
 
147
- # Copyright (C) 2007 Stefan Kaes
157
+ # Copyright (C) 2007, 2008 Stefan Kaes
148
158
  #
149
159
  # This program is free software; you can redistribute it and/or modify
150
160
  # it under the terms of the GNU General Public License as published by
data/script/perf_bench CHANGED
@@ -3,9 +3,12 @@
3
3
  $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
4
 
5
5
  unless ENV['RAILS_ROOT']
6
- $stderr.puts("\nperf_bench: can't benchmark unless RAILS_ROOT is set")
7
- $stderr.puts("\nbenchmarking aborted!")
8
- exit 1
6
+ if File.directory?("config") && File.exists?("config/environment.rb")
7
+ ENV['RAILS_ROOT'] = File.expand_path(".")
8
+ else
9
+ $stderr.puts("\nperf_bench: can't benchmark unless RAILS_ROOT is set")
10
+ exit 1
11
+ end
9
12
  end
10
13
 
11
14
  trap("INT") { $stderr.puts("benchmarking aborted!"); exit!(-1) }
@@ -19,17 +22,18 @@ module Benchmark
19
22
  end
20
23
  end
21
24
  require "benchmark"
22
- include Benchmark
23
25
 
24
- bm(32) do |test|
26
+ Benchmark.bm(32) do |test|
25
27
  test.report("loading environment") do
26
28
  require 'railsbench/railsbenchmark'
27
29
  require ENV['RAILS_ROOT'] + '/config/benchmarks'
28
30
  end
29
31
 
30
32
  trap("INT") do
31
- $stderr.puts "clearing database connections ..."
32
- ActiveRecord::Base.send :clear_all_cached_connections!
33
+ $stderr.print "clearing database connections ..."
34
+ ActiveRecord::Base.send :clear_all_cached_connections! if ActiveRecord::Base.respond_to?(:clear_all_cached_connections)
35
+ ActiveRecord::Base.send :clear_all_connections! if ActiveRecord::Base.respond_to?(:clear_all_connections)
36
+ $stderr.puts
33
37
  $stderr.puts "benchmarking aborted!"
34
38
  exit!(-1)
35
39
  end
@@ -53,7 +57,7 @@ Benchmark::OUTPUT.close unless Benchmark::OUTPUT.nil? || !ENV['RAILS_BENCHMARK_F
53
57
 
54
58
  __END__
55
59
 
56
- # Copyright (C) 2005, 2006, 2007 Stefan Kaes
60
+ # Copyright (C) 2005-2008 Stefan Kaes
57
61
  #
58
62
  # This program is free software; you can redistribute it and/or modify
59
63
  # it under the terms of the GNU General Public License as published by
data/script/perf_comp CHANGED
@@ -134,7 +134,7 @@ end
134
134
 
135
135
  __END__
136
136
 
137
- # Copyright (C) 2005, 2006, 2007 Stefan Kaes
137
+ # Copyright (C) 2005-2008 Stefan Kaes
138
138
  #
139
139
  # This program is free software; you can redistribute it and/or modify
140
140
  # it under the terms of the GNU General Public License as published by
data/script/perf_comp_gc CHANGED
@@ -85,10 +85,18 @@ printf "freelist : #{number_format}\n",
85
85
  gcis[0].freelist_min, gcis[1].freelist_min,
86
86
  gcis[0].freelist_max, gcis[1].freelist_max
87
87
 
88
+ printf "\ngarbage per object type:\n"
89
+ printf "%-12s %9s %9s %9s %7s\n", "object type", "#c1", "#c2", "c2-c1", "c2/c1"
90
+
91
+ GCInfo.object_types(gcis).each do |object_type|
92
+ n1, n2 = gcis[0].garbage_totals[object_type], gcis[1].garbage_totals[object_type]
93
+ printf "%-12s %9d %9d %9d %7.2f\n", object_type, n1, n2, n2-n1, n2.to_f/n1
94
+ end
95
+
88
96
 
89
97
  __END__
90
98
 
91
- # Copyright (C) 2005, 2006, 2007 Stefan Kaes
99
+ # Copyright (C) 2005-2008 Stefan Kaes
92
100
  #
93
101
  # This program is free software; you can redistribute it and/or modify
94
102
  # it under the terms of the GNU General Public License as published by
data/script/perf_diff CHANGED
@@ -9,7 +9,7 @@ end
9
9
  bindir = File.dirname(__FILE__)
10
10
  require "#{bindir}/../lib/railsbench/perf_utils"
11
11
 
12
- die("perf_diff: RAILS_ROOT not set") unless ENV['RAILS_ROOT']
12
+ determine_rails_root_or_die!
13
13
 
14
14
  iterations = ARGV[0]
15
15
  common = ARGV[1]
@@ -31,7 +31,7 @@ system("ruby #{bindir}/perf_comp #{file1} #{file2}")
31
31
 
32
32
  __END__
33
33
 
34
- # Copyright (C) 2005, 2006, 2007 Stefan Kaes
34
+ # Copyright (C) 2005-2008 Stefan Kaes
35
35
  #
36
36
  # This program is free software; you can redistribute it and/or modify
37
37
  # it under the terms of the GNU General Public License as published by
data/script/perf_diff_gc CHANGED
@@ -9,7 +9,7 @@ end
9
9
  bindir = File.dirname(__FILE__)
10
10
  require "#{bindir}/../lib/railsbench/perf_utils"
11
11
 
12
- die("perf_diff_gc: RAILS_ROOT not set") unless ENV['RAILS_ROOT']
12
+ determine_rails_root_or_die!
13
13
 
14
14
  iterations = ARGV[0]
15
15
  common = ARGV[1]
@@ -36,7 +36,7 @@ system("ruby #{bindir}/perf_comp_gc #{file1} #{file2}")
36
36
 
37
37
  __END__
38
38
 
39
- # Copyright (C) 2005, 2006, 2007 Stefan Kaes
39
+ # Copyright (C) 2005-2008 Stefan Kaes
40
40
  #
41
41
  # This program is free software; you can redistribute it and/or modify
42
42
  # it under the terms of the GNU General Public License as published by
data/script/perf_html CHANGED
@@ -86,7 +86,7 @@ end
86
86
 
87
87
  __END__
88
88
 
89
- # Copyright (C) 2005, 2006, 2007 Stefan Kaes
89
+ # Copyright (C) 2005-2008 Stefan Kaes
90
90
  #
91
91
  # This program is free software; you can redistribute it and/or modify
92
92
  # it under the terms of the GNU General Public License as published by
data/script/perf_plot CHANGED
@@ -1,97 +1,214 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require "gruff"
4
+
5
+ require 'optparse'
6
+ require 'ostruct'
5
7
 
6
8
  $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
7
9
  require 'railsbench/perf_info'
8
10
 
9
- # extract options
10
-
11
- selection = []
12
- title = "Performance Graph"
13
- files = []
14
- names = []
15
- labels = []
16
- perf_data = []
17
- graph_type = Gruff::Line
18
- graph_width = '800x600'
19
- font_size = 14
20
- output_file = "graph.png"
21
- colors = nil
22
- theme = nil
11
+ # parse options
12
+ o = OpenStruct.new
13
+ o.selection = []
14
+ o.title = "Performance Graph"
15
+ o.files = []
16
+ o.names = []
17
+ o.labels = []
18
+ o.graph_type = :line
19
+ o.graph_width = '800x600'
20
+ o.font_size = 14
21
+ o.output_file = nil
22
+ o.colors = nil
23
+ o.theme = nil
24
+ o.engine = :gruff
23
25
 
24
- ARGV.each do |arg|
25
- case arg
26
- when /^-only=(.*)$/
27
- selection = $1.split(',').map{|s| s.strip.to_i}
28
- when /^-title=(.*)$/
29
- title = $1 unless $1.strip.empty?
30
- when '-line'
31
- graph_type = Gruff::Line
32
- when '-bar'
33
- graph_type = Gruff::Bar
34
- when /^-width=(\d+)$/
35
- graph_width = $1.to_i
36
- when /^-geometry=(\d+x\d+)$/
37
- graph_width = $1
38
- when /^-colors=(.*)$/
39
- colors = $1.split(/ *,/)
40
- when /^-theme=(.*)$/
41
- theme = $1
42
- when /^-names=(.+)$/
43
- names = $1.split(',')
44
- when /^-labels=(.+)$/
45
- labels = $1.split(',')
46
- when /^-font_size=(\d+)$/
47
- font_size = $1.to_i
48
- when /^-out=(.+)$/
49
- output_file = $1
50
- else
51
- files << File.open_or_die(arg)
52
- names[files.length-1] ||= File.basename(arg).sub(/\.txt$/, '').sub(/^\d\d-\d\d\.[^\.]+./, '')
26
+ parser = OptionParser.new do |opts|
27
+ opts.banner = "Usage: perf_plot [options] file1 file2 ..."
28
+
29
+ opts.separator ""
30
+ opts.separator "Options:"
31
+
32
+ opts.on("-t", "--title T",
33
+ "Specify the title for your plot") do |t|
34
+ o.title = t
53
35
  end
36
+
37
+ opts.on("--only LIST", Array,
38
+ "Restrict plot to a subset of the benchmarks") do |t|
39
+ o.selection = t.map{|s| s.to_i}
40
+ end
41
+
42
+ opts.on("--line",
43
+ "Plot a line graph") do |t|
44
+ o.graph_type = :line
45
+ end
46
+
47
+ opts.on("--bar",
48
+ "Plot a bar graph") do |t|
49
+ o.graph_type = :bar
50
+ end
51
+
52
+ opts.on("-w", "--width W", Integer,
53
+ "Width of the plot (pixels)") do |w|
54
+ o.graph_width = w
55
+ end
56
+
57
+ opts.on("-g", "--geometry WxH", /\d+x\d+/,
58
+ "Specify plot dimensions (pixels)") do |d|
59
+ o.graph_width = d
60
+ end
61
+
62
+ opts.on("-c", "--colors LIST", Array,
63
+ "Use specified colors for lines/bars") do |t|
64
+ o.colors = t
65
+ end
66
+
67
+ opts.on("--theme NAME",
68
+ "Use specified theme") do |t|
69
+ o.theme = t
70
+ end
71
+
72
+ opts.on("-e", "--engine ENGINE", [:gruff, :gnuplot],
73
+ "Select plotting engine: (gruff, gnuplot)") do |e|
74
+ o.engine = e
75
+ end
76
+
77
+ opts.on("-n", "--names LIST", Array,
78
+ "Use specified names for the legend") do |t|
79
+ o.names = t
80
+ end
81
+
82
+ opts.on("-l", "--labels LIST", Array,
83
+ "Use specified labels instead of benchmark names") do |t|
84
+ o.labels = t
85
+ end
86
+
87
+ opts.on("-o", "--out FILE",
88
+ "Specify output file") do |f|
89
+ o.output_file = f
90
+ end
91
+
92
+ opts.on("-f", "--font-size N", Integer,
93
+ "Overall font size to use in the plot (points)") do |n|
94
+ o.font_size = n
95
+ end
96
+
97
+ opts.on_tail("-h", "--help", "Show this message") do
98
+ puts opts
99
+ exit
100
+ end
101
+ end
102
+
103
+ # option compatibility with older versions
104
+ args=[]
105
+ ARGV.each do |arg|
106
+ arg = arg.sub("font_size", "font-size") if arg =~ /^-font_size/
107
+ arg = "-" + arg if arg =~ /^-(title|width|out|geometry|font-size|names|labels|colors|line|bar|only)/
108
+ args << arg
54
109
  end
55
110
 
56
- files.length > 0 or die "usage: perf_plot [options] file1 file2 ..."
111
+ parser.parse!(args)
112
+
113
+ o.output_file ||= o.engine == :gruff ? "graph.png" : "graph.pdf"
57
114
 
58
- pi = nil
59
- files.each do |file|
60
- pi = PerfInfo.new(file)
61
- iter = pi.iterations
62
- urls = pi.requests_per_key
63
- perf_data << pi.keys.map{ |key| iter*urls/pi.timings_mean(key) }
64
- file.close
115
+ args.each do |arg|
116
+ o.files << File.open_or_die(arg)
117
+ o.names[o.files.length-1] ||= File.basename(arg).sub(/\.txt$/, '').sub(/^\d\d-\d\d\.[^\.]+./, '')
65
118
  end
66
119
 
67
- selection = (1..(perf_data.last.length)).to_a if selection.empty?
68
- if labels.empty?
69
- labels = pi.keys.restrict_to(selection.map{|i| i-1})
120
+ o.files.length > 0 or die(parser.banner)
121
+
122
+ class Plotter
123
+ attr_reader :o
124
+ def initialize(options)
125
+ @o = options
126
+ setup
127
+ end
128
+
129
+ def setup
130
+ pi = nil
131
+ @perf_data = []
132
+ o.files.each do |file|
133
+ pi = PerfInfo.new(file)
134
+ iter = pi.iterations
135
+ urls = pi.requests_per_key
136
+ @perf_data << pi.keys.map{ |key| iter*urls/pi.timings_mean(key) }
137
+ file.close
138
+ end
139
+ o.selection = (1..(@perf_data.last.length)).to_a if o.selection.empty?
140
+ if o.labels.empty?
141
+ o.labels = pi.keys.restrict_to(o.selection.map{|i| i-1})
142
+ end
143
+ @perf_data = @perf_data.map{|d| d.restrict_to(o.selection.map{|i| i-1})}
144
+ end
145
+
146
+ def plot_with_gruff
147
+ require 'gruff'
148
+
149
+ g = o.graph_type == :line ? Gruff::Line.new(o.graph_width) : Gruff::Bar.new(o.graph_width)
150
+ g.send "theme_#{o.theme}" if o.theme
151
+
152
+ # on OS X, ImagMagick can't find it's default font (arial) sometimes, so specify some font
153
+ #g.font = 'Arial-Normal' if RUBY_PLATFORM =~ /darwin/
154
+ g.font = 'Helvetica' if RUBY_PLATFORM =~ /darwin/
155
+
156
+ g.replace_colors(o.colors) if o.colors
157
+ g.title = o.title
158
+ g.sort = false
159
+ g.legend_font_size = o.font_size
160
+ g.legend_box_size = o.font_size
161
+ g.marker_font_size = o.font_size
162
+ g.minimum_value = 0
163
+ g.maximum_value = @perf_data.flatten.max.ceil
164
+ g.labels = o.labels.index_map
165
+ @perf_data.each_with_index{|d,i| g.data(o.names[i], d)}
166
+ g.write(o.output_file)
167
+ end
168
+
169
+ def plot_with_gnuplot
170
+ require 'gnuplot'
171
+ Gnuplot.open(false) do |gnuplot|
172
+ Gnuplot::Plot.new(gnuplot) do |plot|
173
+ plot.terminal "pdf noenhanced color fname 'Helvetica' fsize 5"
174
+ plot.output o.output_file
175
+ plot.xlabel "Benchmarks"
176
+ plot.ylabel "Requests per second"
177
+ plot.yrange "[0:*]"
178
+ plot.title o.title
179
+ plot.style "fill solid 1.0 noborder"
180
+ plot.style "data #{o.graph_type == :line ? "linespoints" : "histogram"}"
181
+ plot.style "histogram cluster gap 1"
182
+ plot.xtics "nomirror rotate by -45"
183
+ label_specs = []
184
+ o.labels.each_with_index{ |l,i| label_specs << "\"#{l}\" #{i}" }
185
+ plot.xtics "(#{label_specs.join(', ')})"
186
+ plot.key "outside reverse"
187
+ #plot.boxwidth "0.95"
188
+ plot.grid "nopolar"
189
+ plot.grid "noxtics nomxtics ytics nomytics noztics nomztics nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics"
190
+ plot.grid "back linetype 0 linewidth 0.7"
191
+
192
+ @perf_data.each_with_index do |d,i|
193
+ plot.data << Gnuplot::DataSet.new([[o.names[i]] + d]) do |ds|
194
+ ds.using = "1 title 1"
195
+ end
196
+ end
197
+ end
198
+ end
199
+ end
200
+
201
+ def plot
202
+ send "plot_with_#{o.engine}"
203
+ end
70
204
  end
71
- perf_data = perf_data.map{|d| d.restrict_to(selection.map{|i| i-1})}
72
-
73
- # puts selection.inspect
74
- # puts labels.inspect
75
- # puts perf_data.inspect
76
-
77
- g = graph_type.new(graph_width)
78
- g.send "theme_#{theme}" if theme
79
- g.replace_colors(colors) if colors
80
- g.title = title
81
- g.sort = false
82
- g.legend_font_size = font_size
83
- g.legend_box_size = font_size
84
- g.marker_font_size = font_size
85
- g.minimum_value = 0
86
- g.maximum_value = perf_data.flatten.max.ceil
87
- g.labels = labels.index_map
88
- perf_data.each_with_index{|d,i| g.data(names[i], d)}
89
- g.write(output_file)
205
+
206
+ Plotter.new(o).plot
90
207
 
91
208
 
92
209
  __END__
93
210
 
94
- # Copyright (C) 2005, 2006, 2007 Stefan Kaes
211
+ # Copyright (C) 2005-2008 Stefan Kaes
95
212
  #
96
213
  # This program is free software; you can redistribute it and/or modify
97
214
  # it under the terms of the GNU General Public License as published by