The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Benchmark::Timer::Class - Perl module for timing the execution of methods in a specified object


  use Benchmark::Timer::Class;
  use The_Real_Module;
  $obj = new The_Real_Module();
  $th  = new Benchmark::Timer::Class($obj);


The Benchmark::Timer::Class enables you to determine elapsed times for calls to methods of a specified object during normal running of your program with minimal amount of editing.


$th = Benchmark::Timer::Class->new($original_object);

Takes an object reference and returns a reference to a Benchmark::Timer::Class object


Outputs a timing report to STDERR


Returns the mean time for all calls to method $methodname.


Returns the timing data as a hash keyed on object method names.

$th->data($methodname), $th->data;

When called with an $methodname returns the raw timing data as an array. When called with no arguments returns the raw timing data as hash keyed on object method names, where the values of the hash are lists of timings for calls to that object method.


D. Neil, <>


Time::HiRes, Benchmark::Timer


Copyright(c) 2001 Doug Neil.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.