11#include "TStopwatch.h"
28 TimerInfo(
const string& name ):fName(name),fReal(0.),fCpu(0.){ };
30 void operator =( TStopwatch& sw ) { fReal = sw.RealTime(); fCpu = sw.CpuTime(); };
31 void operator+=( TStopwatch& sw ) { fReal += sw.RealTime(); fCpu += sw.CpuTime(); };
37 float Real(){
return fReal; };
38 string&
Name(){
return fName; };
47 void Add(
string name ) { fNameToI[name] = fTIs.size(); fTIs.push_back(
TimerInfo(name)); };
53 r.fNameToI = fNameToI;
54 r.fTIs.resize(fTIs.size());
55 for(
unsigned int i = 0;
i < fTIs.size(); ++
i ) {
56 r.fTIs[
i] = fTIs[
i]/
f;
63 fTIs[0].PrintReal();
for(
unsigned int i = 1;
i < fTIs.size(); ++
i ) { cout <<
" | " << setw(fTIs[
i].Name().size()); fTIs[
i].PrintReal(); }
66 void PrintNames(){ cout << fTIs[0].Name();
for(
unsigned int i = 1;
i < fTIs.size(); ++
i ) { cout <<
" | " << fTIs[
i].Name(); } };
68 map< string, int > fNameToI;
69 vector<TimerInfo> fTIs;
77 void Add(
string name ) {
78 for(
unsigned int i = 0;
i < fTIIs.size(); ++
i )
89 for(
unsigned int i = 0;
i < fTIIs.size(); ++
i ) {
90 r.fTIIs[
i] = fTIIs[
i]/
f;
97 for(
unsigned int i = 1;
i < fTIIs.size(); ++
i )
104 cout.setf(ios::fixed);
105 cout <<
" stage "<<
" : "; fTIAll.
PrintNames(); cout << endl;
106 for(
unsigned int i = 0;
i < fTIIs.size(); ++
i ) {
107 cout <<
" iter " <<
i <<
" : "; fTIIs[
i].PrintReal(); cout << endl;
109 cout <<
" all "<<
" : "; fTIAll.
PrintReal(); cout << endl;
113 vector<L1CATFIterTimerInfo> fTIIs;
TimerInfo & operator[](string name)
void operator+=(L1CATFIterTimerInfo &t)
L1CATFIterTimerInfo operator/(float f)
TimerInfo & operator[](int i)
L1CATFTimerInfo operator/(float f)
L1CATFIterTimerInfo & GetAllInfo()
void operator+=(L1CATFTimerInfo &t)
L1CATFIterTimerInfo & GetTimerAll()
L1CATFIterTimerInfo & operator[](int i)
TimerInfo operator/(const float f) const
void operator=(TStopwatch &sw)
void operator+=(TStopwatch &sw)
TimerInfo(const string &name)
void operator+=(const TimerInfo &t)