@@ -30,7 +30,7 @@ scenario - even allowing you to add your own custom benchmarks.
30
30
31
31
See the [ "setup\_ dkbench"] ( #setup_dkbench ) script below for more on the installation of a couple
32
32
of optional benchmarks and standardizing your benchmarking environment, otherwise
33
- here are some general guidelines for verious systems.
33
+ here are some general guidelines for various systems.
34
34
35
35
## Linux / WSL etc
36
36
@@ -60,7 +60,7 @@ the benchmark suite.
60
60
## Strawberry Perl
61
61
62
62
If you are on Windows, you should be using the Windows Subsystem for Linux (WSL)
63
- for running Perl or, if you can't (e.g. old Windows verions ), cygwin instead.
63
+ for running Perl or, if you can't (e.g. old Windows versions ), cygwin instead.
64
64
The suite should still work on Strawberry Perl, as long as you don't try to run
65
65
tests when installing (some dependencies will not pass them). The simplest way is
66
66
with [ App::cpanminus] ( https://metacpan.org/pod/App%3A%3Acpanminus ) (most Strawberry Perl verions have it installed):
@@ -239,7 +239,7 @@ exported functions that the `dkbench` script uses for reference:
239
239
240
240
my $cores = system_identity();
241
241
242
- Prints out software/hardware configuration and returns then number of cores detected.
242
+ Prints out software/hardware configuration and returns the number of cores detected.
243
243
244
244
## ` suite_run `
245
245
@@ -254,14 +254,17 @@ The options of the `dkbench` script (in their long form) are accepted, except
254
254
In addition, ` %options ` may contain the key ` %extra_bench ` , with a hashref value
255
255
containing custom benchmarks in the following format:
256
256
257
- extra_bench => { bench_name => [$exp_output , $ref_time , $coderef , $quick_arg, $normal_arg] ... }
257
+ extra_bench => { bench_name => [$coderef , $exp_output , $ref_time , $quick_arg, $normal_arg], ... }
258
258
259
259
Where ` bench_name ` is a unique name for each benchmark and the arrayref assigned
260
- to it contains: The expected output (string) for the test to be considered a pass,
261
- the reference time in seconds for a score of 1000, a reference to the actual bench
262
- function, an argument (workload scaling) to pass to the function for the ` quick `
263
- bench run and an argument to pass for the normal run. For more info with an example
264
- see the [ "CUSTOM BENCHMARKS"] ( #custom-benchmarks ) section.
260
+ to it contains: A reference to the benchmarking code, the expected output (string)
261
+ for the test to be considered a pass, the reference time in seconds for a score of
262
+ 1000, an argument (workload scaling) to pass to the function for the ` quick ` bench
263
+ run and an argument to pass for the normal run. If the second argument is undef,
264
+ a "Pass" is always recorded, if the third argument is not defined and non-zero,
265
+ ` time ` will be implied.
266
+
267
+ For more info with an example see the [ "CUSTOM BENCHMARKS"] ( #custom-benchmarks ) section.
265
268
266
269
## ` calc_scalability `
267
270
@@ -275,7 +278,7 @@ results of a multi-threaded run, will calculate and print the multi-thread scala
275
278
Version 2.5 introduced the ability to add custom benchmarks to be run along any
276
279
of the included ones of the suite. This allows you to create a suite that is more
277
280
relevant to you, by including the actual code you will be running on the systems
278
- you are benchmarking. Remember, the best benchmark is your own code.
281
+ you are benchmarking.
279
282
280
283
Here is an example of adding a benchmark to the test suite and running it together
281
284
with the default benchmarks:
@@ -291,22 +294,31 @@ with the default benchmarks:
291
294
great_circle_bearing(rand(pi), rand(2 * pi), rand(pi), rand(2 * pi)) +
292
295
great_circle_direction(rand(pi), rand(2 * pi), rand(pi), rand(2 * pi))
293
296
for 1 .. $iter;
294
- return $dist;
297
+ return $dist; # Returning something is optional, but is used to Fail bench on no match
295
298
}
296
299
297
300
my %stats = suite_run({
298
301
extra_bench => { 'Math::Trig' => # A unique name for the benchmark
299
302
[
300
- '3144042.81433949', # The output for your reference Perl - determines Pass/Fail
301
- 5.5, # Seconds to complete in normal mode for score = 1000
302
303
\&great_circle, # Reference to bench function
303
- 400000, # Argument to pass for --quick mode (if needed)
304
- 2000000 # Argument to pass for normal mode (if needed)
304
+ '3144042.81433949', # Output for your reference Perl - determines Pass/Fail (optional)
305
+ 5.5, # Seconds to complete in normal mode for score = 1000 (optional)
306
+ 400000, # Argument to pass for --quick mode (optional)
307
+ 2000000 # Argument to pass for normal mode (optional)
305
308
]},
306
309
}
307
310
);
308
311
309
- You can pass the ` include ` option to run only the custom benchmark(s).
312
+ You can use a prefix for the naming of your custom benchmarks and make use of the
313
+ ` include ` argument to run only the custom benchmarks. Here is an example, where
314
+ a custom test is defined inline, without any of the optional arguments and specified
315
+ to run by itself:
316
+
317
+ my %stats = suite_run({
318
+ include => 'custom',
319
+ extra_bench => { custom1 => [sub {split //, 'x'x$_ for 1..10000}] }
320
+ }
321
+ );
310
322
311
323
# NOTES
312
324
@@ -319,9 +331,9 @@ on the servers I was testing, in order to choose the optimal types for the compa
319
331
I was working for. The second version has expanded a bit over that, and is friendlier
320
332
to use.
321
333
322
- Althought this benchmark is in general a good indicator of general CPU performance
334
+ Although this benchmark is in general a good indicator of general CPU performance
323
335
and can be customized to your needs, no benchmark is as good as running your own
324
- actual workload.
336
+ actual workload (which can be done via the [ "CUSTOM BENCHMARKS" ] ( #custom-benchmarks ) functionality) .
325
337
326
338
## SCORES
327
339
0 commit comments