Create a ProfileTimer and hold onto it. Call init() whenever you like (the timer doesn’t
Call on() to start the timer. While the timer is on, call mark() at each point of interest,
in the code you are timing.
- You can turn the timer off() and on() to skip things you
don’t want to time.
- When your timing is finished, call printTo() to see the
results (e.g. myTimer.printTo(cerr)).
You should be able to time things down to the millisecond well enough, but if you call on() and off() within micro- seconds of each other, I don’t think you’ll get very good results.
explicit ProfileTimer(char const *name = 0, int maxEntries = 4096)¶
static void consolidateAllTo(std::ostream &out = ::std::cout)¶
void consolidateTo(std::ostream &out = ::std::cout) const¶
double getTotalTime(void) const¶
Don’t call any of the following during timing: (Because they are slow, not because anything will break).
void init(char const *name, int maxEntries = 4096)¶
void mark(char const *tag)¶
void off(char const *tag)¶
static void printAllTo(std::ostream &out = ::std::cout)¶
void printTo(std::ostream &out = ::std::cout) const¶