8.25. BenchmarkProvides routines for timing the execution of your code and formatting the results. Inherits only from the Exporter class. It has the following functions.
new Benchmark Returns the current time. By getting the current time before and after running the code, you can calculate the time it takes the code to run.
clearallcache Clears the entire cache. Exported on request.
clearcache (count) Clears the cached time for count rounds of the null loop. Exported on request.
Benchmark->debug(flag) Enables or disables debugging by setting the $Benchmark::Debug flag.
disablecache Disables use of the cache. Exported on request.
enablecache Resumes caching. Exported on request.
timediff (t1, t2) Calculates the difference between two times and returns the difference as a Benchmark object suitable for passing to timestr. Always exported.
timeit (count, code) Runs code and reports the time it took. Always exported. Takes the following arguments:
timestr (timediff[, style[, format]]) Converts times to printable strings. Always exported. Takes the following arguments:
timethese (count, \%codehashref[, style]) Times each of several pieces of code and reports the results separately. Always exported. Takes the following arguments:
timethis (count, code[, title[, style]]) Runs a chunk of code several times. Always exported. Takes the following arguments:
Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|