diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2016-04-10 16:43:46 -0600 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2016-06-15 11:52:08 +1000 |
commit | 60858fe86ce0e2182138f1006d72637ca0621048 (patch) | |
tree | a6fe9e6682a3974c5e1b38fa5c29ea521ea5defd /Porting/bench.pl | |
parent | 857716c91d72a6a564885f5d4ead75033c1840ee (diff) | |
download | perl-60858fe86ce0e2182138f1006d72637ca0621048.tar.gz |
provide per-PUT environment
This patch lets user specify ENVAR=value pairs for individual PUTs,
thereby altering runtime behavior. For some combination of module and
ENVAR, this should result in measurable benchmark differences.
This example benchmarks a PERL_MEM_LOG configured perl, 1st PUT with
PERL_MEM_LOG disabled, but enabled in the 2nd:
$ perl Porting/bench.pl --jobs=2 \
--verbose --debug --tests=/loop::for::pkg_/ \
-- \
perl5.23.9:+bare \
perl5.23.9=+full:PERL_MEM_LOG=3mst,PERLIO=:stdio -MData::Dumper
this will run:
Command: PERL_HASH_SEED=0 PERLIO=:stdio PERL_MEM_LOG=3mst valgrind --tool=cachegrind --branch-sim=yes --cachegrind-out-file=/dev/null perl5.23.9 -MData::Dumper - 20 2>&1
Note that ':' is now a valid separator between the perl & label, but
not between ENVAR=value pairs, where a ',' is required.
Diffstat (limited to 'Porting/bench.pl')
-rwxr-xr-x | Porting/bench.pl | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Porting/bench.pl b/Porting/bench.pl index 7bc1c3289d..924f9b1987 100755 --- a/Porting/bench.pl +++ b/Porting/bench.pl @@ -493,19 +493,23 @@ sub process_puts { for my $p (reverse @_) { push @putargs, $p and next if $p =~ /^-/; # not-perl, dont send to qx// - my ($perl, $label) = split /=/, $p, 2; + my ($perl, $label, $env) = split /[=:,]/, $p, 3; $label //= $perl; $label = $perl.$label if $label =~ /^\+/; die "$label cannot be used on 2 different PUTs\n" if $seen{$label}++; + my %env; + if ($env) { + %env = split /[=,]/, $env; + } my $r = qx($perl -e 'print qq(ok\n)' 2>&1); if ($r eq "ok\n") { - push @res_puts, [ $perl, $label, reverse @putargs ]; + push @res_puts, [ $perl, $label, \%env, reverse @putargs ]; @putargs = (); warn "Added Perl-Under-Test: [ @{[@{$res_puts[-1]}]} ]\n" if $OPTS{verbose}; } else { - warn "putargs: @putargs + $p, a not-perl: $r\n" + warn "PUT-args: @putargs + a not-perl: $p $r\n" if $OPTS{verbose}; push @putargs, $p; # not-perl } @@ -725,14 +729,18 @@ sub grind_run { ); for my $p (@$perls) { - my ($perl, $label, @putargs) = @$p; + my ($perl, $label, $env, @putargs) = @$p; # Run both the empty loop and the active loop # $counts->[0] and $counts->[1] times. for my $i (0,1) { for my $j (0,1) { - my $cmd = "PERL_HASH_SEED=0 " + my $envstr = ''; + if (ref $env) { + $envstr .= "$_=$env->{$_} " for sort keys %$env; + } + my $cmd = "PERL_HASH_SEED=0 $envstr" . "valgrind --tool=cachegrind --branch-sim=yes " . "--cachegrind-out-file=/dev/null " . "$OPTS{grindargs} " |