tudocomp
– The TU Dortmund Compression Framework
|
Provides access to runtime and memory measurement in statistics phases. More...
#include <StatPhase.hpp>
Public Member Functions | |
StatPhase () | |
Creates a inert statistics phase without any effect. More... | |
StatPhase (const char *title) | |
Creates a new statistics phase. More... | |
StatPhase (const std::string &str) | |
Creates a new statistics phase. More... | |
~StatPhase () | |
Destroys and ends the phase. More... | |
void | split (const char *new_title) |
Starts a new phase as a sibling, reusing the same object. More... | |
void | split (const std::string &new_title) |
Starts a new phase as a sibling, reusing the same object. More... | |
template<typename T > | |
void | log_stat (const char *key, const T &value) |
Logs a user statistic for this phase. More... | |
json::Object | to_json () |
Constructs the JSON representation of the measured data. More... | |
Static Public Member Functions | |
template<typename F > | |
static auto | wrap (const char *title, F func) -> typename std::result_of< F(StatPhase &)>::type |
Executes a lambda as a single statistics phase. More... | |
template<typename F > | |
static auto | wrap (const char *title, F func) -> typename std::result_of< F()>::type |
Executes a lambda as a single statistics phase. More... | |
static void | track_alloc (size_t bytes) |
Tracks a memory allocation of the given size for the current phase. More... | |
static void | track_free (size_t bytes) |
Tracks a memory deallocation of the given size for the current phase. More... | |
static void | pause_tracking () |
Pauses the tracking of memory allocations in the current phase. More... | |
static void | resume_tracking () |
Resumes the tracking of memory allocations in the current phase. More... | |
template<typename T > | |
static void | log (const char *key, const T &value) |
Logs a user statistic for the current phase. More... | |
Provides access to runtime and memory measurement in statistics phases.
Phases are used to track runtime and memory allocations over the course of the application. The measured data can be printed as a JSON string for use in the tudocomp charter for visualization or third party applications.
Definition at line 44 of file StatPhase.hpp.
|
inline |
Creates a inert statistics phase without any effect.
Definition at line 223 of file StatPhase.hpp.
|
inline |
Creates a new statistics phase.
The new phase is started as a sub phase of the current phase and will immediately become the current phase.
title | the phase title |
Definition at line 233 of file StatPhase.hpp.
|
inline |
Creates a new statistics phase.
The new phase is started as a sub phase of the current phase and will immediately become the current phase.
str | the phase title |
Definition at line 245 of file StatPhase.hpp.
|
inline |
Destroys and ends the phase.
The phase's parent phase, if any, will become the current phase.
Definition at line 251 of file StatPhase.hpp.
|
inlinestatic |
Logs a user statistic for the current phase.
User statistics will be stored in a special data block for a phase and is included in the JSON output.
key | the statistic key or name |
value | the value to log (will be converted to a string) |
Definition at line 218 of file StatPhase.hpp.
|
inline |
Logs a user statistic for this phase.
User statistics will be stored in a special data block for a phase and is included in the JSON output.
key | the statistic key or name |
value | the value to log (will be converted to a string) |
Definition at line 298 of file StatPhase.hpp.
|
inlinestatic |
Pauses the tracking of memory allocations in the current phase.
Memory tracking is paused until pause_tracking is called or the phase object is destroyed.
Definition at line 198 of file StatPhase.hpp.
|
inlinestatic |
Resumes the tracking of memory allocations in the current phase.
This only has an effect if tracking has previously been paused using pause_tracking.
Definition at line 206 of file StatPhase.hpp.
|
inline |
Starts a new phase as a sibling, reusing the same object.
This function behaves exactly as if the current phase was ended and a new phases was started immediately after.
new_title | the new phase title |
Definition at line 264 of file StatPhase.hpp.
|
inline |
Starts a new phase as a sibling, reusing the same object.
This function behaves exactly as if the current phase was ended and a new phases was started immediately after.
new_title | the new phase title |
Definition at line 286 of file StatPhase.hpp.
|
inline |
Constructs the JSON representation of the measured data.
It contains the subtree of phases beneath this phase.
Definition at line 311 of file StatPhase.hpp.
|
inlinestatic |
Tracks a memory allocation of the given size for the current phase.
Use this only if memory is allocated with methods that do not result in calls of malloc
but should still be tracked (e.g., when using direct kernel allocations like memory mappings).
bytes | the amount of allocated bytes to track for the current phase |
Definition at line 178 of file StatPhase.hpp.
|
inlinestatic |
Tracks a memory deallocation of the given size for the current phase.
Use this only if memory is allocated with methods that do not result in calls of malloc
but should still be tracked (e.g., when using direct kernel allocations like memory mappings).
bytes | the amount of freed bytes to track for the current phase |
Definition at line 190 of file StatPhase.hpp.
|
inlinestatic |
Executes a lambda as a single statistics phase.
The new phase is started as a sub phase of the current phase and will immediately become the current phase.
In case the given lambda accepts a StatPhase
reference parameter, the phase object will be passed to it for use during execution.
title | the phase title |
func | the lambda to execute |
Definition at line 143 of file StatPhase.hpp.
|
inlinestatic |
Executes a lambda as a single statistics phase.
The new phase is started as a sub phase of the current phase and will immediately become the current phase.
In case the given lambda accepts a StatPhase
reference parameter, the phase object will be passed to it for use during execution.
title | the phase title |
func | the lambda to execute |
Definition at line 162 of file StatPhase.hpp.