CMS 3D CMS Logo

ProfilerService.h
Go to the documentation of this file.
1 #ifndef ProfilerService_H
2 #define ProfilerService_H
3 
4 //FIXME only forward declarations???
8 
9 #include <vector>
10 #include <string>
11 
12 // Unit test for ProfilerService
13 namespace test {
14  class TestProfilerService;
15  struct CheckPaths;
16 } // namespace test
17 
24  // For tests
25  friend class test::TestProfilerService;
26  friend struct test::CheckPaths;
27 
28 public:
31 
33  ~ProfilerService();
34 
35  // ---- Public Interface -----
36 
38  bool startInstrumentation();
39 
41  bool stopInstrumentation();
42 
44  bool forceStopInstrumentation();
45 
46  // pause instrumentation (if active)
47  bool pauseInstrumentation();
48 
49  // resume instrumentation (if paused)
50  bool resumeInstrumentation();
51 
53  void dumpStat() const;
54 
56  bool doEvent() const { return m_doEvent; }
57 
59  bool active() const { return m_active > 0; }
60 
61  // ---- Service Interface: to be called only by the Framework ----
62 
63  void preSourceI(edm::StreamID) { fullEvent(); }
64 
65  void beginEventI(edm::StreamContext const& stream) { beginEvent(); }
66 
67  void endEventI(edm::StreamContext const& stream) { endEvent(); }
68  void beginPathI(edm::StreamContext const& stream, edm::PathContext const& path) { beginPath(path.pathName()); }
69  void endPathI(edm::StreamContext const& stream, edm::PathContext const& path, edm::HLTPathStatus const&) {
70  endPath(path.pathName());
71  }
72 
73 private:
74  void fullEvent();
75 
76  void beginEvent();
77  void endEvent();
78 
79  void beginPath(std::string const& path);
80  void endPath(std::string const& path);
81 
82  void newEvent();
83 
84  // configurable
88  std::vector<std::string> m_paths;
89  std::vector<std::string> m_excludedPaths;
90  bool m_allPaths;
91 
92  // internal state
94  int m_counts;
95  bool m_doEvent;
96  int m_active;
97  bool m_paused;
99 };
100 
101 #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)