-
Notifications
You must be signed in to change notification settings - Fork 217
Timers
For the sake of performance testing, either of the library functionality or your own code you can use the performance counters implementation of the library.
Two classes implement performance counters functionality: Timer and TimersRegistry.
The Timer class implements the ability to time a certain duration. The class has 3 important member functions:
-
StartMeasure
– starts the timer. -
StopMeasureAndAccumulate
– stops the timer and accumulate the duration from the “StartMeasure” call -
GetTotalMiliSeconds
– returns the total measure of all StartMeasure…StopMeasure pairs.
Using the timer class is easy:
Timer timer;
timer.StartMeasure();
// Sleep(5);
timer.StopMeasureAndAccumulate();
TRACE_LOG("Number of seconds passed = %ld",(long)timer.GetTotalMiliSeconds());
The above code starts the timer, waits for 5 seconds, and then stops its measurement, later it traces the total waited time to the log.
The TimersRegistry class implements an easy method of Timing various code locations. Its interface is similar to the Timer class, however it also adds a string parameter to each call. This allows you to name various timers and control them through that name. The implementation of the class holds a collection of timers, each identified by a string.
The TimersRegistry class also has 3 other methods:
-
ReleaseAll
– releases all timers currently in the registry. -
TraceAll
– traces all timers to the log. -
TraceAndReleaseAll
– both traces the timers to the log and releases them.
For a complete example of using the TimersRegistry class see TimerTest.
- First Steps In Creating a PDF file
- Creating PDF Pages
- Images Support
- Text Support
- Adding Content to PDF Pages
- Links
- Unicode and UnicodeString class
- PDF Embedding
- Custom input and output
- Using Form XObjects
- Forward Referencing
- JPG Images Support
- TIFF Images Support
- PNG Images support