CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
27  friend struct test::CheckPaths;
28 
29 public:
30 
33  edm::ActivityRegistry& activity);
34 
37 
38 
39  // ---- Public Interface -----
40 
41 
43  bool startInstrumentation();
44 
46  bool stopInstrumentation();
47 
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:37
bool active() const
true if instrumentation is active
std::vector< std::string > m_excludedPaths
bool resumeInstrumentation()
void endPathI(edm::StreamContext const &stream, edm::PathContext const &path, edm::HLTPathStatus const &)
std::vector< std::string > m_paths
void beginPath(std::string const &path)
friend class test::TestProfilerService
void endPath(std::string const &path)
std::string m_activePath
~ProfilerService()
Destructor.
bool stopInstrumentation()
stop instrumentation if not active anymore; true if stopped now
void preSourceI(edm::StreamID)
bool forceStopInstrumentation()
forced stop instrumentation independenly of activity status; true if stopped now
bool pauseInstrumentation()
bool startInstrumentation()
start instrumentation if not active. true if started now
void endEventI(edm::StreamContext const &stream)
friend struct test::CheckPaths
void dumpStat() const
dump profiling information
void beginPathI(edm::StreamContext const &stream, edm::PathContext const &path)
ProfilerService(edm::ParameterSet const &pset, edm::ActivityRegistry &activity)
Standard Service Constructor.
bool doEvent() const
true if the current event has to be instrumented
void beginEventI(edm::StreamContext const &stream)