CPU cycle record for performance analysis. More...
#include <Radiant/CycleRecord.hpp>
Public Member Functions | |
| CycleRecord (unsigned n=50) | |
| Constructor. More... | |
| void | finalReport () |
| Print a CPU cycle report to the screen. | |
| void | getNewTime (unsigned forWhich) |
| Calculate the number of new ticks, and put the value to the given bucket. More... | |
| void | getTicks () |
| Update the tick counter, without putting the value to any bucket. | |
| double | normalize () |
| Normalize the accumulation buffers, so that one can print the report. More... | |
| void | reset () |
| Reset the records to zero. | |
| size_t | size () const |
| The number of bins. More... | |
CPU cycle record for performance analysis.
This class is used to store cpu cycle information. The CPU usage is accumulated in a series of buckets. The central idea is that you can insert analysis points in your software and monitor how the CPU time is used between them.
CycleRecord record(3);
while(run()) {
record.getTicks();
DoTask1();
record.getNewTime(0);
DoTask2();
record.getNewTime(1);
DoTask3();
record.getNewTime(2);
}record.finalReport();
| Radiant::CycleRecord::CycleRecord | ( | unsigned | n = 50 | ) |
Constructor.
| n | The number of bins. |
| void Radiant::CycleRecord::getNewTime | ( | unsigned | forWhich | ) |
Calculate the number of new ticks, and put the value to the given bucket.
| forWich | Bin to modify |
| double Radiant::CycleRecord::normalize | ( | ) |
Normalize the accumulation buffers, so that one can print the report.
| size_t Radiant::CycleRecord::size | ( | ) | const |
The number of bins.