Inheritance diagram for lfc::Chronometer::
Public Methods | |
Chronometer () throw () | |
virtual | ~Chronometer () throw () |
virtual void | start () throw () |
starts the chronometer. More... | |
virtual void | stop () throw () |
stops the chronometer. More... | |
virtual const HiResTimeSpan | duration () const throw () |
| |
virtual void | writeObject (BinaryOutput &stream) const |
platform independent serialization. More... | |
virtual void | readObject (BinaryInput &stream) |
platform independent deserialization. More... | |
virtual void | formatObject (TextOutput &stream, string format="") const |
formatting based on a certain format. More... | |
Protected Attributes | |
HiResTimeSpan | m_start |
HiResTimeSpan | m_finish |
It should be used for profiling only, but be warned: it only counts processor time, so on posix systems, trying to measure empty loops and such will yield nothing.
Here's a small sample of how to use Chronometer:
Chronometer c; File f("chronometerResults.txt", File::flWrite); lfcOut.connectOutputBase(f); for(int i = 6000; (i *= 10) <= 600000000; ) { long temp = i; lfcOut << "Time taken to make " << i << " empty loops: "; c.start(); while(--temp) { } c.stop(); lfcOut << formattedOut(c, "-s 'secs', -ms 'msecs'") << ENDL; } lfcOut.disconnectOutputBase(f);
|
|
|
|
|
starts the chronometer.
|
|
stops the chronometer.
|
|
|
|
platform independent serialization.
Reimplemented from lfc::_Serializable. |
|
platform independent deserialization.
Reimplemented from lfc::_Serializable. |
|
formatting based on a certain format. For Chronometer, formatting is done through HiResTimeSpan, so the format and rules are the same as for HiResTimeSpan. Reimplemented from lfc::_Formatable. |
|
|
|
|