Introduction
Performance testing class.
Discussion
The PerfEngine class contains the bulk of the performance
testing code.
To use the PerfEngine class, you first create a new instance
like this:
my $global_perf = HeaderDoc::PerfEngine->new();
You then periodically call the checkpoint method,
alternating the argument between 1 (creating a new checkpoint)
and 0 (closing the checkpoint). For example:
$global_perf->checkpoint(1);
Each PerfEngine instance can handle nested checkpoints
or consecutive checkpoints. Checkpoints may not, however,
overlap (e.g. start #1, start #2, end #1, end #2).
After you have finished executing the code you want to profile,
call printstats like this:
$global_perf->printstats();
It then prints statistics about each of the checkpoint
ranges, telling how long it took to execute each one.
Member Functions
- _initialize
Initializes an instance of a PerfEngine object.
- addCheckpoint
Creates a new checkpoint and adds it to the stack.
- checkpoint
Opens and closes checkpoints.
- matchCheckpoint
Pops a checkpoint from the stack and computes
the elapsed time.
- new
Creates a new PerfEngine object.
- printSeparator
Prints a separator line.
- printstats
Prints accumulated statistics.
Initializes an instance of a PerfEngine object.
Parameters
-
self
The object to initialize.
Creates a new checkpoint and adds it to the stack.
Parameters
-
self
The PerfEngine object.
-
bt
A backtrace taken at the start of this checkpoint.
Used to distinguish different checkpoints.
Discussion
This function is called by checkpoint and
should generally not be called directly.
Opens and closes checkpoints.
Parameters
-
self
The PerfEngine object.
-
entering
-
Pass 1 when you enter a range that you want to time.
Pass 0 when you reach the end of that range.
Pops a checkpoint from the stack and computes
the elapsed time.
Parameters
-
self
The PerfEngine object.
-
bt
The backtrace taken at the start of this checkpoint.
Used to distinguish different checkpoints.
Discussion
This function is called by checkpoint and
should generally not be called directly.
Creates a new PerfEngine object.
Parameters
-
param
A reference to the relevant package object (e.g.
HeaderDoc::PerfEngine->new() to allocate
a new instance of this class).
Prints a separator line.
Prints accumulated statistics.
Parameters
-
self
The PerfEngine object.
Member Data
- COMPLETE
An array of points that have been started and ended.
- HeaderDoc::PerfEngine::VERSION
The revision control revision number for this module.
- PENDING
An array of points that have been started but have not been
ended.
An array of points that have been started and ended.
The revision control revision number for this module.
$HeaderDoc::PerfEngine::VERSION = '$Revision: 1310076910 $';
Discussion
In the git repository, contains the number of seconds since
January 1, 1970.
An array of points that have been started but have not been
ended.
Last Updated: Saturday, August 06, 2016
|