@@ -38,7 +38,7 @@ use Text::Levenshtein::XS;
38
38
39
39
my $mono_clock = $^O !~ / win/i || $Time::HiRes::VERSION >= 1.9764;
40
40
41
- our $VERSION = ' 2.8 ' ;
41
+ our $VERSION = ' 2.9 ' ;
42
42
our @EXPORT = qw( system_identity suite_run calc_scalability suite_calc) ;
43
43
our $datadir = dist_dir(" Benchmark-DKbench" );
44
44
@@ -139,34 +139,35 @@ options to control number of threads, iterations, which benchmarks to run etc:
139
139
dkbench [options]
140
140
141
141
Options:
142
- --threads <i>, -j <i> : Number of benchmark threads (default is 1).
143
- --multi, -m : Multi-threaded using all your CPU cores/threads.
144
- --max_threads <i> : Override the cpu detection to specify max cpu threads.
145
- --iter <i>, -i <i> : Number of suite iterations (with min/max/avg at the end).
146
- --stdev : Show relative standard deviation (for iter > 1).
147
- --include <regex> : Run only benchmarks that match regex.
148
- --exclude <regex> : Do not run benchmarks that match regex.
149
- --time, -t : Report time (sec) instead of score.
150
- --quick, -q : Quick benchmark run (implies -t).
151
- --no_mce : Do not run under MCE::Loop (implies -j 1).
152
- --scale <i>, -s <i> : Scale the bench workload by x times (incompatible with -q).
153
- --skip_bio : Skip BioPerl benchmarks.
154
- --skip_prove : Skip Moose prove benchmark.
155
- --time_piece : Run optional Time::Piece benchmark (see benchmark details).
156
- --bio_codons : Run optional BioPerl Codons benchmark (does not scale well).
157
- --sleep <i> : Sleep for <i> secs after each benchmark.
158
- --setup : Download the Genbank data to enable the BioPerl tests.
159
- --datapath <path> : Override the path where the expected benchmark data is found.
160
- --ver <num> : Skip benchmarks added after the specified version.
161
- --help -h : Show basic help and exit.
142
+ --threads <i>, -j <i> : Number of benchmark threads (default is 1).
143
+ --multi, -m : Multi-threaded using all your CPU cores/threads.
144
+ --max_threads <i> : Override the cpu detection to specify max cpu threads.
145
+ --iter <i>, -i <i> : Number of suite iterations (with min/max/avg at the end).
146
+ --stdev : Show relative standard deviation (for iter > 1).
147
+ --include <regex> : Run only benchmarks that match regex.
148
+ --exclude <regex> : Do not run benchmarks that match regex.
149
+ --time, -t : Report time (sec) instead of score.
150
+ --quick, -q : Quick benchmark run (implies -t).
151
+ --no_mce : Do not run under MCE::Loop (implies -j 1).
152
+ --scale <i>, -s <i> : Scale the bench workload by x times (incompatible with -q).
153
+ --skip_bio : Skip BioPerl benchmarks.
154
+ --skip_prove : Skip Moose prove benchmark.
155
+ --time_piece : Run optional Time::Piece benchmark (see benchmark details).
156
+ --bio_codons : Run optional BioPerl Codons benchmark (does not scale well).
157
+ --sleep <i> : Sleep for <i> secs after each benchmark.
158
+ --duration <i>, -d <i> : Minimum duration in seconds for suite run.
159
+ --setup : Download the Genbank data to enable the BioPerl tests.
160
+ --datapath <path> : Override the path where the expected benchmark data is found.
161
+ --ver <num> : Skip benchmarks added after the specified version.
162
+ --help -h : Show basic help and exit.
162
163
163
164
The default run (no options) will run all the benchmarks both single-threaded and
164
165
multi-threaded (using all detected CPU cores/hyperthreads) and show you scores and
165
166
multi vs single threaded scalability.
166
167
167
168
The scores are calibrated such that a reference CPU (Intel Xeon Platinum 8481C -
168
169
Sapphire Rapids) would achieve a score of 1000 in a single-core benchmark run using
169
- the default software configuration (Linux/Perl 5.36.0 built with multiplicity and
170
+ the default software configuration (Linux/Perl 5.36+ built with multiplicity and
170
171
threads, with reference CPAN module versions). Perl built without thread support and
171
172
multi(plicity) will be a bit faster (usually in the order of ~3-4%), while older Perl
172
173
versions will most likely be slower. Different CPAN module versions will also impact
@@ -570,9 +571,24 @@ sub suite_run {
570
571
chunk_size => 1,
571
572
} unless $opt -> {no_mce };
572
573
573
- foreach (1..$opt -> {iter }) {
574
- print " Iteration $_ of $opt ->{iter}...\n " if $opt -> {iter } > 1;
575
- run_iteration($opt , \%stats );
574
+ if ($opt -> {duration }) {
575
+ my $t0 = _get_time();
576
+ my $cnt = 0;
577
+ my $t = 0;
578
+ while ($t < $opt -> {duration }) {
579
+ $cnt ++;
580
+ print " Iteration $cnt (" .int ($t +0.5)." s of $opt ->{duration}s)...\n " ;
581
+ run_iteration($opt , \%stats );
582
+ $t = _get_time()-$t0 ;
583
+ }
584
+ $opt -> {iter } = $cnt ;
585
+ $stats {_opt }-> {iter } = $cnt ;
586
+ $opt -> {duration } = 0;
587
+ } else {
588
+ foreach (1..$opt -> {iter }) {
589
+ print " Iteration $_ of $opt ->{iter}...\n " if $opt -> {iter } > 1;
590
+ run_iteration($opt , \%stats );
591
+ }
576
592
}
577
593
578
594
total_stats($opt , \%stats ) if $opt -> {iter } > 1;
@@ -632,16 +648,20 @@ sub calc_scalability {
632
648
}
633
649
die " No bench times recorded" unless @perf ;
634
650
print ((" -" x 40 )." \n " );
635
- my $ avg1 = min_max_avg($stats1 -> {_total }-> {$display });
636
- my $ avg2 = min_max_avg($stats2 -> {_total }-> {$display });
651
+ my @ avg1 = min_max_avg($stats1 -> {_total }-> {$display });
652
+ my @ avg2 = min_max_avg($stats2 -> {_total }-> {$display });
637
653
print " DKbench summary ($cnt benchmark" ;
638
654
print " s" if $cnt > 1;
639
655
print " x$opt ->{scale} scale" if $opt -> {scale } > 1;
640
656
print " , $opt ->{iter} iterations" if $opt -> {iter } > 1;
641
657
print " , $opt2 ->{threads} threads):\n " ;
642
658
$opt -> {f } .= " s" if $opt -> {time };
643
- print pad_to(" Single:" ).sprintf ($opt -> {f }, $avg1 )." \n " ;
644
- print pad_to(" Multi:" ).sprintf ($opt -> {f }, $avg2 )." \n " ;
659
+ my $f = $opt -> {time } ? ' %.3f' : ' %.0f' ;
660
+ $f = $opt -> {iter } > 1 ? " $opt ->{f}\t ($f - $f )" : $opt -> {f };
661
+ @avg1 = $opt -> {iter } > 1 ? ($avg1 [2], $avg1 [0], $avg1 [1]) : ($avg1 [2]);
662
+ @avg2 = $opt -> {iter } > 1 ? ($avg2 [2], $avg2 [0], $avg2 [1]) : ($avg2 [2]);
663
+ print pad_to(" Single:" ).sprintf ($f , @avg1 )." \n " ;
664
+ print pad_to(" Multi:" ).sprintf ($f , @avg2 )." \n " ;
645
665
my @newperf = Benchmark::DKbench::drop_outliers(\@perf , -1);
646
666
my @newscal = Benchmark::DKbench::drop_outliers(\@scal , -1);
647
667
@perf = min_max_avg(\@newperf );
0 commit comments