#include <Utilities/Timing/interface/TimingReport.h>
Public Types | |
typedef BaseEvent< std::pair < double, double > > | ItemObserver |
Public Member Functions | |
void | dump (std::ostream &co, bool active=false) |
bool & | inTicks () |
report in ticks | |
const bool & | isOn () const |
Item & | make (const std::string &name) |
const Item & | operator[] (const std::string &name) const |
Item & | operator[] (const std::string &name) |
void | start (const std::string &name) |
void | stop (const std::string &name) |
void | switchOn (const std::string &name, bool ion) |
switch one ion | |
void | switchOn (bool ion) |
switch all on | |
~TimingReport () | |
Static Public Member Functions | |
static TimingReport * | current () |
Protected Types | |
typedef std::map< std::string, Item, std::less< std::string > > | SMAP |
Protected Member Functions | |
TimingReport () | |
Private Attributes | |
bool | inTicks_ |
bool | on |
SMAP | registry |
Classes | |
class | Item |
Definition at line 22 of file TimingReport.h.
typedef BaseEvent< std::pair<double,double> > TimingReport::ItemObserver |
Definition at line 24 of file TimingReport.h.
typedef std::map< std::string, Item, std::less<std::string> > TimingReport::SMAP [protected] |
Definition at line 63 of file TimingReport.h.
TimingReport::TimingReport | ( | ) | [protected] |
Definition at line 29 of file TimingReport.cc.
Referenced by current().
00029 : on(true), inTicks_(false) { 00030 //std::cout << "Creating a new Timing Report" << std::endl; 00031 //std::cout <<"StopWatch bias " << PentiumTimer::bias()<<std::endl; 00032 //std::cout <<"CPUWatch bias " << LinuxCPUTimer::bias()<<std::endl; 00033 }
TimingReport::~TimingReport | ( | ) |
Definition at line 45 of file TimingReport.cc.
References GenMuonPlsPt100GeV_cfg::cout, dump(), and on.
TimingReport * TimingReport::current | ( | void | ) | [static] |
Definition at line 21 of file TimingReport.cc.
References TimingReport().
Referenced by R2DTimerObserver::init(), TimerStack::push(), HTimerStack::push(), KalmanAlignmentAlgorithm::terminate(), AlCaPi0BasicClusterRecHitsProducer::~AlCaPi0BasicClusterRecHitsProducer(), AlCaPi0RecHitsProducer::~AlCaPi0RecHitsProducer(), muonisolation::CaloExtractorByAssociator::~CaloExtractorByAssociator(), and muonisolation::JetExtractor::~JetExtractor().
00021 { 00022 static TimingReport * currentTimingReport=0; 00023 00024 if (currentTimingReport==0) currentTimingReport = new TimingReport(); 00025 return currentTimingReport; 00026 00027 }
make the output sorted
Definition at line 50 of file TimingReport.cc.
References counter(), e, lat::endl(), inTicks(), max, p, and registry.
Referenced by KalmanAlignmentAlgorithm::terminate(), AlCaPi0BasicClusterRecHitsProducer::~AlCaPi0BasicClusterRecHitsProducer(), AlCaPi0RecHitsProducer::~AlCaPi0RecHitsProducer(), muonisolation::CaloExtractorByAssociator::~CaloExtractorByAssociator(), muonisolation::JetExtractor::~JetExtractor(), and ~TimingReport().
00050 { 00052 typedef std::map<std::string, Item *, std::less<std::string> > LMAP; 00053 LMAP lreg; 00054 { 00055 SMAP::iterator p = registry.begin(); 00056 SMAP::iterator e = registry.end(); 00057 while (p!=e) { 00058 if ( (*p).second.on && (!active||(*p).second.active()) ) 00059 lreg[(*p).first] = &(*p).second; 00060 ++p; 00061 } 00062 } 00063 00064 std::ostream co(ico.rdbuf()); 00065 size_t namew = 20; 00066 co << "\n"; 00067 if (active) co << "Active "; 00068 co << "Timing Report (in " 00069 << (inTicks() ? "ticks" : "seconds") << ")\n" << std::endl; 00070 LMAP::iterator p = lreg.begin(); 00071 LMAP::iterator e = lreg.end(); 00072 while (p!=e) { namew = std::max(namew,(*p).first.size()); ++p;} 00073 p = lreg.begin(); 00074 while (p!=e) { 00075 co.setf(std::ios::left,std::ios::adjustfield); 00076 if (inTicks()) 00077 co << std::setiosflags(std::ios::showpoint) 00078 << std::setprecision(3); 00079 else 00080 co << std::setiosflags(std::ios::showpoint | std::ios::fixed) 00081 << std::setprecision(3); 00082 00083 co << std::setw(namew) << (*p).first.c_str() << " "; 00084 co.setf(std::ios::right,std::ios::adjustfield); 00085 co << std::setw(10) << (*(*p).second).counter << " "; 00086 co << std::setw(10) 00087 << (inTicks() ? (*(*p).second).realticks() 00088 : (*(*p).second).realsec() ) << " (real)"; 00089 #ifdef __linux__ 00090 co << " " << std::setw(10) 00091 << (inTicks() ? 1./PentiumTimer::ticksInSec() : 1.)*(*(*p).second).cpusec() << " (cpu)"; 00092 #endif 00093 co << std::endl; 00094 ++p; 00095 } 00096 co << "\n" << std::endl; 00097 }
bool& TimingReport::inTicks | ( | ) | [inline] |
report in ticks
Definition at line 74 of file TimingReport.h.
References inTicks_.
Referenced by dump().
00074 { return inTicks_;}
const bool& TimingReport::isOn | ( | ) | const [inline] |
Item& TimingReport::make | ( | const std::string & | name | ) | [inline] |
const Item& TimingReport::operator[] | ( | const std::string & | name | ) | const [inline] |
Item& TimingReport::operator[] | ( | const std::string & | name | ) | [inline] |
void TimingReport::start | ( | const std::string & | name | ) | [inline] |
void TimingReport::stop | ( | const std::string & | name | ) | [inline] |
switch all on
Definition at line 35 of file TimingReport.cc.
References e, on, p, and registry.
00035 { 00036 if (on==ion) return; 00037 on = ion; 00038 //std::cout << "switching Timing Report " 00039 // << (on ? "on" : "off") << std::endl; 00040 SMAP::iterator p = registry.begin(); 00041 SMAP::iterator e = registry.end(); 00042 for (;p!=e; ++p) (*p).second.switchOn(on); 00043 }
bool TimingReport::inTicks_ [private] |
bool TimingReport::on [private] |
Definition at line 111 of file TimingReport.h.
Referenced by isOn(), make(), start(), stop(), switchOn(), and ~TimingReport().
SMAP TimingReport::registry [private] |
Definition at line 113 of file TimingReport.h.
Referenced by dump(), make(), operator[](), start(), stop(), and switchOn().