bigbench 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. data/.DS_Store +0 -0
  2. data/README.textile +254 -4
  3. data/Rakefile +43 -9
  4. data/doc/Array.html +288 -0
  5. data/doc/BigBench.html +32 -6
  6. data/doc/BigBench/Benchmark.html +24 -0
  7. data/doc/BigBench/Benchmark/Benchmark.html +24 -0
  8. data/doc/BigBench/Benchmark/Looper.html +24 -0
  9. data/doc/BigBench/Bot.html +24 -0
  10. data/doc/BigBench/Configuration.html +24 -0
  11. data/doc/BigBench/Configuration/Config.html +24 -0
  12. data/doc/BigBench/Configuration/InvalidOptions.html +24 -0
  13. data/doc/BigBench/Executor.html +33 -3
  14. data/doc/BigBench/Executor/InvalidCommand.html +25 -1
  15. data/doc/BigBench/Fragment.html +24 -0
  16. data/doc/BigBench/Fragment/Fragment.html +24 -0
  17. data/doc/BigBench/Output.html +24 -0
  18. data/doc/BigBench/PostProcessor.html +33 -6
  19. data/doc/BigBench/PostProcessor/Environment.html +489 -2
  20. data/doc/BigBench/PostProcessor/Environment/Appearings.html +327 -0
  21. data/doc/BigBench/PostProcessor/Environment/AttributeCluster.html +275 -0
  22. data/doc/BigBench/PostProcessor/Environment/BenchmarkNotFound.html +293 -0
  23. data/doc/BigBench/PostProcessor/Environment/Cluster.html +387 -0
  24. data/doc/BigBench/PostProcessor/Environment/NormalDistribution.html +383 -0
  25. data/doc/BigBench/PostProcessor/Environment/PolynomialRegression.html +438 -0
  26. data/doc/BigBench/PostProcessor/Environment/Statistics.html +568 -0
  27. data/doc/BigBench/PostProcessor/Graphs.html +270 -0
  28. data/doc/BigBench/PostProcessor/Graphs/LineGraph.html +403 -0
  29. data/doc/BigBench/PostProcessor/Graphs/PieGraph.html +396 -0
  30. data/doc/BigBench/PostProcessor/InvalidProcessor.html +25 -1
  31. data/doc/BigBench/PostProcessor/Processor.html +59 -7
  32. data/doc/BigBench/PostProcessor/Statistics.html +26 -2
  33. data/doc/BigBench/PostProcessor/Test.html +26 -2
  34. data/doc/BigBench/Runner.html +24 -0
  35. data/doc/BigBench/Runner/NoBenchmarksDefined.html +24 -0
  36. data/doc/BigBench/Store.html +24 -0
  37. data/doc/BigBench/Tracker.html +24 -0
  38. data/doc/BigBench/Tracker/Tracker.html +24 -0
  39. data/doc/EventMachineLoop.html +24 -0
  40. data/doc/Float.html +24 -0
  41. data/doc/Gemfile.html +24 -0
  42. data/doc/Helpers.html +78 -0
  43. data/doc/Object.html +29 -0
  44. data/doc/README_rdoc.html +803 -0
  45. data/doc/Rakefile.html +66 -10
  46. data/doc/created.rid +46 -40
  47. data/doc/index.html +667 -1
  48. data/doc/js/search_index.js +1 -1
  49. data/doc/lib/bigbench/help/executor_txt.html +32 -2
  50. data/doc/rdoc.css +4 -0
  51. data/doc/table_of_contents.html +179 -23
  52. data/doc/test_rdoc.html +159 -0
  53. data/lib/bigbench.rb +2 -0
  54. data/lib/bigbench/executor.rb +17 -1
  55. data/lib/bigbench/help/executor.txt +5 -0
  56. data/lib/bigbench/post_processor.rb +16 -32
  57. data/lib/bigbench/post_processor/environment.rb +525 -0
  58. data/lib/bigbench/post_processor/graphs.rb +209 -0
  59. data/lib/bigbench/post_processor/statistics.rb +29 -49
  60. data/lib/bigbench/version.rb +1 -1
  61. data/spec/executor_spec.rb +35 -0
  62. data/spec/helpers.rb +15 -1
  63. data/spec/post_processor_spec.rb +19 -4
  64. data/spec/post_processors/environment_spec.rb +412 -0
  65. data/spec/post_processors/graphs_spec.rb +23 -0
  66. data/spec/post_processors/statistics_spec.rb +3 -2
  67. data/spec/tests/local.rb +1 -1
  68. data/spec/tests/sample_results_big.ljson +51925 -0
  69. data/spec/tests/sample_results_small.ljson +3875 -0
  70. data/spec/tests/with_post_processor.ljson +43 -0
  71. data/spec/tests/with_post_processor.rb +12 -0
  72. data/spec/tmp/.DS_Store +0 -0
  73. data/spec/tracker_spec.rb +8 -8
  74. metadata +61 -101
