Benchmark

Provides routines for timing the execution of your code and formatting the results. Inherits only from the Exporter class. It has the following functions.

new

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

clearallcache 

Clears the entire cache. Exported on request.

clearcache

clearcache (count) 

Clears the cached time for count rounds of the null loop. Exported on request.

debug

Benchmark->debug(flag) 

Enables or disables debugging by setting the $Benchmark::Debug flag.

disablecache

disablecache 

Disables use of the cache. Exported on request.

enablecache

enablecache 

Resumes caching. Exported on request.

timediff

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

timeit (count, code) 

Runs code and reports the time it took. Always exported. Takes the following arguments:

timestr

timestr (timediff[, style[, format]]) 

Converts times to printable strings. Always exported. Takes the following arguments:

timethese

timethese (count, \%codehashref[, style]) 

Times each of several pieces of code and reports the results separately. Always exported. Takes the following arguments:

timethis

timethis (count, code[, title[, style]]) 

Runs a chunk of code several times. Always exported. Takes the following arguments: