CMS 3D CMS Logo

ProfilerService.h
Go to the documentation of this file.
1 #ifndef ProfilerService_H
2 #define ProfilerService_H
3 
4 
5 //FIXME only forward declarations???
9 
10 #include <vector>
11 #include <string>
12 
13 // Unit test for ProfilerService
14 namespace test {
15  class TestProfilerService;
16  struct CheckPaths;
17 }
18 
25  // For tests
26  friend class test::TestProfilerService;
27  friend struct test::CheckPaths;
28 
29 public:
30 
33  edm::ActivityRegistry& activity);
34 
36  ~ProfilerService();
37 
38 
39  // ---- Public Interface -----
40 
41 
43  bool startInstrumentation();
44 
46  bool stopInstrumentation();
47 
49  bool forceStopInstrumentation();
50 
51  // pause instrumentation (if active)
52  bool pauseInstrumentation();
53 
54  // resume instrumentation (if paused)
55  bool resumeInstrumentation();
56 
58  void dumpStat() const;
59 
61  bool doEvent() const { return m_doEvent;}
62 
64  bool active() const { return m_active>0;}
65 
66 
67  // ---- Service Interface: to be called only by the Framework ----
68 
70  fullEvent();
71  }
72 
73  void beginEventI(edm::StreamContext const& stream) {
74  beginEvent();
75  }
76 
77  void endEventI(edm::StreamContext const& stream) {
78  endEvent();
79  }
80  void beginPathI(edm::StreamContext const& stream, edm::PathContext const& path) {
81  beginPath(path.pathName());
82  }
83  void endPathI(edm::StreamContext const& stream, edm::PathContext const& path, edm::HLTPathStatus const&) {
84  endPath(path.pathName());
85  }
86 
87 private:
88 
89  void fullEvent();
90 
91  void beginEvent();
92  void endEvent();
93 
94  void beginPath(std::string const& path);
95  void endPath(std::string const& path);
96 
97  void newEvent();
98 
99  // configurable
103  std::vector<std::string> m_paths;
104  std::vector<std::string> m_excludedPaths;
106 
107  // internal state
109  int m_counts;
110  bool m_doEvent;
111  int m_active;
112  bool m_paused;
114 
115 };
116 
117 #endif // ProfilerService_H
std::string const & pathName() const
Definition: PathContext.h:30
bool active() const
true if instrumentation is active
std::vector< std::string > m_excludedPaths
void endPathI(edm::StreamContext const &stream, edm::PathContext const &path, edm::HLTPathStatus const &)
std::vector< std::string > m_paths
std::string m_activePath
void preSourceI(edm::StreamID)
void endEventI(edm::StreamContext const &stream)
void beginPathI(edm::StreamContext const &stream, edm::PathContext const &path)
bool doEvent() const
true if the current event has to be instrumented
void beginEventI(edm::StreamContext const &stream)