All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::CycleRecord Class Reference

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...
 

Detailed Description

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();
 

Constructor & Destructor Documentation

Radiant::CycleRecord::CycleRecord ( unsigned  n = 50)

Constructor.

Parameters
nThe number of bins.

Member Function Documentation

void Radiant::CycleRecord::getNewTime ( unsigned  forWhich)

Calculate the number of new ticks, and put the value to the given bucket.

Parameters
forWichBin to modify
double Radiant::CycleRecord::normalize ( )

Normalize the accumulation buffers, so that one can print the report.

Returns
total CPU cycle count.
size_t Radiant::CycleRecord::size ( ) const

The number of bins.

Returns
Number of bins