This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Improve Benchmark.t countit() tests
authorDavid Mitchell <davem@iabyn.com>
Sat, 26 Mar 2011 14:32:28 +0000 (14:32 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 26 Mar 2011 14:50:09 +0000 (14:50 +0000)
commitd684718b8f06cdaebffc6acc7b403facba41d49e
tree9e2cfedca7a55dea8c1900479dcbcdcc4afeff92
parenta27ff1be2567c0c790cb0164b86f0ed0ee47cf37
Improve Benchmark.t countit() tests

The test currently does a 3 sec run, then a 1 sec run, and
checks that the count from the first run is approximately three times
greater than that from the second run.

However, the countit() function doesn't guarantee that it will run for
exactly n seconds, so as well as returning how many iterations it did,
it also returns how much actual CPU time was used.

Make the test use that returned time value to scale the iteration counts
accordingly, before trying to compare them.

Hopefully this will reduce the number of spurious failed test 13's in
smokes (although after this commit it's now test 15).
lib/Benchmark.t