|
From: <sv...@va...> - 2005-12-15 17:22:40
|
Author: njn
Date: 2005-12-15 17:22:37 +0000 (Thu, 15 Dec 2005)
New Revision: 5348
Log:
Improvments to vg_perf:
- show percentage speedup over the first Valgrind when comparing multiple
Valgrind
- don't accept --reps < 0
- avoid div-by-zero if the runtime is measured as zero
Modified:
trunk/perf/vg_perf.in
Modified: trunk/perf/vg_perf.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/perf/vg_perf.in 2005-12-15 16:11:25 UTC (rev 5347)
+++ trunk/perf/vg_perf.in 2005-12-15 17:22:37 UTC (rev 5348)
@@ -153,6 +153,7 @@
$alldirs =3D 1;
} elsif ($arg =3D~ /^--reps=3D(\d+)$/) {
$n_reps =3D $1;
+ if ($n_reps < 1) { die "bad --reps value: $n_reps\n"; }
} elsif ($arg =3D~ /^--vg=3D(.+)$/) {
# Make dir absolute if not already
add_vgdir($1);
@@ -255,7 +256,8 @@
die "\n*** missing usertime in perf.stderr\n";
$tmin =3D $1 if ($1 < $tmin);
}
- return $tmin;
+ # Avoid divisions by zero!
+ return (0 =3D=3D $tmin ? 0.01 : $tmin);
}
=20
sub do_one_test($$)=20
@@ -263,6 +265,8 @@
my ($dir, $vgperf) =3D @_;
$vgperf =3D~ /^(.*)\.vgperf/;
my $name =3D $1;
+ my %first_tTool; # For doing percentage speedups when comparing
+ # multiple Valgrinds
=20
read_vgperf_file($vgperf);
=20
@@ -307,8 +311,20 @@
. "$vgopts ";
my $cmd =3D "$vgsetup $timecmd $vgcmd $prog $args";
my $tTool =3D time_prog($cmd, $n_reps);
- printf("%4.1fs (%4.1fx) ", $tTool, $tTool/$tNative);
+ printf("%4.1fs (%4.1fx,", $tTool, $tTool/$tNative);
=20
+ # If it's the first timing for this tool on this benchmark,
+ # record the time so we can get the percentage speedup of th=
e
+ # subsequent Valgrinds. Otherwise, compute and print
+ # the speedup.
+ if (not defined $first_tTool{$tool}) {
+ $first_tTool{$tool} =3D $tTool;
+ print(" -----) ");
+ } else {
+ my $speedup =3D 100 - (100 * $tTool / $first_tTool{$tool=
});
+ printf("%5.1f%%) ", $speedup);
+ }
+
$num_timings_done++;
=20
if (defined $cleanup) {
|