#include <TimerStack.h>
Classes | |
class | Timer |
TTimer is a container for a timer name and associated timers (TimeReport::Item's) More... | |
Public Types | |
enum | Status { AlwaysActive, Disableable } |
enum | Type { DetailedMonitoring, FastMonitoring } |
Public Member Functions | |
void | benchmark (std::string name, int n=1000000) |
measure time to perform a number of floating point multiplications (FLOPs) | |
void | clear_stack () |
stop all timers in the stack and clear it. | |
PentiumTimeType | pentiumTime () |
get access to the cpu clock counter on Intel and AMD cpus | |
void | pop () |
stop the last timer and remove it from the stack | |
void | pop_and_push (std::string name, Type type=FastMonitoring) |
void | pop_and_push (Timer &, Type type=FastMonitoring) |
void | push (std::string name, Type type=FastMonitoring) |
start a timer and add it to the stack | |
void | push (Timer &, Type type=FastMonitoring) |
TimerStack () | |
TimerStack (Status status) | |
~TimerStack () | |
Private Attributes | |
std::stack< TimeMe * > | stack |
Status | status_ |
Definition at line 19 of file TimerStack.h.
enum TimerStack::Status |
Definition at line 35 of file TimerStack.h.
{ AlwaysActive, Disableable };
enum TimerStack::Type |
Types of time interval measurements used in TimeReport:
Definition at line 34 of file TimerStack.h.
TimerStack::TimerStack | ( | ) | [inline] |
Definition at line 53 of file TimerStack.h.
:status_(AlwaysActive){}
TimerStack::TimerStack | ( | Status | status | ) | [inline] |
Definition at line 54 of file TimerStack.h.
TimerStack::~TimerStack | ( | ) | [inline] |
void TimerStack::benchmark | ( | std::string | name, |
int | n = 1000000 |
||
) |
void TimerStack::clear_stack | ( | ) |
stop all timers in the stack and clear it.
Definition at line 25 of file TimerStack.cc.
Referenced by ~TimerStack().
PentiumTimeType TimerStack::pentiumTime | ( | ) | [inline] |
get access to the cpu clock counter on Intel and AMD cpus
Definition at line 75 of file TimerStack.h.
References rdtscPentium().
{return rdtscPentium();}
void TimerStack::pop | ( | ) |
stop the last timer and remove it from the stack
Definition at line 18 of file TimerStack.cc.
References stack.
Referenced by benchmark(), clear_stack(), and pop_and_push().
void TimerStack::pop_and_push | ( | TimerStack::Timer & | timer, |
Type | type = FastMonitoring |
||
) |
void TimerStack::pop_and_push | ( | std::string | name, |
Type | type = FastMonitoring |
||
) |
void TimerStack::push | ( | std::string | name, |
Type | type = FastMonitoring |
||
) |
start a timer and add it to the stack
Definition at line 2 of file TimerStack.cc.
References TimingReport::current(), DetailedMonitoring, mergeVDriftHistosByStation::name, and stack.
Referenced by benchmark(), and pop_and_push().
{ bool linuxCpuOn = (type == DetailedMonitoring); if( (*TimingReport::current())["firstcall_"+name].counter == 0) stack.push(new TimeMe("firstcall_"+name,linuxCpuOn)); else stack.push(new TimeMe(name,linuxCpuOn)); }
void TimerStack::push | ( | TimerStack::Timer & | timer, |
Type | type = FastMonitoring |
||
) |
Definition at line 44 of file MethodSetter.cc.
References error, Exception, reco::findDataMember(), reco::findMethod(), reco::parser::kIsNotConst, reco::parser::kIsNotPublic, reco::parser::kIsStatic, reco::parser::kNameDoesNotExist, reco::parser::kWrongArgumentType, reco::parser::kWrongNumberOfArguments, mem, push(), and reco::returnType().
Referenced by push().
{ Type type = typeStack_.back(); vector<AnyMethodArgument> fixups; int error; pair<Member, bool> mem = reco::findMethod(type, name, args, fixups,begin,error); if(mem.first) { Type retType = reco::returnType(mem.first); if(!retType) { throw Exception(begin) << "member \"" << mem.first.Name() << "\" return type is invalid:\n" << " member type: \"" << mem.first.TypeOf().Name() << "\"\n" << " return type: \"" << mem.first.TypeOf().ReturnType().Name() << "\"\n"; } typeStack_.push_back(retType); // check for edm::Ref, edm::RefToBase, edm::Ptr if(mem.second) { //std::cout << "Mem.second, so book " << mem.first.Name() << " without fixups." << std::endl; methStack_.push_back(MethodInvoker(mem.first)); if (deep) push(name, args,begin); // note: we have not found the method, so we have not fixupped the arguments else return false; } else { //std::cout << "Not mem.second, so book " << mem.first.Name() << " with #args = " << fixups.size() << std::endl; methStack_.push_back(MethodInvoker(mem.first, fixups)); } } else { if(error != reco::parser::kNameDoesNotExist) { switch(error) { case reco::parser::kIsNotPublic: throw Exception(begin) << "method named \"" << name << "\" for type \"" <<type.Name() << "\" is not publically accessible."; break; case reco::parser::kIsStatic: throw Exception(begin) << "method named \"" << name << "\" for type \"" <<type.Name() << "\" is static."; break; case reco::parser::kIsNotConst: throw Exception(begin) << "method named \"" << name << "\" for type \"" <<type.Name() << "\" is not const."; break; case reco::parser::kWrongNumberOfArguments: throw Exception(begin) << "method named \"" << name << "\" for type \"" <<type.Name() << "\" was passed the wrong number of arguments."; break; case reco::parser::kWrongArgumentType: throw Exception(begin) << "method named \"" << name << "\" for type \"" <<type.Name() << "\" was passed the wrong types of arguments."; break; default: throw Exception(begin) << "method named \"" << name << "\" for type \"" <<type.Name() << "\" is not usable in this context."; } } //see if it is a member data int error; Member member = reco::findDataMember(type,name,error); if(!member) { switch(error) { case reco::parser::kNameDoesNotExist: throw Exception(begin) << "no method or data member named \"" << name << "\" found for type \"" <<type.Name() << "\""; break; case reco::parser::kIsNotPublic: throw Exception(begin) << "data member named \"" << name << "\" for type \"" <<type.Name() << "\" is not publically accessible."; break; default: throw Exception(begin) << "data member named \"" << name << "\" for type \"" <<type.Name() << "\" is not usable in this context."; break; } } typeStack_.push_back(member.TypeOf()); methStack_.push_back(MethodInvoker(member)); } return true; }
std::stack<TimeMe*> TimerStack::stack [private] |
Definition at line 78 of file TimerStack.h.
Referenced by clear_stack(), pop(), and push().
Status TimerStack::status_ [private] |
Definition at line 79 of file TimerStack.h.