In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/0d66b88d99cbe219f6c39408ee83f70759b609b3?hp=6e59d93aee950461947904b4f24a7f52c6c85f58>
- Log ----------------------------------------------------------------- commit 0d66b88d99cbe219f6c39408ee83f70759b609b3 Author: David Mitchell <[email protected]> Date: Wed Jun 15 16:17:01 2011 +0100 Benchmark.t: ignore sys CPU time Currently we work out the CPU burned by a loop by summing user and sys CPU. On the grounds that the burning we're interested in should have all been carried out with user CPU and that therefore any sys CPU is a red herring, ignore sys CPU for the infamous test 15. Yes, this is clutching at straws. Still, diagnostics output may show in future whether I was right! M lib/Benchmark.t commit 58747404ef23d45dec1e39238612403d2ffe64d9 Author: David Mitchell <[email protected]> Date: Wed Jun 15 16:12:16 2011 +0100 Benchmark.t: fix count estimate Commit bb6c6e4b8d10f2e460a7fe48e677d3d998a7f77d, which added improved diagnostics, also broke the count estimate. M lib/Benchmark.t ----------------------------------------------------------------------- Summary of changes: lib/Benchmark.t | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Benchmark.t b/lib/Benchmark.t index fdf2d03..004092e 100644 --- a/lib/Benchmark.t +++ b/lib/Benchmark.t @@ -63,13 +63,14 @@ isnt ($baz, 0, "benchmarked code was run"); my $in_threesecs = $threesecs->iters; print "# in_threesecs=$in_threesecs iterations\n"; ok ($in_threesecs > 0, "iters returned positive iterations"); -my $cpu3 = $threesecs->[1] + $threesecs->[2]; # user + sys -cmp_ok($cpu3, '>=', 3.0, "3s cpu3 is at least 3s"); +my $cpu3 = $threesecs->[1]; # user +my $sys3 = $threesecs->[2]; # sys +cmp_ok($cpu3+$sys3, '>=', 3.0, "3s cpu3 is at least 3s"); my $in_threesecs_adj = $in_threesecs; $in_threesecs_adj *= (3/$cpu3); # adjust because may not have run for exactly 3s print "# in_threesecs_adj=$in_threesecs_adj adjusted iterations\n"; -my $estimate = int (100 * $in_threesecs / 3) / 100; +my $estimate = int (100 * $in_threesecs_adj / 3) / 100; print "# from the 3 second run estimate $estimate iterations in 1 second...\n"; $baz = 0; my $onesec = countit(1, $coderef); @@ -78,8 +79,9 @@ isnt ($baz, 0, "benchmarked code was run"); my $in_onesec = $onesec->iters; print "# in_onesec=$in_onesec iterations\n"; ok ($in_onesec > 0, "iters returned positive iterations"); -my $cpu1 = $onesec->[1] + $onesec->[2]; # user + sys -cmp_ok($cpu1, '>=', 1.0, "is cpu1 is at least 1s"); +my $cpu1 = $onesec->[1]; # user +my $sys1 = $onesec->[2]; # sys +cmp_ok($cpu1+$sys1, '>=', 1.0, "is cpu1 is at least 1s"); my $in_onesec_adj = $in_onesec; $in_onesec_adj *= (1/$cpu1); # adjust because may not have run for exactly 1s print "# in_onesec_adj=$in_onesec_adj adjusted iterations\n"; @@ -92,10 +94,12 @@ print "# in_onesec_adj=$in_onesec_adj adjusted iterations\n"; diag(" in_threesecs = $in_threesecs"); diag(" in_threesecs_adj = $in_threesecs_adj"); diag(" cpu3 = $cpu3"); + diag(" sys3 = $sys3"); diag(" estimate = $estimate"); diag(" in_onesec = $in_onesec"); diag(" in_onesec_adj = $in_onesec_adj"); diag(" cpu1 = $cpu1"); + diag(" sys1 = $sys1"); }; } -- Perl5 Master Repository
