NAME
Time::Stopwatch - Use tied scalars as timers
SYNOPSIS
use Time::Stopwatch;
tie my $timer, 'Time::Stopwatch';
do_something();
print "Did something in $timer seconds.\n";
$timer = 0;
do_something_else();
print "Did something else in $timer seconds.\n";
DESCRIPTION
The Time::Stopwatch
module provides a convenient interface to timing functions through tied scalars. From the point of view of the user, scalars tied to the module simply increase their value by one every second.
Using the module should mostly be obvious from the synopsis. You can provide an initial value for the timers either by assigning to them or by passing the value as a third argument to tie().
If you have the module Time::HiRes
installed, the timers created by Time::Stopwatch
will automatically count fractional seconds. Do not assume that the values of the timers are always integers. You may test the constant Time::Stopwatch::HIRES
to find out whether high resolution timing is enabled.
SEE ALSO
Time::HiRes
, tie()
AUTHORS
Copyright 2000-2001, Ilmari Karonen. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Address bug reports and comments to: perl@itz.pp.sci.fi