@@ -0,0 +1,209 @@
1
+ module BigBench
2
+ module PostProcessor
3
+ module Graphs
4
+ require 'gruff'
5
+
6
+ DEFAULT = {
7
+ :folder => "graphs_#{Time.now.to_i}",
8
+ :size => "1280x720",
9
+ :line_width => 1,
10
+ :dot_radius => 2,
11
+ :x_axis_label => "seconds",
12
+ :y_axis_label => nil,
13
+ :x_axis_label_amount => 8,
14
+ :theme => {
15
+ :colors => ['#6D9CBE', '#A5C361', '#DA4939', '#FFC66D', '#D0D0FF', '#D1FFFD'],
16
+ :marker_color => 'white',
17
+ :font_color => 'white',
18
+ :background_colors => ['#2B2B2B', '#2B2B2B']
19
+ }
20
+ }
21
+
22
+ @@line_charts, @@pie_charts = nil, nil
23
+
24
+ # Encapsules the gruff line graph
25
+ class LineGraph
26
+ attr_reader :graph
27
+ attr_accessor :labels
28
+
29
+ def initialize title, options = {}
30
+ @graph = Gruff::Line.new(options[:size] || DEFAULT[:size])
31
+ @graph.title = title
32
+ @graph.theme = options[:theme] || DEFAULT[:theme]
33
+ @graph.line_width = options[:line_width] || DEFAULT[:line_width]
34
+ @graph.dot_radius = options[:dot_radius] || DEFAULT[:dot_radius]
35
+ @graph.y_axis_label = options[:y_axis_label] || DEFAULT[:y_axis_label]
36
+ @graph.x_axis_label = options[:x_axis_label] || DEFAULT[:x_axis_label]
37
+ @x_axis_label_amount = options[:x_axis_label_amount] || DEFAULT[:x_axis_label_amount]
38
+ @folder = options[:folder] || DEFAULT[:folder]
39
+
40
+ Dir.mkdir @folder unless File.directory?(@folder)
41
+ end
42
+
43
+ def add title, x, y
44
+ @x = x
45
+ @graph.data(title, y)
46
+ end
47
+
48
+ def write file
49
+ @graph.labels = @labels || calculate_x_labels
50
+ puts "Writing Graph to #{File.join(@folder, @file = file)}"
51
+ @graph.write File.join(@folder, @file = file)
52
+ end
53
+
54
+ def open
55
+ `open #{File.join(@folder, @file)}`
56
+ end
57
+
58
+ private
59
+
60
+ def calculate_x_labels
61
+ step = @x.size / @x_axis_label_amount
62
+ labels = {}
63
+ @x_axis_label_amount.times{ |i| element = i * step; labels[element] = element.to_s }
64
+ labels[@x.last] = @x.last.to_s
65
+ labels
66
+ end
67
+
68
+ end
69
+
70
+ # Encapsules the gruff pie graph
71
+ class PieGraph
72
+ attr_reader :graph
73
+ attr_accessor :labels
74
+
75
+ def initialize title, options = {}
76
+ @graph = Gruff::Pie.new(options[:size] || DEFAULT[:size])
77
+ @graph.title = title
78
+ @graph.theme = options[:theme] || DEFAULT[:theme]
79
+ @folder = options[:folder] || DEFAULT[:folder]
80
+
81
+ Dir.mkdir @folder unless File.directory?(@folder)
82
+ end
83
+
84
+ def add title, percentage
85
+ @graph.data(title, percentage)
86
+ end
87
+
88
+ def write file
89
+ puts "Writing Graph to #{File.join(@folder, @file = file)}"
90
+ @graph.write File.join(@folder, @file = file)
91
+ end
92
+
93
+ def open
94
+ `open #{File.join(@folder, @file)}`
95
+ end
96
+
97
+ end
98
+
99
+ def self.run!(options)
100
+
101
+ # Summary
102
+ line_charts.call "Summary", options
103
+ pie_charts.call "Summary", options
104
+
105
+ # Benchmarks
106
+ each_benchmark do |benchmark|
107
+ line_charts.call benchmark.name, options
108
+ pie_charts.call benchmark.name, options
109
+ end
110
+
111
+ end
112
+
113
+ private
114
+
115
+ def self.pie_charts
116
+ return @@pie_charts if @@pie_charts
117
+ @@pie_charts = proc do |name, options|
118
+
119
+ file = name.gsub(' ', '_').downcase
120
+
121
+ # HTTP Methods
122
+ methods = PieGraph.new "#{name} - HTTP Methods", options
123
+ appearing.methods.each{ |method| methods.add method.upcase, cluster(BigBench.config.duration).methods(method.to_sym).first }
124
+ methods.write "#{file}_methods.png"
125
+
126
+ # HTTP Statuses
127
+ statuses = PieGraph.new "#{name} - HTTP Statuses", options
128
+ appearing.statuses.each{ |status| statuses.add status.to_s, cluster(BigBench.config.duration).statuses(status).first }
129
+ statuses.write "#{file}_statuses.png"
130
+
131
+ # Request Paths
132
+ paths = PieGraph.new "#{name} - Request Paths", options
133
+ appearing.paths.each{ |path| paths.add path, cluster(BigBench.config.duration).paths(path).first }
134
+ paths.write "#{file}_paths.png"
135
+
136
+ end
137
+ end
138
+
139
+ def self.line_charts
140
+ return @@line_charts if @@line_charts
141
+ @@line_charts = proc do |name, options|
142
+
143
+ file = name.gsub(' ', '_').downcase
144
+
145
+ # Durations
146
+ durations = LineGraph.new("#{name} - Durations", options.merge({ :y_axis_label => "milliseconds" }))
147
+ durations.add "Real", cluster.timesteps, cluster.durations.map{ |duration| duration.round(2) }
148
+ durations.add "Linear Regression", cluster.timesteps, polynomial_regression.durations.y.map{ |duration| duration.round(2) }
149
+ durations.add "Quadratic Regression", cluster.timesteps, polynomial_regression(:degree => 2).durations.y.map{ |duration| duration.round(2) }
150
+ durations.add "Cubic Regression", cluster.timesteps, polynomial_regression(:degree => 3).durations.y.map{ |duration| duration.round(2) }
151
+ durations.write "#{file}_durations.png"
152
+
153
+ # Durations Derivation
154
+ durations_derivations = LineGraph.new("#{name} - Durations 1. Derivations", options.merge({ :y_axis_label => "milliseconds" }))
155
+ durations_derivations.add "Linear Regression", cluster.timesteps, polynomial_regression.durations.derivation(1)
156
+ durations_derivations.add "Quadratic Regression", cluster.timesteps, polynomial_regression(:degree => 2).durations.derivation(1)
157
+ durations_derivations.add "Cubic Regression", cluster.timesteps, polynomial_regression(:degree => 3).durations.derivation(1)
158
+ durations_derivations.write "#{file}_durations_derivations.png"
159
+
160
+ # Durations Distribution
161
+ durations_distribution = LineGraph.new("#{name} - Durations Distribution", options.merge({ :x_axis_label => "milliseconds", :y_axis_label => "probability" }))
162
+ durations_distribution.add "Normal Distribution with mean = #{normal_distribution.durations.mean.round(2)} sd = #{normal_distribution.durations.sd.round(2)}", cluster.timesteps, normal_distribution.durations.y
163
+ durations_distribution.labels = {
164
+ 0 => normal_distribution.durations.x[0].round(2).to_s,
165
+ 19 => (normal_distribution.durations.mean - 2 * normal_distribution.durations.sd).round(2).to_s,
166
+ 39 => (normal_distribution.durations.mean - normal_distribution.durations.sd).round(2).to_s,
167
+ 59 => normal_distribution.durations.mean.round(2).to_s,
168
+ 79 => (normal_distribution.durations.mean + normal_distribution.durations.sd).round(2).to_s,
169
+ 99 => (normal_distribution.durations.mean + 2 * normal_distribution.durations.sd).round(2).to_s,
170
+ 119 => normal_distribution.durations.x[119].round(2).to_s
171
+ }
172
+ durations_distribution.write "#{file}_durations_distribution.png"
173
+
174
+ # Requests Distribution
175
+ requests_distribution = LineGraph.new("#{name} - Requests Distribution", options.merge({ :x_axis_label => "requests per second", :y_axis_label => "probability" }))
176
+ requests_distribution.add "Normal Distribution with mean = #{normal_distribution.requests.mean.round(2)} sd = #{normal_distribution.requests.sd.round(2)}", cluster.timesteps, normal_distribution.requests.y.map{|y| y.round(2) }
177
+ requests_distribution.labels = {
178
+ 0 => normal_distribution.requests.x[0].round(2).to_s,
179
+ 19 => (normal_distribution.requests.mean - 2 * normal_distribution.requests.sd).round(2).to_s,
180
+ 39 => (normal_distribution.requests.mean - normal_distribution.requests.sd).round(2).to_s,
181
+ 59 => normal_distribution.requests.mean.round(2).to_s,
182
+ 79 => (normal_distribution.requests.mean + normal_distribution.requests.sd).round(2).to_s,
183
+ 99 => (normal_distribution.requests.mean + 2 * normal_distribution.requests.sd).round(2).to_s,
184
+ 119 => normal_distribution.requests.x[119].round(2).to_s
185
+ }
186
+ requests_distribution.write "#{file}_requests_distribution.png"
187
+
188
+ # Requests
189
+ requests = LineGraph.new("#{name} - Requests", options.merge({ :y_axis_label => "requests" }))
190
+ requests.add "Real", cluster.timesteps, cluster.requests.map{ |duration| duration.round(2) }
191
+ requests.add "Linear Regression", cluster.timesteps, polynomial_regression.requests.y.map{ |duration| duration.round(2) }
192
+ requests.add "Quadratic Regression", cluster.timesteps, polynomial_regression(:degree => 2).requests.y.map{ |duration| duration.round(2) }
193
+ requests.add "Cubic Regression", cluster.timesteps, polynomial_regression(:degree => 3).requests.y.map{ |duration| duration.round(2) }
194
+ requests.write "#{file}_requests.png"
195
+
196
+ # Requests Derivation
197
+ requests_derivations = LineGraph.new("#{name} - Requests 1. Derivations", options.merge({ :y_axis_label => "requests" }))
198
+ requests_derivations.add "Linear Regression", cluster.timesteps, polynomial_regression.requests.derivation(1)
199
+ requests_derivations.add "Quadratic Regression", cluster.timesteps, polynomial_regression(:degree => 2).requests.derivation(1)
200
+ requests_derivations.add "Cubic Regression", cluster.timesteps, polynomial_regression(:degree => 3).requests.derivation(1)
201
+ requests_derivations.write "#{file}_requests_derivations.png"
202
+
203
+ end
204
+ end
205
+
206
+
207
+ end
208
+ end
209
+ end
@@ -2,7 +2,7 @@ module BigBench
2
2
  module PostProcessor
