File indexing completed on 2023-03-17 11:15:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0027
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029
0030 #include "FWCore/ServiceRegistry/interface/Service.h"
0031 #include "PerfTools/Callgrind/interface/ProfilerService.h"
0032
0033
0034
0035
0036 class ProfilerAnalyzer : public edm::one::EDAnalyzer<> {
0037 public:
0038 explicit ProfilerAnalyzer(const edm::ParameterSet&);
0039 ~ProfilerAnalyzer() override;
0040
0041 private:
0042 void beginJob() override;
0043 void analyze(const edm::Event&, const edm::EventSetup&) override = 0;
0044 void endJob() override;
0045 };
0046
0047 class StartProfilerAnalyzer : public ProfilerAnalyzer {
0048 public:
0049 explicit StartProfilerAnalyzer(const edm::ParameterSet& pset) : ProfilerAnalyzer(pset) {}
0050 ~StartProfilerAnalyzer() override {}
0051
0052 private:
0053 void analyze(const edm::Event&, const edm::EventSetup&) override;
0054 };
0055
0056 class StopProfilerAnalyzer : public ProfilerAnalyzer {
0057 public:
0058 explicit StopProfilerAnalyzer(const edm::ParameterSet& pset) : ProfilerAnalyzer(pset) {}
0059 ~StopProfilerAnalyzer() override {}
0060
0061 private:
0062 void analyze(const edm::Event&, const edm::EventSetup&) override;
0063 };
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 ProfilerAnalyzer::ProfilerAnalyzer(const edm::ParameterSet&) {}
0077
0078 ProfilerAnalyzer::~ProfilerAnalyzer() {
0079
0080
0081 }
0082
0083
0084
0085
0086
0087
0088 void StartProfilerAnalyzer::analyze(const edm::Event&, const edm::EventSetup&) {
0089 edm::Service<ProfilerService>()->startInstrumentation();
0090 }
0091 void StopProfilerAnalyzer::analyze(const edm::Event&, const edm::EventSetup&) {
0092 edm::Service<ProfilerService>()->stopInstrumentation();
0093 }
0094
0095
0096 void ProfilerAnalyzer::beginJob() {}
0097
0098
0099 void ProfilerAnalyzer::endJob() {}
0100
0101
0102 DEFINE_FWK_MODULE(StartProfilerAnalyzer);
0103 DEFINE_FWK_MODULE(StopProfilerAnalyzer);