Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xacobeo::timer(3pm) [debian man page]

Xacobeo::Timer(3pm)					User Contributed Perl Documentation				       Xacobeo::Timer(3pm)

NAME
Xacobeo::Timer - A custom made timer. SYNOPSIS
use Xacobeo::Timer; # As a one time use my $timer = Xacobeo::Timer->start("Long operation"); do_long_operation(); $timer->elapsed(); # Displays the time elapsed # A simple stop watch (the destructor displays the time elapsed) my $TIMER = Xacobeo::Timer->new("Method calls"); sub hotspot { $TIMER->start(); # Very slow stuff here $TIMER->stop(); } DESCRIPTION
This package provides a very simple timer. This timer is used for finding hot spots in the application. The timer is quite simple it provides the method "start" that starts the timer and the method "stop" that stops the timer and accumulates the elapsed time. The method "show" can be used to print the time elapsed so far while the method "elapsed" returns the time elapsed so far. When an instance of this class dies (because it was undefed or collected by the garbage collector) the builtin Perl desctrutor will automatically call the method "show". But if the method show or elapsed was called during the lifetime of the instance then the destructor will not invoke the method show. METHODS
The package defines the following methods: new Creates a new Timer. Parameters: o $name (Optional) The name of the timer. start Starts the timer. If this sub is called without a blessed instance then a new Timer will be created. Parameters: o $name (optional) The name is used only when called without a blessed instance. stop Stops the timer and adds accumulates the elapsed time. If the timer wasn't started previously this results in a no-op. show Prints the elapsed time. This method stops the timer if it was started previously and wasn't stopped. elapsed Returns the total time elapsed so far. If the timer was already started the pending time will not be taking into account. AUTHORS
Emmanuel Rodriguez <potyl@cpan.org>. COPYRIGHT AND LICENSE
Copyright (C) 2008,2009 by Emmanuel Rodriguez. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2011-11-16 Xacobeo::Timer(3pm)

Check Out this Related Man Page

Dancer::Timer(3pm)					User Contributed Perl Documentation					Dancer::Timer(3pm)

NAME
Dancer::Timer - a timer for Dancer SYNOPSIS
use Dancer::Timer; my $timer = Dancer::Timer->new(); my $time = $timer->tick; print "[$time]: Doing something "; # (time passes) $time = $timer->tick; print "[$time]: Doing something else "; # (time passes) $time = $timer->to_string; print "[$time]: Doing another thing "; DESCRIPTION
Dancer::Timer provides Dancer with a timing object to clock operations. For example, you might want a logging that shows you when each operation happened (at what time) to determine how long each operation was in order to know where to focus on for possible bugs or perhaps unnecessary slowness. Dancer uses Dancer::Timer in facilities that want to provide this for you. Any plugin author is more than welcome to use it as well. ATTRIBUTES
start_time Retains the starting time of the timer. The default value is when the object is created. It fetches that using "gettimeofday" from Time::HiRes. METHODS
init This method is called when "->new()" is called. It initializes the "start_time" attribute. tick Creates a tick in the timer and returns the interval between the "start_time" and now. to_string Same as "tick", just more expressive. AUTHOR
Alexis Sukrieh LICENSE AND COPYRIGHT
Copyright 2009-2010 Alexis Sukrieh. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. perl v5.14.2 2012-01-28 Dancer::Timer(3pm)
Man Page