3
3
  module Statistics
4
4
 
5
- def self.run!
5
+ def self.run!(options)
6
6
  calculate
7
7
  puts "\nBigBench Statistics"
8
8
  puts Hirb::Helpers::Table.render results, :fields => [:name, :value, :percent], :header_filter => :capitalize
@@ -14,56 +14,36 @@ module BigBench
14
14
 
15
15
  # Prepare Variables
16
16
  @total = {
17
- :requests => 0,
18
- :duration => 0,
19
- :errors => 0,
20
- :status_codes => {},
21
- :http_methods => {},
22
- :url_paths => {}
17
+ :requests => cluster(BigBench.config.duration).requests.first,
18
+ :duration => cluster(BigBench.config.duration).durations.first,
19
+ :errors => cluster(BigBench.config.duration).statuses(404).first,
20
+ :status_codes => Hash[*appearing.statuses.map{ |status| [status, cluster(BigBench.config.duration).statuses(status).first] }.flatten],
21
+ :http_methods => Hash[*appearing.methods.map{ |method| [method, cluster(BigBench.config.duration).methods(method.to_sym).first] }.flatten],
22
+ :url_paths => Hash[*appearing.paths.map{ |path| [path, cluster(BigBench.config.duration).paths(path).first] }.flatten]
23
23
  }
