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.
- data/.DS_Store +0 -0
- data/README.textile +254 -4
- data/Rakefile +43 -9
- data/doc/Array.html +288 -0
- data/doc/BigBench.html +32 -6
- data/doc/BigBench/Benchmark.html +24 -0
- data/doc/BigBench/Benchmark/Benchmark.html +24 -0
- data/doc/BigBench/Benchmark/Looper.html +24 -0
- data/doc/BigBench/Bot.html +24 -0
- data/doc/BigBench/Configuration.html +24 -0
- data/doc/BigBench/Configuration/Config.html +24 -0
- data/doc/BigBench/Configuration/InvalidOptions.html +24 -0
- data/doc/BigBench/Executor.html +33 -3
- data/doc/BigBench/Executor/InvalidCommand.html +25 -1
- data/doc/BigBench/Fragment.html +24 -0
- data/doc/BigBench/Fragment/Fragment.html +24 -0
- data/doc/BigBench/Output.html +24 -0
- data/doc/BigBench/PostProcessor.html +33 -6
- data/doc/BigBench/PostProcessor/Environment.html +489 -2
- data/doc/BigBench/PostProcessor/Environment/Appearings.html +327 -0
- data/doc/BigBench/PostProcessor/Environment/AttributeCluster.html +275 -0
- data/doc/BigBench/PostProcessor/Environment/BenchmarkNotFound.html +293 -0
- data/doc/BigBench/PostProcessor/Environment/Cluster.html +387 -0
- data/doc/BigBench/PostProcessor/Environment/NormalDistribution.html +383 -0
- data/doc/BigBench/PostProcessor/Environment/PolynomialRegression.html +438 -0
- data/doc/BigBench/PostProcessor/Environment/Statistics.html +568 -0
- data/doc/BigBench/PostProcessor/Graphs.html +270 -0
- data/doc/BigBench/PostProcessor/Graphs/LineGraph.html +403 -0
- data/doc/BigBench/PostProcessor/Graphs/PieGraph.html +396 -0
- data/doc/BigBench/PostProcessor/InvalidProcessor.html +25 -1
- data/doc/BigBench/PostProcessor/Processor.html +59 -7
- data/doc/BigBench/PostProcessor/Statistics.html +26 -2
- data/doc/BigBench/PostProcessor/Test.html +26 -2
- data/doc/BigBench/Runner.html +24 -0
- data/doc/BigBench/Runner/NoBenchmarksDefined.html +24 -0
- data/doc/BigBench/Store.html +24 -0
- data/doc/BigBench/Tracker.html +24 -0
- data/doc/BigBench/Tracker/Tracker.html +24 -0
- data/doc/EventMachineLoop.html +24 -0
- data/doc/Float.html +24 -0
- data/doc/Gemfile.html +24 -0
- data/doc/Helpers.html +78 -0
- data/doc/Object.html +29 -0
- data/doc/README_rdoc.html +803 -0
- data/doc/Rakefile.html +66 -10
- data/doc/created.rid +46 -40
- data/doc/index.html +667 -1
- data/doc/js/search_index.js +1 -1
- data/doc/lib/bigbench/help/executor_txt.html +32 -2
- data/doc/rdoc.css +4 -0
- data/doc/table_of_contents.html +179 -23
- data/doc/test_rdoc.html +159 -0
- data/lib/bigbench.rb +2 -0
- data/lib/bigbench/executor.rb +17 -1
- data/lib/bigbench/help/executor.txt +5 -0
- data/lib/bigbench/post_processor.rb +16 -32
- data/lib/bigbench/post_processor/environment.rb +525 -0
- data/lib/bigbench/post_processor/graphs.rb +209 -0
- data/lib/bigbench/post_processor/statistics.rb +29 -49
- data/lib/bigbench/version.rb +1 -1
- data/spec/executor_spec.rb +35 -0
- data/spec/helpers.rb +15 -1
- data/spec/post_processor_spec.rb +19 -4
- data/spec/post_processors/environment_spec.rb +412 -0
- data/spec/post_processors/graphs_spec.rb +23 -0
- data/spec/post_processors/statistics_spec.rb +3 -2
- data/spec/tests/local.rb +1 -1
- data/spec/tests/sample_results_big.ljson +51925 -0
- data/spec/tests/sample_results_small.ljson +3875 -0
- data/spec/tests/with_post_processor.ljson +43 -0
- data/spec/tests/with_post_processor.rb +12 -0
- data/spec/tmp/.DS_Store +0 -0
- data/spec/tracker_spec.rb +8 -8
- metadata +61 -101
@@ -0,0 +1,412 @@
|
|
1
|
+
require_relative "../helpers"
|
2
|
+
|
3
|
+
describe BigBench::PostProcessor::Environment do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
BigBench.config.duration = 7.seconds
|
7
|
+
BigBench.config.output = "spec/tests/sample_results_small.ljson"
|
8
|
+
|
9
|
+
class << self
|
10
|
+
include BigBench::PostProcessor::Environment
|
11
|
+
end
|
12
|
+
|
13
|
+
@total_trackings = 3_875
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should allow to iterate over each tracking" do
|
17
|
+
all_trackings = 0
|
18
|
+
each_tracking do |tracking|
|
19
|
+
tracking.is_a?(Hash).should be_true
|
20
|
+
all_trackings += 1
|
21
|
+
end
|
22
|
+
|
23
|
+
all_trackings.should == @total_trackings
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should collect a trackings array with all trackings" do
|
27
|
+
trackings.size.should == @total_trackings
|
28
|
+
trackings.each do |tracking|
|
29
|
+
tracking.is_a?(Hash).should be_true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "statistics", :statistics do
|
34
|
+
|
35
|
+
it "should calculate the minimum" do
|
36
|
+
statistics.durations.min.should == 1
|
37
|
+
statistics(1.minute).durations.min.should == 1
|
38
|
+
statistics.requests.min.should == 28
|
39
|
+
statistics.methods(:get).min.should == 19
|
40
|
+
statistics.statuses(200).min.should == 28
|
41
|
+
statistics.paths("/").min.should == 19
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should calculate the maximum" do
|
45
|
+
statistics.durations.max.should == 26
|
46
|
+
statistics.requests.max.should == 591
|
47
|
+
statistics.methods(:get).max.should == 394
|
48
|
+
statistics.statuses(200).max.should == 591
|
49
|
+
statistics.paths("/").max.should == 394
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should calculate the mean - average" do
|
53
|
+
statistics.durations.mean.should == 1.1945806451612904
|
54
|
+
statistics.durations.average.should == 1.1945806451612904
|
55
|
+
statistics.requests.mean.should == 484.375
|
56
|
+
statistics.methods(:get).mean.should == 323.0
|
57
|
+
statistics.statuses(200).mean.should == 484.375
|
58
|
+
statistics.paths("/").mean.should == 323.0
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should calculate the standard_deviation - sd" do
|
62
|
+
statistics.durations.standard_deviation.should == 0.3565219562955294
|
63
|
+
statistics.durations.sd.should == 0.3565219562955294
|
64
|
+
statistics.requests.sd.should == 114.09375
|
65
|
+
statistics.methods(:get).sd.should == 76.0
|
66
|
+
statistics.statuses(200).sd.should == 114.09375
|
67
|
+
statistics.paths("/").sd.should == 76.0
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should calculate the squared_deviation - variance" do
|
71
|
+
statistics.durations.squared_deviation.should == 1.8738803080123505
|
72
|
+
statistics.durations.variance.should == 1.8738803080123505
|
73
|
+
statistics.requests.variance.should == 30844.734375
|
74
|
+
statistics.methods(:get).variance.should == 13687.25
|
75
|
+
statistics.statuses(200).variance.should == 30844.734375
|
76
|
+
statistics.paths("/").variance.should == 13682.0
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
context "normal_distribution", :gauss do
|
82
|
+
|
83
|
+
it "should work with durations" do
|
84
|
+
validate_normal_distribution(normal_distribution.durations).should be_true
|
85
|
+
normal_distribution.durations.formula.should == "1 / sqrt(2 * pi * 0.06692176830748373) * e**( -0.5 * (x - 1.1776612630893981)**2 / 0.06692176830748373)"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should work with requests" do
|
89
|
+
validate_normal_distribution(normal_distribution.requests).should be_true
|
90
|
+
normal_distribution.requests.formula.should == "1 / sqrt(2 * pi * 114.09375) * e**( -0.5 * (x - 484.375)**2 / 114.09375)"
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should work with methods" do
|
94
|
+
validate_normal_distribution(normal_distribution.methods(:get)).should be_true
|
95
|
+
normal_distribution.methods(:get).formula.should == "1 / sqrt(2 * pi * 76.0) * e**( -0.5 * (x - 323.0)**2 / 76.0)"
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should work with statuses" do
|
99
|
+
validate_normal_distribution(normal_distribution.statuses(200)).should be_true
|
100
|
+
normal_distribution.statuses(200).formula.should == "1 / sqrt(2 * pi * 114.09375) * e**( -0.5 * (x - 484.375)**2 / 114.09375)"
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should work with paths" do
|
104
|
+
validate_normal_distribution(normal_distribution.paths("/")).should be_true
|
105
|
+
normal_distribution.paths("/").formula.should == "1 / sqrt(2 * pi * 76.0) * e**( -0.5 * (x - 323.0)**2 / 76.0)"
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
context "cluster", :cluster do
|
111
|
+
|
112
|
+
it "should work with timesteps" do
|
113
|
+
cluster.timesteps.size.should == 8
|
114
|
+
cluster(1.second).timesteps.size.should == 8
|
115
|
+
cluster(1.minute).timesteps.size.should == 1
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should work with durations" do
|
119
|
+
cluster.durations.size.should == 8
|
120
|
+
cluster.durations.each{ |duration| duration.is_a?(Float) }
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should work with requests" do
|
124
|
+
cluster.requests.size.should == 8
|
125
|
+
cluster.requests.each{ |requests| requests.is_a?(Integer) }
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should work with methods" do
|
129
|
+
cluster.methods(:get).size.should == 8
|
130
|
+
cluster.methods(:post).size.should == 8
|
131
|
+
cluster.methods(:nothing).size.should == 8
|
132
|
+
|
133
|
+
cluster.methods(:post).each{ |requests| requests.is_a?(Integer) }
|
134
|
+
cluster.methods(:nothing).each{ |requests| requests.is_a?(Integer) }
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should work with statuses" do
|
138
|
+
cluster.statuses(200).size.should == 8
|
139
|
+
cluster.statuses(404).size.should == 8
|
140
|
+
cluster.statuses("nothing").size.should == 8
|
141
|
+
|
142
|
+
cluster.statuses(200).each{ |requests| requests.is_a?(Integer) }
|
143
|
+
cluster.statuses(404).each{ |requests| requests.is_a?(Integer) }
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should work with paths" do
|
147
|
+
cluster.paths("/").size.should == 8
|
148
|
+
cluster.paths("/pages").size.should == 8
|
149
|
+
cluster.paths("nothing").size.should == 8
|
150
|
+
|
151
|
+
cluster.paths("/").each{ |requests| requests.is_a?(Integer) }
|
152
|
+
cluster.paths("/pages").each{ |requests| requests.is_a?(Integer) }
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
context "linear regression", :linreg do
|
158
|
+
|
159
|
+
it "should create durations with the default timebase" do
|
160
|
+
polynomial_regression.durations.x.size.should == 8
|
161
|
+
polynomial_regression.durations.y.size.should == 8
|
162
|
+
polynomial_regression.durations.derivation(0).size.should == 8
|
163
|
+
polynomial_regression.durations.derivation(1).size.should == 8
|
164
|
+
polynomial_regression.durations.degree.should == 1
|
165
|
+
polynomial_regression.durations.coefficients.should == [1.174433419687437, 0.0009222409719889246]
|
166
|
+
polynomial_regression.durations.formula.should == "1.174433419687437 + 0.0009222409719889246x^1"
|
167
|
+
polynomial_regression.durations.formula(1).should == "0.0009222409719889246"
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should create requests with the default timebase" do
|
171
|
+
polynomial_regression.requests.x.size.should == 8
|
172
|
+
polynomial_regression.requests.y.size.should == 8
|
173
|
+
polynomial_regression.requests.derivation(0).size.should == 8
|
174
|
+
polynomial_regression.requests.derivation(1).size.should == 8
|
175
|
+
|
176
|
+
polynomial_regression.requests.degree.should == 1
|
177
|
+
polynomial_regression.requests.coefficients.should == [334.5000000000001, 42.82142857142857]
|
178
|
+
polynomial_regression.requests.formula.should == "334.5000000000001 + 42.82142857142857x^1"
|
179
|
+
polynomial_regression.requests.formula(1).should == "42.82142857142857"
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should create methods with the default timebase" do
|
183
|
+
polynomial_regression.methods(:get).x.size.should == 8
|
184
|
+
polynomial_regression.methods(:get).y.size.should == 8
|
185
|
+
polynomial_regression.methods(:get).derivation(0).size.should == 8
|
186
|
+
polynomial_regression.methods(:get).derivation(1).size.should == 8
|
187
|
+
|
188
|
+
polynomial_regression.methods(:get).degree.should == 1
|
189
|
+
polynomial_regression.methods(:get).coefficients.should == [223.25000000000006, 28.499999999999996]
|
190
|
+
polynomial_regression.methods(:get).formula.should == "223.25000000000006 + 28.499999999999996x^1"
|
191
|
+
polynomial_regression.methods(:get).formula(1).should == "28.499999999999996"
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should create statuses with the default timebase" do
|
195
|
+
polynomial_regression.statuses(200).x.size.should == 8
|
196
|
+
polynomial_regression.statuses(200).y.size.should == 8
|
197
|
+
polynomial_regression.statuses(200).derivation(0).size.should == 8
|
198
|
+
polynomial_regression.statuses(200).derivation(1).size.should == 8
|
199
|
+
|
200
|
+
polynomial_regression.statuses(200).degree.should == 1
|
201
|
+
polynomial_regression.statuses(200).coefficients.should == [334.5000000000001, 42.82142857142857]
|
202
|
+
polynomial_regression.statuses(200).formula.should == "334.5000000000001 + 42.82142857142857x^1"
|
203
|
+
polynomial_regression.statuses(200).formula(1).should == "42.82142857142857"
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should create paths with the default timebase" do
|
207
|
+
polynomial_regression.paths("/").x.size.should == 8
|
208
|
+
polynomial_regression.paths("/").y.size.should == 8
|
209
|
+
polynomial_regression.paths("/").derivation(0).size.should == 8
|
210
|
+
polynomial_regression.paths("/").derivation(1).size.should == 8
|
211
|
+
|
212
|
+
polynomial_regression.paths("/").degree.should == 1
|
213
|
+
polynomial_regression.paths("/").coefficients.should == [223.00000000000006, 28.571428571428566]
|
214
|
+
polynomial_regression.paths("/").formula.should == "223.00000000000006 + 28.571428571428566x^1"
|
215
|
+
polynomial_regression.paths("/").formula(1).should == "28.571428571428566"
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should create durations with a too small custom timebase" do
|
219
|
+
lambda{ polynomial_regression(:timebase => 1.minute).durations.x.size.should == 1 }.should raise_exception, "Regression is not possible for a single time value, choose a smaller timebase"
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should create durations with a too small custom timebase" do
|
223
|
+
polynomial_regression(:timebase => 4.seconds).durations.x.size.should == 2
|
224
|
+
polynomial_regression(:timebase => 4.seconds).durations.y.size.should == 2
|
225
|
+
polynomial_regression(:timebase => 4.seconds).durations.derivation(0).size.should == 2
|
226
|
+
polynomial_regression(:timebase => 4.seconds).durations.derivation(1).size.should == 2
|
227
|
+
polynomial_regression(:timebase => 4.seconds).durations.degree.should == 1
|
228
|
+
polynomial_regression(:timebase => 4.seconds).durations.coefficients.should == [1.2389749702026223, -0.07830132432187575]
|
229
|
+
polynomial_regression(:timebase => 4.seconds).durations.formula.should == "1.2389749702026223 + -0.07830132432187575x^1"
|
230
|
+
polynomial_regression(:timebase => 4.seconds).durations.formula(1).should == "-0.07830132432187575"
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
context "quadratic regression", :quadreg do
|
236
|
+
|
237
|
+
it "should create durations with the default timebase" do
|
238
|
+
polynomial_regression(:degree => 2).durations.x.size.should == 8
|
239
|
+
polynomial_regression(:degree => 2).durations.y.size.should == 8
|
240
|
+
polynomial_regression(:degree => 2).durations.derivation(0).size.should == 8
|
241
|
+
polynomial_regression(:degree => 2).durations.derivation(1).size.should == 8
|
242
|
+
polynomial_regression(:degree => 2).durations.degree.should == 2
|
243
|
+
polynomial_regression(:degree => 2).durations.coefficients.should == [1.1347571673566461, 0.04059849330278298, -0.005668036047256117]
|
244
|
+
polynomial_regression(:degree => 2).durations.formula.should == "1.1347571673566461 + 0.04059849330278298x^1 + -0.005668036047256117x^2"
|
245
|
+
polynomial_regression(:degree => 2).durations.formula(1).should == "0.04059849330278298 + 2*-0.005668036047256117x^1"
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
context "appearing", :appearing do
|
251
|
+
|
252
|
+
it "should list statuses" do
|
253
|
+
appearing.statuses.should == [200]
|
254
|
+
end
|
255
|
+
|
256
|
+
it "should list methods" do
|
257
|
+
appearing.methods.should == ["get", "post"]
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should list paths" do
|
261
|
+
appearing.paths.should == ["/", "/basic/auth"]
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
context "benchmark scope", :benchmark do
|
267
|
+
|
268
|
+
before(:each) do
|
269
|
+
BigBench.config.output = "spec/tests/sample_results_small.ljson"
|
270
|
+
BigBench.benchmark("index page" => "http://localhost:3001"){ get "/" }
|
271
|
+
BigBench.benchmark("logout page" => "http://localhost:3001"){ get "/" }
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should offer an iterator over the benchmarks and set the scope", :scope do
|
275
|
+
run_benchmarks = []
|
276
|
+
each_benchmark do |benchmark|
|
277
|
+
scope.should == benchmark.name
|
278
|
+
run_benchmarks << scope
|
279
|
+
end
|
280
|
+
|
281
|
+
run_benchmarks.should == ["index page", "logout page"]
|
282
|
+
end
|
283
|
+
|
284
|
+
|
285
|
+
it "should scope cluster" do
|
286
|
+
scope_to_benchmark("index page") do
|
287
|
+
cluster.requests.size.should == 8
|
288
|
+
end
|
289
|
+
|
290
|
+
scope_to_benchmark("logout page") do
|
291
|
+
cluster.requests.size.should == 8
|
292
|
+
end
|
293
|
+
|
294
|
+
lambda{ scope_to_benchmark("not existant"){}}.should raise_exception BigBench::PostProcessor::Environment::BenchmarkNotFound, "Could not find Benchmark: 'not existant'. Available benchmarks are: index page, logout page"
|
295
|
+
end
|
296
|
+
|
297
|
+
it "should scope statistics" do
|
298
|
+
scope_to_benchmark("index page") do
|
299
|
+
statistics.requests.min.should == 14
|
300
|
+
statistics.requests.mean.should == 470.75
|
301
|
+
statistics.requests.max.should == 577
|
302
|
+
statistics.requests.sd.should == 114.875
|
303
|
+
statistics.requests.variance.should == 31206.6875
|
304
|
+
end
|
305
|
+
|
306
|
+
scope_to_benchmark("logout page") do
|
307
|
+
statistics.requests.min.should == 5
|
308
|
+
statistics.requests.mean.should == 13.625
|
309
|
+
statistics.requests.max.should == 42
|
310
|
+
statistics.requests.sd.should == 7.28125
|
311
|
+
statistics.requests.variance.should == 127.234375
|
312
|
+
end
|
313
|
+
|
314
|
+
lambda{ scope_to_benchmark("not existant"){}}.should raise_exception BigBench::PostProcessor::Environment::BenchmarkNotFound, "Could not find Benchmark: 'not existant'. Available benchmarks are: index page, logout page"
|
315
|
+
end
|
316
|
+
|
317
|
+
it "should scope normal_distribution" do
|
318
|
+
scope_to_benchmark("index page") do
|
319
|
+
validate_normal_distribution(normal_distribution.requests).should be_true
|
320
|
+
validate_normal_distribution(normal_distribution.durations).should be_true
|
321
|
+
end
|
322
|
+
|
323
|
+
scope_to_benchmark("logout page") do
|
324
|
+
validate_normal_distribution(normal_distribution.requests).should be_true
|
325
|
+
validate_normal_distribution(normal_distribution.durations).should be_true
|
326
|
+
end
|
327
|
+
|
328
|
+
lambda{ scope_to_benchmark("not existant"){}}.should raise_exception BigBench::PostProcessor::Environment::BenchmarkNotFound, "Could not find Benchmark: 'not existant'. Available benchmarks are: index page, logout page"
|
329
|
+
end
|
330
|
+
|
331
|
+
|
332
|
+
it "should scope polynomial_regression", :benchmark_regression do
|
333
|
+
|
334
|
+
scope_to_benchmark("index page") do
|
335
|
+
polynomial_regression.durations.x.size.should == 8
|
336
|
+
polynomial_regression.durations.y.size.should == 8
|
337
|
+
polynomial_regression.durations.derivation(0).size.should == 8
|
338
|
+
polynomial_regression.durations.derivation(1).size.should == 8
|
339
|
+
polynomial_regression.durations.degree.should == 1
|
340
|
+
polynomial_regression.durations.coefficients.should == [1.1646812659828312, 0.0032629471307769192]
|
341
|
+
polynomial_regression.durations.formula.should == "1.1646812659828312 + 0.0032629471307769192x^1"
|
342
|
+
polynomial_regression.durations.formula(1).should == "0.0032629471307769192"
|
343
|
+
end
|
344
|
+
|
345
|
+
scope_to_benchmark("logout page") do
|
346
|
+
polynomial_regression.durations.x.size.should == 8
|
347
|
+
polynomial_regression.durations.y.size.should == 8
|
348
|
+
polynomial_regression.durations.derivation(0).size.should == 8
|
349
|
+
polynomial_regression.durations.derivation(1).size.should == 8
|
350
|
+
polynomial_regression.durations.degree.should == 1
|
351
|
+
polynomial_regression.durations.coefficients.should == [1.0714285714285718, -0.0012755102040815924]
|
352
|
+
polynomial_regression.durations.formula.should == "1.0714285714285718 + -0.0012755102040815924x^1"
|
353
|
+
polynomial_regression.durations.formula(1).should == "-0.0012755102040815924"
|
354
|
+
end
|
355
|
+
|
356
|
+
lambda{ scope_to_benchmark("not existant"){}}.should raise_exception BigBench::PostProcessor::Environment::BenchmarkNotFound, "Could not find Benchmark: 'not existant'. Available benchmarks are: index page, logout page"
|
357
|
+
end
|
358
|
+
|
359
|
+
end
|
360
|
+
|
361
|
+
context "inkonsistant test data", :inconsistant do
|
362
|
+
|
363
|
+
before(:each) do
|
364
|
+
BigBench.config.duration = 20.seconds
|
365
|
+
BigBench.config.output = "spec/tests/result.ljson"
|
366
|
+
end
|
367
|
+
|
368
|
+
it "should work with statistics" do
|
369
|
+
statistics.durations.min.should == 82
|
370
|
+
statistics(1.minute).durations.min.should == 82
|
371
|
+
statistics.requests.min.should == 0
|
372
|
+
statistics.methods(:get).min.should == 0
|
373
|
+
statistics.statuses(200).min.should == 0
|
374
|
+
statistics.paths("/").min.should == 0
|
375
|
+
|
376
|
+
statistics.methods(:get).max.should == 9
|
377
|
+
statistics.durations.mean.should == 310.3720930232558
|
378
|
+
statistics.durations.average.should == 310.3720930232558
|
379
|
+
statistics.durations.sd.should == 330.36776636019465
|
380
|
+
statistics.requests.sd.should == 2.2675736961451247
|
381
|
+
statistics.durations.variance.should == 157094.37317468924
|
382
|
+
statistics.requests.variance.should == 8.616780045351472
|
383
|
+
end
|
384
|
+
|
385
|
+
it "should work with normal_distribution" do
|
386
|
+
validate_normal_distribution(normal_distribution.durations).should be_true
|
387
|
+
normal_distribution.durations.formula.should == "1 / sqrt(2 * pi * 453.6664147140337) * e**( -0.5 * (x - 484.0502645502645)**2 / 453.6664147140337)"
|
388
|
+
end
|
389
|
+
|
390
|
+
it "should work with clusters" do
|
391
|
+
cluster.timesteps.should have(21).timesteps
|
392
|
+
cluster(1.second).should have(21).timesteps
|
393
|
+
cluster(1.minute).should have(1).timesteps
|
394
|
+
cluster.methods(:get).should have(21).entries
|
395
|
+
cluster.methods(:post).should have(21).entries
|
396
|
+
cluster.methods(:nothing).should have(21).entries
|
397
|
+
end
|
398
|
+
|
399
|
+
it "should work with a polynomial regression" do
|
400
|
+
polynomial_regression.durations.x.size.should == 21
|
401
|
+
polynomial_regression.durations.y.size.should == 21
|
402
|
+
polynomial_regression.durations.derivation(0).size.should == 21
|
403
|
+
polynomial_regression.durations.derivation(1).size.should == 21
|
404
|
+
polynomial_regression.durations.degree.should == 1
|
405
|
+
polynomial_regression.durations.coefficients.should == [695.226310726311, -21.117604617604627]
|
406
|
+
polynomial_regression.durations.formula.should == "695.226310726311 + -21.117604617604627x^1"
|
407
|
+
polynomial_regression.durations.formula(1).should == "-21.117604617604627"
|
408
|
+
end
|
409
|
+
|
410
|
+
end
|
411
|
+
|
412
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "../helpers"
|
2
|
+
require_relative "../../lib/bigbench/post_processor/graphs"
|
3
|
+
|
4
|
+
describe BigBench::PostProcessor::Graphs do
|
5
|
+
|
6
|
+
it "should run and create the following graphs" do
|
7
|
+
folder = "spec/tmp/graphs_#{Time.now.to_i}"
|
8
|
+
|
9
|
+
BigBench.config.duration = 2.minutes
|
10
|
+
BigBench.config.output = "spec/tests/sample_results_big.ljson"
|
11
|
+
BigBench.benchmark("index page" => "http://localhost:3001"){ get "/" }
|
12
|
+
BigBench.post_process :graphs, :folder => folder
|
13
|
+
|
14
|
+
BigBench.benchmarks.should have(1).benchmark
|
15
|
+
BigBench.post_processors.should have(1).processor
|
16
|
+
|
17
|
+
lambda{ BigBench.post_processors.first.run! }.should_not raise_exception
|
18
|
+
Dir["#{folder}/*.png"].size.should == 18
|
19
|
+
|
20
|
+
Dir["spec/tmp/*"].each{ |folder| FileUtils.rm_rf(folder) }
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -3,8 +3,9 @@ require_relative "../helpers"
|
|
3
3
|
describe BigBench::PostProcessor::Statistics do
|
4
4
|
|
5
5
|
it "should run and create the following statistics" do
|
6
|
-
|
7
|
-
BigBench.config.output = "spec/tests/
|
6
|
+
BigBench.config.duration = 2.minutes
|
7
|
+
BigBench.config.output = "spec/tests/sample_results_big.ljson"
|
8
|
+
BigBench.benchmark("index page" => "http://localhost:3001"){ get "/" }
|
8
9
|
BigBench.post_process :statistics
|
9
10
|
|
10
11
|
lambda{ BigBench.post_processors.first.run! }.should_not raise_exception
|