![]() |
![]() |
00001 #ifndef ProfilerService_H 00002 #define ProfilerService_H 00003 00004 00005 //FIXME only forward declarations??? 00006 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00007 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" 00008 00009 #include <vector> 00010 #include <string> 00011 00012 00018 class ProfilerService { 00019 public: 00020 00022 ProfilerService(edm::ParameterSet const& pset, 00023 edm::ActivityRegistry & activity); 00024 00026 ~ProfilerService(); 00027 00028 00029 // ---- Public Interface ----- 00030 00031 00033 bool startInstrumentation(); 00034 00036 bool stopInstrumentation(); 00037 00039 bool forceStopInstrumentation(); 00040 00041 // pause instrumentation (if active) 00042 bool pauseInstrumentation(); 00043 00044 // resume instrumentation (if paused) 00045 bool resumeInstrumentation(); 00046 00048 void dumpStat() const; 00049 00051 bool doEvent() const { return m_doEvent;} 00052 00054 bool active() const { return m_active>0;} 00055 00056 00057 // ---- Service Interface: to be called only by the Framework ---- 00058 00059 void preSourceI() { 00060 fullEvent(); 00061 } 00062 00063 void beginEventI(const edm::EventID&, const edm::Timestamp&) { 00064 beginEvent(); 00065 } 00066 00067 void endEventI(const edm::Event&, const edm::EventSetup&) { 00068 endEvent(); 00069 } 00070 void beginPathI(std::string const & path) { 00071 beginPath(path); 00072 } 00073 void endPathI(std::string const & path, const edm::HLTPathStatus&) { 00074 endPath(path); 00075 } 00076 00077 private: 00078 00079 void fullEvent(); 00080 00081 void beginEvent(); 00082 void endEvent(); 00083 00084 void beginPath(std::string const & path); 00085 void endPath(std::string const & path); 00086 00087 void newEvent(); 00088 00089 // configurable 00090 int m_firstEvent; 00091 int m_lastEvent; 00092 int m_dumpInterval; 00093 std::vector<std::string> m_paths; 00094 std::vector<std::string> m_excludedPaths; 00095 bool m_allPaths; 00096 00097 // internal state 00098 int m_evtCount; 00099 int m_counts; 00100 bool m_doEvent; 00101 int m_active; 00102 bool m_paused; 00103 std::string m_activePath; 00104 00105 }; 00106 00107 #endif // ProfilerService_H