Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Private Attributes
icl_core::perf_mon::PerformanceMonitor Class Reference

The PerformanceMonitor class provides an easy to use tool for performance measurement. More...

#include <PerformanceMonitor.h>

List of all members.

Static Public Member Functions

static void addData (std::string name, double data, std::string prefix)
 addData Manually insert a time measurement with given identifier
static void addNonTimeData (std::string name, double data, std::string prefix)
 addNonTimeData Adds some additional arbitrary information. In contrast to addStaticData multiple values (measurements) can be passed to the same identifier. However, right now they are output as if they were time measurements.
static void addStaticData (std::string name, double data, std::string prefix)
 addStaticData Adds static information. You can basically put any information that can be cast into a double in here.
static void disablePrefix (std::string prefix)
 disablePrefix Disables a given prefix
static void enableAll (const bool &enabled)
 enableAll set whether all prefixes should be enabled or not. Overrides single enable/disable assignments.
static void enablePrefix (std::string prefix)
 enablePrefix Enables a given prefix
static PerformanceMonitorgetInstance ()
 getInstance As The Performance Monitor is implemented as a singleton pattern, this provides an accessor to the PM instance. If there's no instance, yet, one will be created.
static void initialize (const uint32_t num_names, const uint32_t num_events)
 initialize Initialize the performance monitor. Call this before using anything from PerformanceMonitor
static double measurement (std::string timer_name, std::string description, std::string prefix="", logging::LogLevel level=icl_core::logging::eLL_INFO)
 measurement Make a measurement from a given timer. The timer will keep running and the measurement will be added to PM's event log under the given description.
static void printSummary (std::string prefix, std::string name, icl_core::logging::LogLevel level=icl_core::logging::eLL_INFO)
 printSummary Print a summary for a given collection of events.
static void printSummaryAll (icl_core::logging::LogLevel level=icl_core::logging::eLL_INFO)
 printSummaryAll Print summary of everything: All prefixes, all descriptions and all static data. Output will be sorted by prefixes and static data will be printed first.
static void printSummaryFromPrefix (std::string prefix, icl_core::logging::LogLevel level=icl_core::logging::eLL_INFO)
 printSummaryFromPrefix Prints summary for the given prefix only.
static void start (std::string timer_name)
 start Start a timer with the given identifier
static double startStop (std::string timer_name, std::string description, std::string prefix="", logging::LogLevel level=icl_core::logging::eLL_INFO)
 measurement Make a measurement from a given timer. Resets the timer and the measurement will be added to PM's event log under the given description. If the given timer isn't started yet, it just will be started.

Public Attributes

bool m_enabled
 if set to false, the performance monitor will be non-operational
bool m_print_stop
 if set to false, the performance monitor won't print measurement events

Protected Member Functions

void addEvent (std::string prefix, std::string name, double data)
 add event to the event map
void addNonTimeEvent (std::string prefix, std::string name, double data)
void createStatisticSummary (std::stringstream &ss, std::string prefix, std::string name)
 Create output string for summary.
void createStatisticSummaryNonTime (std::stringstream &ss, std::string prefix, std::string name)
double getAverage (std::string name)
 calculate the average of all events with description name
double getAverageNonTime (std::string name)
void getMedian (std::string name, double &median, double &min, double &max)
 calculate the median of all events with description name
void getMedianNonTime (std::string name, double &median, double &min, double &max)
bool isEnabled (std::string prefix)
 check if prefix is enabled
 PerformanceMonitor ()
 constructor
void print (std::string message, icl_core::logging::LogLevel level=icl_core::logging::eLL_DEBUG)
 prints the given message to the specified log level
 ~PerformanceMonitor ()
 destructor

Protected Attributes

bool m_all_enabled
std::vector< std::vector
< double > > 
m_buffer
std::map< std::string,
std::vector< double > > 
m_data
std::map< std::string,
std::vector< double > > 
m_data_nontime
std::map< std::string, bool > m_enabled_prefix
std::map< std::string, double > m_static_data
std::map< std::string, TimeStampm_timer

Static Private Attributes

static PerformanceMonitorm_instance = NULL

Detailed Description

The PerformanceMonitor class provides an easy to use tool for performance measurement.

