Returns the current time. Example:
use Benchmark;
- $t0 = new Benchmark;
+ $t0 = Benchmark->new;
# ... your code here ...
- $t1 = new Benchmark;
+ $t1 = Benchmark->new;
$td = timediff($t1, $t0);
print "the code took:",timestr($td),"\n";
Enables or disable debugging by setting the C<$Benchmark::Debug> flag:
- debug Benchmark 1;
+ Benchmark->debug(1);
$t = timeit(10, ' 5 ** $Global ');
- debug Benchmark 0;
+ Benchmark->debug(0);
=item iters
the C<timethese()> result structure. If you want that, just use the two
statement C<timethese>...C<cmpthese> idiom shown above.
-Incidently, note the variance in the result values between the two examples;
+Incidentally, note the variance in the result values between the two examples;
this is typical of benchmarking. If this were a real benchmark, you would
probably want to run a lot more iterations.
enablecache();
Caching is off by default, as it can (usually slightly) decrease
-accuracy and does not usually noticably affect runtimes.
+accuracy and does not usually noticeably affect runtimes.
=head1 EXAMPLES
=head1 SEE ALSO
-L<Devel::DProf> - a Perl code profiler
+L<Devel::NYTProf> - a Perl code profiler
=head1 AUTHORS
clearcache clearallcache disablecache enablecache);
%EXPORT_TAGS=( all => [ @EXPORT, @EXPORT_OK ] ) ;
-$VERSION = 1.10;
+$VERSION = 1.15;
# --- ':hireswallclock' special handling
# The 5% fudge is to keep us from iterating again all
# that often (this speeds overall responsiveness when $tmax is big
# and we guess a little low). This does not noticably affect
- # accuracy since we're not couting these times.
+ # accuracy since we're not counting these times.
$n = int( $tpra * 1.05 * $n / $tc ); # Linear approximation.
my $td = timeit($n, $code);
my $new_tc = $td->[1] + $td->[2];