00001 #ifndef MyWATCHER_H 00002 #define MyWATCHER_H 00003 00004 #include "TStopwatch.h" 00005 #include <iostream> 00006 #include <sstream> 00007 00008 #ifdef EDM_ML_DEBUG 00009 class MyWatcher : public TStopwatch { 00010 public: 00011 MyWatcher(const std::string n=""):name(n),total(0) {} 00012 ~MyWatcher(){} 00013 00014 std::string start(bool r=true){Start(r); return " [Start]";} 00015 std::string continu(){Continue(); return " [Continue]";} 00016 std::string reset(){Reset(); return " [Reset]";} 00017 std::string stop() {Stop(); return " [Stop]";} 00018 std::string lap() { 00019 std::stringstream o; 00020 double r=RealTime(); 00021 total+=r; 00022 o<<"\n "<<r<<" total:"<<total<<" ["<<name<<"]"; 00023 Start(); 00024 return o.str();} 00025 std::string name; 00026 double total; 00027 }; 00028 #else 00029 class MyWatcher { 00030 public: 00031 MyWatcher(const std::string) {} 00032 ~MyWatcher(){} 00033 00034 std::string start(bool r=true){return name;} 00035 std::string continu(){return name;} 00036 std::string reset(){return name;} 00037 std::string stop(){return name;} 00038 std::string lap() {return name;} 00039 std::string name; 00040 }; 00041 #endif 00042 00043 #endif