CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/EventFilter/EcalRawToDigi/interface/MyWatcher.h

Go to the documentation of this file.
00001 #ifndef MyWATCHER_H
00002 #define MyWATCHER_H
00003 
00004 #include "TStopwatch.h"
00005 #include <iostream>
00006 #include <sstream>
00007 
00008 class MyWatcher : public TStopwatch {
00009  public:
00010   MyWatcher(const std::string n=""):name(n),total(0) {}
00011   ~MyWatcher(){}
00012   
00013   std::string start(bool r=true){Start(r); return " [Start]";}
00014   std::string continu(){Continue(); return " [Continue]";}
00015   std::string reset(){Reset(); return " [Reset]";}
00016   std::string stop() {Stop(); return " [Stop]";}
00017   std::string lap() {
00018     std::stringstream o;
00019     double r=RealTime();
00020     total+=r;
00021     o<<"\n   "<<r<<" total:"<<total<<" ["<<name<<"]";
00022     Start();
00023     return o.str();}
00024   std::string name;
00025   double total;
00026 };
00027 
00028 
00029 #endif