You can use the static methods directly, but using the macros defined in PerformanceMonitorMacros.h is recommended, as they provide enabling and disabling by defines such as _IC_DEBUG_ and IC_PERFORMANCE_MONITOR.

The typical minimum workflow would look like follows:

By default all outputs go to the prefix "". You can enable other prefixes as you wish and then use the print and summary functions with these prefixes. This way you can easily turn different groups on and off.

Static information such as parallel configurations can be passed to the performance monitor as well, which will be printed in the summary, as well.

Definition at line 69 of file PerformanceMonitor.h.


Constructor & Destructor Documentation

constructor

Definition at line 44 of file PerformanceMonitor.cpp.

destructor

Definition at line 51 of file PerformanceMonitor.cpp.


Member Function Documentation

void icl_core::perf_mon::PerformanceMonitor::addData ( std::string  name,
double  data,
std::string  prefix 
) [static]

addData Manually insert a time measurement with given identifier

Parameters:
nameTimer description
dataTime
prefixPrefix that the data belongs to.

Definition at line 161 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::addEvent ( std::string  prefix,
std::string  name,
double  data 
) [protected]

add event to the event map

Definition at line 177 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::addNonTimeData ( std::string  name,
double  data,
std::string  prefix 
) [static]

addNonTimeData Adds some additional arbitrary information. In contrast to addStaticData multiple values (measurements) can be passed to the same identifier. However, right now they are output as if they were time measurements.

Parameters:
nameShort data description
dataThe data itself
prefixPrefix that the data belongs to.

Definition at line 169 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::addNonTimeEvent ( std::string  prefix,
std::string  name,
double  data 
) [protected]

Definition at line 195 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::addStaticData ( std::string  name,
double  data,
std::string  prefix 
) [static]

addStaticData Adds static information. You can basically put any information that can be cast into a double in here.

Parameters:
nameDescription of the data
dataThe data itself
prefixPrefix that the data belongs to.

Definition at line 152 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::createStatisticSummary ( std::stringstream &  ss,
std::string  prefix,
std::string  name 
) [protected]

Create output string for summary.

Definition at line 241 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::createStatisticSummaryNonTime ( std::stringstream &  ss,
std::string  prefix,
std::string  name 
) [protected]

Definition at line 256 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::disablePrefix ( std::string  prefix) [static]

disablePrefix Disables a given prefix

Parameters:
prefixPrefix that will be disabled.

Definition at line 296 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::enableAll ( const bool &  enabled) [static]

enableAll set whether all prefixes should be enabled or not. Overrides single enable/disable assignments.

Once enableAll(false) is called, single enable/disables statements will be used again.

Definition at line 291 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::enablePrefix ( std::string  prefix) [static]

enablePrefix Enables a given prefix

Parameters:
prefixPrefix that will be enabled.

Definition at line 281 of file PerformanceMonitor.cpp.

double icl_core::perf_mon::PerformanceMonitor::getAverage ( std::string  name) [protected]

calculate the average of all events with description name

Definition at line 377 of file PerformanceMonitor.cpp.

double icl_core::perf_mon::PerformanceMonitor::getAverageNonTime ( std::string  name) [protected]

Definition at line 388 of file PerformanceMonitor.cpp.

getInstance As The Performance Monitor is implemented as a singleton pattern, this provides an accessor to the PM instance. If there's no instance, yet, one will be created.

Returns:
pointer to the PM instance

Definition at line 56 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::getMedian ( std::string  name,
double &  median,
double &  min,
double &  max 
) [protected]

calculate the median of all events with description name

Definition at line 399 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::getMedianNonTime ( std::string  name,
double &  median,
double &  min,
double &  max 
) [protected]

Definition at line 408 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::initialize ( const uint32_t  num_names,
const uint32_t  num_events 
) [static]

initialize Initialize the performance monitor. Call this before using anything from PerformanceMonitor

Parameters:
num_namesAssumed maximum number of event names (descriptions). This serves as preallocation of the according map.
num_eventsAssumed maximum number of events (timer measurements). This serves as preallocation of the according map.

Definition at line 65 of file PerformanceMonitor.cpp.