24
24
 
25
+
25
26
  @average = {
26
- :requests_per_second => 0,
27
- :duration_in_ms => 0,
28
- :errors_in_percent => 0,
29
- :status_codes_in_percent => {},
30
- :http_methods_in_percent => {},
31
- :url_paths_in_percent => {}
27
+ :requests_per_second => statistics.requests.average,
28
+ :duration_in_ms => statistics.durations.average,
29
+ :errors_in_percent => (@total[:errors].to_f / @total[:requests].to_f) * 100,
30
+ :status_codes_in_percent => Hash[*@total[:status_codes].map{ |status, count| [status, (count.to_f / @total[:requests].to_f * 100) ] }.flatten],
31
+ :http_methods_in_percent => Hash[*@total[:http_methods].map{ |method, count| [method, (count.to_f / @total[:requests].to_f * 100) ] }.flatten],
32
+ :url_paths_in_percent => Hash[*@total[:url_paths].map{ |path, count| [path, (count.to_f / @total[:requests].to_f * 100) ] }.flatten]
32
33
  }
33
34
 
35
+ require 'pp'
36
+ pp @average
37
+
34
38
  @max = {
35
- :duration_in_ms => 0
39
+ :duration_in_ms => statistics.durations.max,
40
+ :requests_per_second => statistics.requests.max
36
41
  }
