Fawkes API
Fawkes Development Version
|
Time tracking utility. More...
#include <>>
Public Member Functions | |
TimeTracker (const char *filename, bool add_default_class=false) | |
Constructor for file logging. More... | |
TimeTracker (bool add_default_class=false) | |
Constructor. More... | |
~TimeTracker () | |
Destructor. More... | |
unsigned int | add_class (std::string name) |
Add a new class. More... | |
void | remove_class (unsigned int cls) |
Remove a class. More... | |
void | ping (unsigned int cls) |
Ping class. More... | |
void | ping_start (unsigned int cls) |
Start of given class task. More... | |
void | ping_end (unsigned int cls) |
End of given class task. More... | |
void | ping_abort (unsigned int cls) |
End of given class task without recording. More... | |
void | ping (std::string comment="") |
Ping classless. More... | |
void | reset (std::string comment="") |
Reset times. More... | |
void | print_to_stdout () |
Print results to stdout. More... | |
void | print_to_file () |
Print data to file suitable for gnuplot. More... | |
Static Public Attributes | |
static const unsigned int | DEFAULT_CLASS = 0 |
The default tracking class. More... | |
Time tracking utility.
This class provides means to track time of different tasks in a process. You can assign an arbitrary number of tracking classes per object (although using a few classes is recommended for minimal influence of the measurement on the measured process). You can then print out averages and (max) deviation to get a feeling for the average performance and how flaky the runtimes are.
The time tracker can also be operated without any class if you only want to track a single process.
You can either just ping classless or a specific class which will then take the time difference between now and the last ping as the measured time. This is useful to determine the call frequency of a given item. If you want to benchmark sub-tasks you more likely want to start measuring at a specific point in time and then stop it after the sub-task is done to measure only this very task. This can be done by using pingStart() and pingEnd().
fawkes::TimeTracker::TimeTracker | ( | const char * | filename, |
bool | add_default_class = false |
||
) |
Constructor for file logging.
filename | name of the file to write log data to. File is overwritten. |
add_default_class | if true a default time class is added. |
Definition at line 84 of file tracker.cpp.
fawkes::TimeTracker::TimeTracker | ( | bool | add_default_class = false | ) |
Constructor.
add_default_class | if true a default time class is added. |
Definition at line 68 of file tracker.cpp.
fawkes::TimeTracker::~TimeTracker | ( | ) |
Destructor.
Definition at line 100 of file tracker.cpp.
unsigned int fawkes::TimeTracker::add_class | ( | std::string | name | ) |
Add a new class.
Adds a new class and gives the class ID.
name | name of the class |
Definition at line 156 of file tracker.cpp.
Referenced by TimeTrackerMainLoopThread::init(), FvRetrieverThread::init(), firevision::SiftClassifier::SiftClassifier(), firevision::SiftppClassifier::SiftppClassifier(), and firevision::SurfClassifier::SurfClassifier().
void fawkes::TimeTracker::ping | ( | unsigned int | cls | ) |
Ping class.
This takes the time difference between now and the last ping and adds this to class cls.
cls | class ID to ping |
Definition at line 194 of file tracker.cpp.
void fawkes::TimeTracker::ping | ( | std::string | comment = "" | ) |
Ping classless.
This takes the time difference between now and the last ping and adds this to classless tracking.
comment | optional ping comment. |
Definition at line 138 of file tracker.cpp.
void fawkes::TimeTracker::ping_abort | ( | unsigned int | cls | ) |
End of given class task without recording.
End the duration but do not take the time into the result measurements.
cls | class ID to signal end of task |
Definition at line 282 of file tracker.cpp.
void fawkes::TimeTracker::ping_end | ( | unsigned int | cls | ) |
End of given class task.
This takes the time difference between now and the last pingStart() for the class cls.
cls | class ID to signal end of task |
Definition at line 254 of file tracker.cpp.
Referenced by firevision::SiftClassifier::classify(), firevision::SiftppClassifier::classify(), firevision::SurfClassifier::classify(), FvRetrieverThread::loop(), firevision::SiftClassifier::SiftClassifier(), firevision::SiftppClassifier::SiftppClassifier(), firevision::SurfClassifier::SurfClassifier(), and fawkes::ScopedClassItemTracker::~ScopedClassItemTracker().
void fawkes::TimeTracker::ping_start | ( | unsigned int | cls | ) |
Start of given class task.
Signal the start of the given class.
cls | class ID |
Definition at line 228 of file tracker.cpp.
Referenced by firevision::SiftClassifier::classify(), firevision::SiftppClassifier::classify(), firevision::SurfClassifier::classify(), FvRetrieverThread::loop(), fawkes::ScopedClassItemTracker::ScopedClassItemTracker(), firevision::SiftClassifier::SiftClassifier(), firevision::SiftppClassifier::SiftppClassifier(), and firevision::SurfClassifier::SurfClassifier().
void fawkes::TimeTracker::print_to_file | ( | ) |
Print data to file suitable for gnuplot.
This will write the following data: average sec, average ms, average summed sec, deviation sec, deviation ms This data is generated for each class and concatenated into a single line and written to the file. A running number will be prepended as the first value. The data file is suitable as input for gnuplot.
Definition at line 442 of file tracker.cpp.
Referenced by TimeTrackerMainLoopThread::loop().
void fawkes::TimeTracker::print_to_stdout | ( | ) |
Print results to stdout.
Definition at line 317 of file tracker.cpp.
Referenced by firevision::SiftClassifier::classify(), firevision::SiftppClassifier::classify(), TimeTrackerMainLoopThread::loop(), and FvRetrieverThread::loop().
void fawkes::TimeTracker::remove_class | ( | unsigned int | cls | ) |
Remove a class.
This marks the class as unused. It is not longer possible to add times to this class but they will not be printed anymore. The space associated with this class is freed.
cls | ID of the class to remove |
Definition at line 174 of file tracker.cpp.
void fawkes::TimeTracker::reset | ( | std::string | comment = "" | ) |
Reset times.
Reset tracker and set comment.
comment | comment to set on tracker. |
Definition at line 116 of file tracker.cpp.
Referenced by TimeTrackerMainLoopThread::loop().
|
static |