bool icl_core::perf_mon::PerformanceMonitor::isEnabled ( std::string  prefix) [protected]

check if prefix is enabled

Definition at line 78 of file PerformanceMonitor.cpp.

double icl_core::perf_mon::PerformanceMonitor::measurement ( std::string  timer_name,
std::string  description,
std::string  prefix = "",
logging::LogLevel  level = icl_core::logging::eLL_INFO 
) [static]

measurement Make a measurement from a given timer. The timer will keep running and the measurement will be added to PM's event log under the given description.

Parameters:
timer_nameThe timer's identifier
descriptionThe event description. Keep it short for better readability.
prefixOptional prefix to put the event into a group. Defaults to ""
levelOptional logging level. Defaults to icl_core::logging::eLL_INFO
Returns:
The measurement value in ms

Definition at line 92 of file PerformanceMonitor.cpp.

prints the given message to the specified log level

Definition at line 214 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::printSummary ( std::string  prefix,
std::string  name,
icl_core::logging::LogLevel  level = icl_core::logging::eLL_INFO 
) [static]

printSummary Print a summary for a given collection of events.

Parameters:
prefixThe prefix in which the events lie.
nameThe events' description
levelOptional logging level. Defaults to icl_core::logging::eLL_INFO

Definition at line 271 of file PerformanceMonitor.cpp.

printSummaryAll Print summary of everything: All prefixes, all descriptions and all static data. Output will be sorted by prefixes and static data will be printed first.

Parameters:
levelOptional logging level. Defaults to icl_core::logging::eLL_INFO

Definition at line 306 of file PerformanceMonitor.cpp.

printSummaryFromPrefix Prints summary for the given prefix only.

Parameters:
prefixPrefix for which the summary will be printed
levelOptional logging level. Defaults to icl_core::logging::eLL_INFO

Definition at line 317 of file PerformanceMonitor.cpp.

void icl_core::perf_mon::PerformanceMonitor::start ( std::string  timer_name) [static]

start Start a timer with the given identifier

Parameters:
timer_nameThe timer's identifier

Definition at line 83 of file PerformanceMonitor.cpp.

double icl_core::perf_mon::PerformanceMonitor::startStop ( std::string  timer_name,
std::string  description,
std::string  prefix = "",
logging::LogLevel  level = icl_core::logging::eLL_INFO 
) [static]

measurement Make a measurement from a given timer. Resets the timer and the measurement will be added to PM's event log under the given description. If the given timer isn't started yet, it just will be started.

Parameters:
timer_nameThe timer's identifier
descriptionThe event description. Keep it short for better readability.
prefixOptional prefix to put the event into a group. Defaults to ""
levelOptional logging level. Defaults to icl_core::logging::eLL_INFO
Returns:
The measurement value in ms

Definition at line 114 of file PerformanceMonitor.cpp.


Member Data Documentation

Definition at line 234 of file PerformanceMonitor.h.

std::vector<std::vector<double> > icl_core::perf_mon::PerformanceMonitor::m_buffer [protected]

Definition at line 230 of file PerformanceMonitor.h.

std::map<std::string, std::vector<double> > icl_core::perf_mon::PerformanceMonitor::m_data [protected]

Definition at line 227 of file PerformanceMonitor.h.

std::map<std::string, std::vector<double> > icl_core::perf_mon::PerformanceMonitor::m_data_nontime [protected]

Definition at line 228 of file PerformanceMonitor.h.

if set to false, the performance monitor will be non-operational

Definition at line 194 of file PerformanceMonitor.h.

std::map<std::string, bool> icl_core::perf_mon::PerformanceMonitor::m_enabled_prefix [protected]

Definition at line 231 of file PerformanceMonitor.h.

Definition at line 238 of file PerformanceMonitor.h.

if set to false, the performance monitor won't print measurement events

Definition at line 196 of file PerformanceMonitor.h.

std::map<std::string, double > icl_core::perf_mon::PerformanceMonitor::m_static_data [protected]

Definition at line 232 of file PerformanceMonitor.h.

std::map<std::string, TimeStamp> icl_core::perf_mon::PerformanceMonitor::m_timer [protected]

Definition at line 229 of file PerformanceMonitor.h.


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


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:26