@@ -3,12 +3,13 @@ package Benchmark::DKbench;
3
3
use strict;
4
4
use warnings;
5
5
6
+ use Config;
6
7
use Digest;
7
8
use Digest::MD5 qw( md5_hex) ;
8
9
use Encode;
9
10
use File::Spec::Functions;
10
11
use List::Util qw( min max sum) ;
11
- use Time::HiRes qw( clock_gettime CLOCK_MONOTONIC) ;
12
+ use Time::HiRes qw( CLOCK_MONOTONIC) ;
12
13
use Time::Piece;
13
14
14
15
use Astro::Coord::Constellations ' constellation_for_eq' ;
@@ -35,10 +36,11 @@ use Text::Levenshtein::Damerau::XS;
35
36
use Text::Levenshtein::XS;
36
37
37
38
use Exporter ' import' ;
38
- our @EXPORT = qw( system_identity suite_run calc_scalability) ;
39
- our $datadir = dist_dir(" Benchmark-DKbench" );
39
+ our @EXPORT = qw( system_identity suite_run calc_scalability) ;
40
+ our $datadir = dist_dir(" Benchmark-DKbench" );
41
+ my $mono_clock = $^O !~ / win/i || $Time::HiRes::VERSION >= 1.9764;
40
42
41
- our $VERSION = ' 2.2 ' ;
43
+ our $VERSION = ' 2.3 ' ;
42
44
43
45
=head1 NAME
44
46
@@ -70,6 +72,12 @@ scenario.
70
72
71
73
=head1 INSTALLATION
72
74
75
+ See the L</"setup_dkbench"> script below for more on the installation of a couple
76
+ of optional benchmarks and standardizing your benchmarking environment, otherwise
77
+ here are some general guidelines for verious systems.
78
+
79
+ =head2 Linux / WSL etc
80
+
73
81
The only non-CPAN software required to install/run the suite is a build environment
74
82
for the C/XS modules (C compiler, make etc.) and Perl. On the most popular Linux
75
83
package managers you can easily set up such an environment (as root or with sudo):
@@ -87,8 +95,34 @@ root/sudo is the easiest, will install for all users):
87
95
88
96
cpanm -n Benchmark::DKbench
89
97
90
- See the C<setup_dkbench > script below for more on the installation of a couple of
91
- optional benchmarks and standardizing your benchmarking environment.
98
+ =head2 Solaris
99
+
100
+ You will need to install the Oracle Solaris Studio development package to have a
101
+ compiler environment, and to add its C<bin > directory to your PATH, before installing
102
+ the benchmark suite.
103
+
104
+ =head2 Strawberry Perl
105
+
106
+ If you are on Windows, you should be using the Windows Subsystem for Linux (WSL)
107
+ for running Perl or, if you can't (e.g. old Windows verions), cygwin instead.
108
+ The suite should still work on Strawberry Perl, as long as you don't try to run
109
+ tests when installing (some dependencies will not pass them). The simplest way is
110
+ with L<App::cpanminus> (most Strawberry Perl verions have it installed):
111
+
112
+ cpanm -n Benchmark::DKbench
113
+
114
+ otherwise with the base CPAN shell:
115
+
116
+ perl -MCPAN -e shell
117
+
118
+ > notest install Benchmark::DKbench
119
+
120
+ and then note that the scripts get the batch extension appended, so C<dkbench.bat >
121
+ runs the suite (and C<setup_dkbench.bat > can assist with module versions, optional
122
+ benchmarks etc.).
123
+
124
+ Be aware that Strawberry Perl is slower, on my test system I get almost 50% slower
125
+ performance than WSL and 30% slower than cygwin.
92
126
93
127
=head1 SCRIPTS
94
128
@@ -130,7 +164,8 @@ multi vs single threaded scalability.
130
164
131
165
The scores are calibrated such that a reference CPU (Intel Xeon Platinum 8481C -
132
166
Sapphire Rapids) would achieve a score of 1000 in a single-core benchmark run using
133
- the default software configuration (Linux/Perl 5.36.0 with reference CPAN modules).
167
+ the default software configuration (Linux/Perl 5.36.0 built with multiplicity and
168
+ threads, with reference CPAN module versions).
134
169
135
170
The multi-thread scalability should approach 100% if each thread runs on a full core
136
171
(i.e. no SMT), and the core can maintain the clock speed it had on the single-thread
@@ -148,7 +183,7 @@ there is an option to disable it, which forces a single-thread run.
148
183
Simple installer to check/get the reference versions of CPAN modules and download
149
184
the Genbank data file required for the BioPerl benchmarks of the DKbench suite.
150
185
151
- It assumes that you have some software already installed (see INSTALLATION above),
186
+ It assumes that you have some software already installed (see L</" INSTALLATION"> above),
152
187
try C<setup_dkbench --help > will give you more details.
153
188
154
189
setup_dkbench [--force --sudo --test --data=s --help]
@@ -368,7 +403,9 @@ sub system_identity {
368
403
my $arch = System::CPU::get_arch || ' ' ;
369
404
$arch = " ($arch )" if $arch ;
370
405
print " --------------- Software ---------------\n DKbench v$VERSION \n " ;
371
- print " Perl $^V\n " ;
406
+ printf " Perl $^V (%sthreads , %smulti )\n " ,
407
+ $Config {usethreads } ? ' ' : ' no ' ,
408
+ $Config {usemultiplicity } ? ' ' : ' no ' ,;
372
409
print " OS: $osn \n --------------- Hardware ---------------\n " ;
373
410
print " CPU type: $model$arch \n " ;
374
411
print " CPUs: $ncpu " ;
@@ -507,9 +544,9 @@ sub bench_run {
507
544
my ($benchmark , $srand ) = @_ ;
508
545
$srand //= 1;
509
546
srand ($srand ); # For repeatability
510
- my $t0 = clock_gettime(CLOCK_MONOTONIC );
547
+ my $t0 = _get_time( );
511
548
my $out = $benchmark -> [2]-> ($benchmark -> [3]);
512
- my $time = sprintf (" %.3f" , clock_gettime(CLOCK_MONOTONIC )-$t0 );
549
+ my $time = sprintf (" %.3f" , _get_time( )-$t0 );
513
550
my $r = $out eq $benchmark -> [0] ? ' Pass' : " Fail ($out )" ;
514
551
return $time , $r ;
515
552
}
@@ -1218,6 +1255,10 @@ sub _decode_jwt2 {
1218
1255
return $payload ;
1219
1256
}
1220
1257
1258
+ sub _get_time {
1259
+ return $mono_clock ? Time::HiRes::clock_gettime(CLOCK_MONOTONIC) : Time::HiRes::time ();
1260
+ }
1261
+
1221
1262
# Helper package for Moose benchmark
1222
1263
1223
1264
{
0 commit comments