37
42
 
38
43
  @min = {
39
- :duration_in_ms => 9_999_999
40
- }
41
-
42
- # Calculate Values
43
- each_tracking do |tracking|
44
- @total[:requests] += 1
45
- @total[:duration] += tracking[:duration]
46
- @total[:errors] += 1 unless tracking[:status].to_i == 200
47
-
48
- @total[:status_codes][tracking[:status]] = 0 unless @total[:status_codes].key?(tracking[:status])
49
- @total[:status_codes][tracking[:status]] += 1
50
-
51
- @total[:http_methods][tracking[:method]] = 0 unless @total[:http_methods].key?(tracking[:method])
52
- @total[:http_methods][tracking[:method]] += 1
53
-
54
- @total[:url_paths][tracking[:path]] = 0 unless @total[:url_paths].key?(tracking[:path])
55
- @total[:url_paths][tracking[:path]] += 1
56
-
57
- @max[:duration_in_ms] = tracking[:duration] if tracking[:duration] > @max[:duration_in_ms]
58
- @min[:duration_in_ms] = tracking[:duration] if tracking[:duration] < @min[:duration_in_ms]
59
- end
60
-
61
- @average[:requests_per_second] = @total[:requests] / BigBench.config.duration
62
- @average[:duration_in_ms] = @total[:duration] / @total[:requests]
63
- @average[:errors_in_percent] = (@total[:errors].to_f / @total[:requests].to_f) * 100
64
- @total[:status_codes].each{ |status, count| @average[:status_codes_in_percent][status] = (count.to_f / @total[:requests].to_f) * 100 }
65
- @total[:http_methods].each{ |method, count| @average[:http_methods_in_percent][method] = (count.to_f / @total[:requests].to_f) * 100 }
66
- @total[:url_paths].each{ |path, count| @average[:url_paths_in_percent][path] = (count.to_f / @total[:requests].to_f) * 100 }
44
+ :duration_in_ms => statistics.durations.min,
45
+ :requests_per_second => statistics.requests.min
46
+ }
67
47
  end
