PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PProfiling::TimeScope Class Reference

This class, along with the PPROFILE_TIMESCOPE() macro, allows the measurement of the time used by a section of code delimited by the scope (block till the close brace) with minimum, maximum and averages displayed as a PTRACE(). More...

#include <object.h>

Classes

class  Measure
 Class used by PPROFILE_TIMESCOPE() macro to do the measurement of time between construction and destruction. More...
 

Public Member Functions

 TimeScope (const PDebugLocation &location, unsigned thresholdTime, unsigned throttleTime=10000, unsigned throttledLogLevel=2, unsigned unthrottledLogLevel=6, unsigned thresholdPercent=5, unsigned maxHistory=0)
 Create a TimeScope instance. More...
 
 TimeScope (const TimeScope &other)
 
 ~TimeScope ()
 Destroy scope timer. More...
 
void SetThrottleTime (unsigned throttleTime)
 Set time between PTRACE output in milliseconds. More...
 
void SetThrottledLogLevel (unsigned throttledLogLevel)
 Set PTRACE level to use if enough samples are above thresholdTime. More...
 
void SetUnthrottledLogLevel (unsigned unthrottledLogLevel)
 Set PTRACE level to use otherwise. More...
 
void SetThresholdPercent (unsigned thresholdPercent)
 Set Percentage of samples above thresholdTime to trigger throttledLogLevel. More...
 
void SetMaxHistory (unsigned maxHistory)
 Set optional number of samples above thresholdTime to display sincle last PTRACE() More...
 
void EndMeasurement (const void *context, const PObject *object, const PDebugLocation *location, uint64_t startTime)
 End and process a measurement period. More...
 
const PTimeIntervalGetLastDuration () const
 

Protected Attributes

Implementation *const m_implementation
 

Detailed Description

This class, along with the PPROFILE_TIMESCOPE() macro, allows the measurement of the time used by a section of code delimited by the scope (block till the close brace) with minimum, maximum and averages displayed as a PTRACE().

Constructor & Destructor Documentation

PProfiling::TimeScope::TimeScope ( const PDebugLocation location,
unsigned  thresholdTime,
unsigned  throttleTime = 10000,
unsigned  throttledLogLevel = 2,
unsigned  unthrottledLogLevel = 6,
unsigned  thresholdPercent = 5,
unsigned  maxHistory = 0 
)

Create a TimeScope instance.

This is usually created as a static variable by the PPROFILE_TIMESCOPE() macro.

Parameters
locationSource location, typically from macro P_DEBUG_LOCATION
thresholdTimeThreshold time in milliseconds
throttleTimeTime between PTRACE output in milliseconds
throttledLogLevelPTRACE level to use if enough samples are above thresholdTime
unthrottledLogLevelPTRACE level to use otherwise
thresholdPercentPercentage of samples above thresholdTime to trigger throttledLogLevel
maxHistoryOptional number of samples above thresholdTime to display sincle last PTRACE()
PProfiling::TimeScope::TimeScope ( const TimeScope other)
PProfiling::TimeScope::~TimeScope ( )

Destroy scope timer.

Member Function Documentation

void PProfiling::TimeScope::EndMeasurement ( const void *  context,
const PObject object,
const PDebugLocation location,
uint64_t  startTime 
)

End and process a measurement period.

const PTimeInterval& PProfiling::TimeScope::GetLastDuration ( ) const
void PProfiling::TimeScope::SetMaxHistory ( unsigned  maxHistory)

Set optional number of samples above thresholdTime to display sincle last PTRACE()

void PProfiling::TimeScope::SetThresholdPercent ( unsigned  thresholdPercent)

Set Percentage of samples above thresholdTime to trigger throttledLogLevel.

void PProfiling::TimeScope::SetThrottledLogLevel ( unsigned  throttledLogLevel)

Set PTRACE level to use if enough samples are above thresholdTime.

void PProfiling::TimeScope::SetThrottleTime ( unsigned  throttleTime)

Set time between PTRACE output in milliseconds.

void PProfiling::TimeScope::SetUnthrottledLogLevel ( unsigned  unthrottledLogLevel)

Set PTRACE level to use otherwise.

Member Data Documentation

Implementation* const PProfiling::TimeScope::m_implementation
protected

The documentation for this class was generated from the following file: