TimeProfiler
class TimeProfiler
Operators
| Name | Description |
|---|---|
| karabo::data::Hash | Serialize the profiler into Hash object. |
Functions
| Name | Description |
|---|---|
| TimeProfiler | Constructor creates a profiler with a given name name : profiler's name |
| getName | Returns the profiler name Return : std::string profiler's name |
| open | Initialize the profiler internal structure |
| close | Finalize the profiler internal structure |
| startPeriod | Start a new unnamed period (i.e. detail) and append it to the current open period. Unnamed periods are leaves, thus do cover other sub-periods. |
| startPeriod | Start an new period with the given name. |
| stopPeriod | Close the last open period |
| stopPeriod | Stops period "periodname" and all nested periods periodname : period's name |
| getPeriod | Return the time period period "periodname" as Hash periodname : period's name Return : TimePeriod object |
| getPeriod | Returns the overall profiler period, i.e. from open to close. Return : TimePeriod object |
| getPeriodAsHash | Return the time period period "periodname" as Hash periodname : period's name Return : Hash object |
| getPeriodAsHash | Returns the overall profiler period. |
| format | Serialize the profiler into string using specific time format. |
| sql | Serialize the profiler as SQL insert query, in preparation to be inserted into database. |
| serialize | Serialize the profiler into ostream object using default time format, i.e X.Y (where X is total seconds, and Y is fraction in nanoseconds) os : output stream object format : time format level : deepest level |
Operator Details
karabo::data::Hash
operator karabo::data::Hash()
Serialize the profiler into Hash object.
Function Details
TimeProfiler
TimeProfiler(const std::string& name)
Constructor creates a profiler with a given name
name
: profiler's name
close
void close()
Finalize the profiler internal structure
format
std::string format(const std::string& fmt, int level = std::numeric_limits<int>::max()) const
Serialize the profiler into string using specific time format.
format
: time format
level
: deepest level
Return : string object holding the string representation
getName
const std::string& getName() const
Returns the profiler name
Return : std::string profiler's name
getPeriod
const karabo::data::TimePeriod getPeriod(const std::string& periodname) const
Return the time period period "periodname" as Hash
periodname
: period's name
Return : TimePeriod object
const karabo::data::TimePeriod getPeriod() const
Returns the overall profiler period, i.e. from open to close.
Return : TimePeriod object
getPeriodAsHash
const karabo::data::Hash& getPeriodAsHash(const std::string& periodname) const
Return the time period period "periodname" as Hash
periodname
: period's name
Return : Hash object
const karabo::data::Hash& getPeriodAsHash() const
Returns the overall profiler period.
Return : Hash object
open
void open()
Initialize the profiler internal structure
serialize
void serialize(std::ostream& os, int level = std::numeric_limits<int>::max()) const
Serialize the profiler into ostream object using default time format, i.e X.Y (where X is total seconds, and Y is fraction in nanoseconds)
os
: output stream object
format
: time format
level
: deepest level
sql
std::string sql() const
Serialize the profiler as SQL insert query, in preparation to be inserted into database.
Return : string object holding the SQL query string
startPeriod
void startPeriod()
Start a new unnamed period (i.e. detail) and append it to the current open period. Unnamed periods are leaves, thus do cover other sub-periods.
void startPeriod(const std::string& periodname)
Start an new period with the given name. Named periods can be nested, i.e. named periods can cover other named and anonymous periods
periodname
: period's name
stopPeriod
void stopPeriod()
Close the last open period
void stopPeriod(const std::string& periodname)
Stops period "periodname" and all nested periods
periodname
: period's name