68
48
 
69
49
  # Combines the calculated values to a list
@@ -77,25 +57,25 @@ module BigBench
77
57
  {
78
58
  :name => "Total Errors:",
79
59
  :value => "#{number_with_delimiter @total[:errors]}",
80
- :percent => "#{format "%3.1f", @average[:errors_in_percent]}%"
60
+ :percent => "#{format "%3.1f", @average[:errors_in_percent].round(2)}%"
81
61
  },
82
62
  {},
83
63
  {
84
64
  :name => "Average Requests/Second:",
85
- :value => "#{number_with_delimiter @average[:requests_per_second]} Requests/sec"
65
+ :value => "#{number_with_delimiter @average[:requests_per_second].round(2)} Requests/sec"
86
66
  },
87
67
  {
88
68
  :name => "Average Request Duration:",
89
- :value => "#{number_with_delimiter @average[:duration_in_ms]} ms"
69
+ :value => "#{number_with_delimiter @average[:duration_in_ms].round(2)} ms"
90
70
  },
91
71
  {},
92
72
  {
93
73
  :name => "Max Request Duration:",
94
- :value => "#{number_with_delimiter @max[:duration_in_ms]} ms"
74
+ :value => "#{number_with_delimiter @max[:duration_in_ms].round(2)} ms"
95
75
  },
96
76
  {
97
77
  :name => "Min Request Duration:",
98
- :value => "#{number_with_delimiter @min[:duration_in_ms]} ms"
78
+ :value => "#{number_with_delimiter @min[:duration_in_ms].round(2)} ms"
99
79
  }
100
80
  ] +
101
81
  add_list("Status Codes:", :status_codes, :status_codes_in_percent) +
@@ -112,8 +92,8 @@ module BigBench
112
92
  @total[element].map{ |element, count|
113
93
  {
114
94
  :name => " #{element}",
115
- :value => "#{count}",
116
- :percent => "#{format "%3.1f", @average[element_percent][element]}%"
95
+ :value => "#{number_with_delimiter count}",
96
+ :percent => "#{@average[element_percent][element].round(2)}%"
117
97
  }
118
98
  }
119
99
  end
@@ -1,3 +1,3 @@
1
1
  module BigBench
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -77,4 +77,39 @@ describe BigBench::Executor do
77
77
  BigBench::Store.test.should be_nil
78
78
  end
79
79
 
