////////////////////////////////////////////////////////////////////
//
// Records the time taken whilst active and then displays the result in
// a standard way.
//
// \author P G Jones
//
// REVISION HISTORY:
// 2013-12-13 : P G Jones - New file.
//
////////////////////////////////////////////////////////////////////
#ifndef __RAT_Profiler__
#define __RAT_Profiler__
#include
#include
#include
namespace RAT
{
class Profiler
{
public:
// Construct the Profiler
//
// name: name of the object being profiled.
// detail: detail of the object being profiled.
Profiler( const std::string name,
const std::string detail );
// Close the profiler
virtual ~Profiler() { }
// Start or activate the profiler
virtual void Start() { fStopwatch.Start( true ); };
// Stop the profiler
virtual void Stop();
// This function outputs the timing information in a standard format
//
// The format will be name:detail calls time total
virtual void OutputTiming() const;
protected:
TStopwatch fStopwatch; // ROOT's stopwatch for timing processor execution times
std::string fName; // Name of the profiled object
std::string fDetail; // Some detail about the profiled object
double fTotalTime; // Total real time whilst active (seconds)
double fTotalCPUTime; // Total cpu time whilst active (seconds)
int fCalls; // Total number of activations
};
} // namespace RAT
#endif