ePages 6.15.1 - DE_EPAGES/Core/API/Statistics.pm

Package DE_EPAGES::Core::API::Statistics

Provides an API for performance analysis

@EXPORT_OK
TakeStatistic
RunStatistic
WithStatistics
GetStatisticString

Functions

GetStatisticString
RunStatistic
TakeStatistic
WithStatistics

GetStatisticString

returns the statistic string of this module, adds the given vars to the message.

Syntax
$Message = GetStatisticString($hVars);
Example
$Message = GetStatisticString({'IP'=>'127.0.0.1'});
Input
$hStatistics (ref.hash)
statistic information
$Vars (ref.hash)
keys
Return
$Message (string)
statistic information

RunStatistic

Measure clock,user,system time for this function call and return Statistic String

Syntax
$Text = RunStatistic($Sub, $Vars);
Example
print RunStatistic(\&Main, { 'request'=>'uri' });
Input
$Sub (code)
function pointer
$Vars (ref.hash)
variables for statistic (uri)
Return
$Text (string)
statistics table

TakeStatistic

Measure clock,user,system time for this function call. Use RunStatistic to enable measurement.

Syntax
TakeStatistic($Key, $Sub);
Example
TakeStatistic('Addition', sub { my $test = 0; $test++; $test += 1221; });
Input
$Key (string)
statistic key
$Sub (code)
function pointer

WithStatistics

Measure clock,user,system time for this function call and enables TakeStatistic.

Syntax
$hStatistics = WithStatistics($Sub);
Example
print WithStatistic(\&Main, { 'request'=>'uri' });
Input
$Sub (code)
function pointer
Return
$hStatistics
(hash reference)
statistics table with format:
$key => [$Counter,$Totaltime,[$Usertime,$Systemtime]]