80
+ it "should re-run the post processors from a receipt" do
81
+
82
+ argv = ["run", "postprocessors", "spec/tests/with_post_processor.rb"]
83
+ BigBench::Executor.run!(argv)
84
+
85
+ BigBench.benchmarks.size.should == 1
86
+ BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 0 }
87
+
88
+ File.exist?(BigBench.config.output).should be_true
89
+ File.open(BigBench.config.output) do |file|
90
+ file.each_line{ |json| JSON.parse(json).is_a?(Hash).should be_true }
91
+ end
92
+
93
+ BigBench.post_processors.each{ |processor| processor.runs.should == 1 }
94
+
95
+ end
96
+
97
+ it "should run a single post processor for a single test" do
98
+
99
+ argv = ["run", "postprocessor", "spec/tests/with_post_processor.rb", "statistics"]
100
+ BigBench::Executor.run!(argv)
101
+
102
+ BigBench.benchmarks.size.should == 1
103
+ BigBench.benchmarks.each{ |benchmark| benchmark.runs.should == 0 }
104
+
105
+ File.exist?(BigBench.config.output).should be_true
106
+ File.open(BigBench.config.output) do |file|
107
+ file.each_line{ |json| JSON.parse(json).is_a?(Hash).should be_true }
108
+ end
109
+
110
+ BigBench.post_processors.size.should == 1
111
+ BigBench.post_processors.first.runs.should == 1
112
+
113
+ end
114
+
80
115
  end
data/spec/helpers.rb CHANGED
@@ -5,11 +5,25 @@ require 'net/http'
5
5
  require 'eventmachine'
6
6
  require 'em-http'
7
7
 
8
- module Helpers
8
+ module Helpers
9
+
10
+ def validate_normal_distribution distribution
11
+ center_index, y = (distribution.x.size / 2), distribution.y
12
+ highest_value = y[center_index] + 1
13
+
14
+ current_value = 0.0
15
+ y.each do |value|
16
+ value.should <= highest_value
17
+ end
18
+
19
+ true
20
+ end
21
+
9
22
  end
10
23
 
11
24
  RSpec.configure do |config|
12
25
  config.include Helpers
26
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
27
  config.before(:each) {
14
28
  BigBench::Configuration.reset!
15
29
  BigBench::Benchmark.reset!
@@ -6,7 +6,7 @@ describe BigBench::PostProcessor do
6
6
  lambda{ BigBench.post_process }.should raise_exception BigBench::PostProcessor::InvalidProcessor
7
7
  end
8
8
 
9
- it "should allow to add and run post processor blocks blocks" do
9
+ it "should allow to add and run post processor blocks" do
10
10
  BigBench.post_process do
11
11
  "Finished test"
12
12
  end
@@ -16,7 +16,7 @@ describe BigBench::PostProcessor do
16
16
  end
17
17
 
18
18
  module BigBench::PostProcessor::Test
19
- def self.run!
19
+ def self.run!(options)
20
20
  "Post Processor Module"
21
21
  end
22
22
  end
@@ -30,6 +30,21 @@ describe BigBench::PostProcessor do
30
30
  BigBench.post_processors[2].run!.should == "Post Processor Module"
31
31
  end
32
32
 
33
+ it "should allow to add and run post processor with options" do
34
+
35
+ module BigBench::PostProcessor::Test
36
+ def self.run!(options)
37
+ options[:test]
38
+ end
39
+ end
40
+
41
+ BigBench.post_process BigBench::PostProcessor::Test, :test => "hello"
42
+
43
+ BigBench.post_processors.size.should == 1
44
+
45
+ BigBench.post_processors[0].run!.should == "hello"
46
+ end
47
+
33
48
  it "should run all post processors" do
34
49
 
35
50
  BigBench.post_process do
@@ -41,7 +56,7 @@ describe BigBench::PostProcessor do
41
56
  end
42
57
 
43
58
  module BigBench::PostProcessor::Test
44
- def self.run!
59
+ def self.run!(options)
45
60
  "Post Processor Module"
46
61
  end
47
62
  end
@@ -56,7 +71,7 @@ describe BigBench::PostProcessor do
56
71
  BigBench.config.output = "spec/tests/result.ljson"
57
72
 
58
73
  module BigBench::PostProcessor::Test
59
- def self.run!
74
+ def self.run!(options)
60
75
  counter = 0
61
76
  each_tracking { |tracking| counter += 1 }
62
77
  counter