Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-28 22:48:27

0001 // -*- C++ -*-
0002 #ifndef FWCore_Integration_TestServiceOne_h
0003 #define FWCore_Integration_TestServiceOne_h
0004 //
0005 // Package:     FWCore/Integration
0006 // Class  :     TestServiceOne
0007 //
0008 // Implementation:
0009 //     Service initially intended for testing behavior after exceptions.
0010 //     ExceptionThrowingProducer uses this and is in the same test plugin
0011 //     library and could be used to access the service if it was ever useful
0012 //     for debugging issues related to begin/end transitions.
0013 //
0014 // Original Author:  W. David Dagenhart
0015 //         Created:  13 March 2024
0016 
0017 #include "DataFormats/Provenance/interface/ProvenanceFwd.h"
0018 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 #include "FWCore/ServiceRegistry/interface/ServiceRegistryfwd.h"
0021 
0022 #include <atomic>
0023 
0024 namespace edmtest {
0025 
0026   class TestServiceOne {
0027   public:
0028     TestServiceOne(const edm::ParameterSet&, edm::ActivityRegistry&);
0029 
0030     static void fillDescriptions(edm::ConfigurationDescriptions&);
0031 
0032     void preBeginJob(edm::PathsAndConsumesOfModulesBase const&, edm::ProcessContext const&);
0033     void postBeginJob();
0034     void preEndJob();
0035     void postEndJob();
0036 
0037     void preModuleBeginJob(edm::ModuleDescription const&);
0038     void postModuleBeginJob(edm::ModuleDescription const&);
0039     void preModuleEndJob(edm::ModuleDescription const&);
0040     void postModuleEndJob(edm::ModuleDescription const&);
0041 
0042     void preBeginStream(edm::StreamContext const&);
0043     void postBeginStream(edm::StreamContext const&);
0044     void preEndStream(edm::StreamContext const&);
0045     void postEndStream(edm::StreamContext const&);
0046 
0047     void preModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
0048     void postModuleBeginStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
0049     void preModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
0050     void postModuleEndStream(edm::StreamContext const&, edm::ModuleCallingContext const&);
0051 
0052     void preBeginProcessBlock(edm::GlobalContext const&);
0053     void postBeginProcessBlock(edm::GlobalContext const&);
0054     void preEndProcessBlock(edm::GlobalContext const&);
0055     void postEndProcessBlock(edm::GlobalContext const&);
0056 
0057     void preModuleBeginProcessBlock(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0058     void postModuleBeginProcessBlock(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0059     void preModuleEndProcessBlock(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0060     void postModuleEndProcessBlock(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0061 
0062     void preStreamBeginLumi(edm::StreamContext const&);
0063     void postStreamBeginLumi(edm::StreamContext const&);
0064     void preStreamEndLumi(edm::StreamContext const&);
0065     void postStreamEndLumi(edm::StreamContext const&);
0066 
0067     void preModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0068     void postModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0069     void preModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0070     void postModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0071 
0072     void preGlobalBeginLumi(edm::GlobalContext const&);
0073     void postGlobalBeginLumi(edm::GlobalContext const&);
0074     void preGlobalEndLumi(edm::GlobalContext const&);
0075     void postGlobalEndLumi(edm::GlobalContext const&);
0076 
0077     void preModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0078     void postModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0079     void preModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0080     void postModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0081 
0082     void preGlobalWriteLumi(edm::GlobalContext const&);
0083     void postGlobalWriteLumi(edm::GlobalContext const&);
0084 
0085     void preStreamBeginRun(edm::StreamContext const&);
0086     void postStreamBeginRun(edm::StreamContext const&);
0087     void preStreamEndRun(edm::StreamContext const&);
0088     void postStreamEndRun(edm::StreamContext const&);
0089 
0090     void preModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0091     void postModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0092     void preModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0093     void postModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0094 
0095     void preGlobalBeginRun(edm::GlobalContext const&);
0096     void postGlobalBeginRun(edm::GlobalContext const&);
0097     void preGlobalEndRun(edm::GlobalContext const&);
0098     void postGlobalEndRun(edm::GlobalContext const&);
0099 
0100     void preModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0101     void postModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0102     void preModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0103     void postModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0104 
0105     void preGlobalWriteRun(edm::GlobalContext const&);
0106     void postGlobalWriteRun(edm::GlobalContext const&);
0107 
0108     unsigned int nPreBeginJob() const;
0109     unsigned int nPostBeginJob() const;
0110     unsigned int nPreEndJob() const;
0111     unsigned int nPostEndJob() const;
0112 
0113     unsigned int nPreModuleBeginJob() const;
0114     unsigned int nPostModuleBeginJob() const;
0115     unsigned int nPreModuleEndJob() const;
0116     unsigned int nPostModuleEndJob() const;
0117 
0118     unsigned int nPreBeginStream() const;
0119     unsigned int nPostBeginStream() const;
0120     unsigned int nPreEndStream() const;
0121     unsigned int nPostEndStream() const;
0122 
0123     unsigned int nPreModuleBeginStream() const;
0124     unsigned int nPostModuleBeginStream() const;
0125     unsigned int nPreModuleEndStream() const;
0126     unsigned int nPostModuleEndStream() const;
0127 
0128     unsigned int nPreBeginProcessBlock() const;
0129     unsigned int nPostBeginProcessBlock() const;
0130     unsigned int nPreEndProcessBlock() const;
0131     unsigned int nPostEndProcessBlock() const;
0132 
0133     unsigned int nPreModuleBeginProcessBlock() const;
0134     unsigned int nPostModuleBeginProcessBlock() const;
0135     unsigned int nPreModuleEndProcessBlock() const;
0136     unsigned int nPostModuleEndProcessBlock() const;
0137 
0138     unsigned int nPreStreamBeginLumi() const;
0139     unsigned int nPostStreamBeginLumi() const;
0140     unsigned int nPreStreamEndLumi() const;
0141     unsigned int nPostStreamEndLumi() const;
0142 
0143     unsigned int nPreModuleStreamBeginLumi() const;
0144     unsigned int nPostModuleStreamBeginLumi() const;
0145     unsigned int nPreModuleStreamEndLumi() const;
0146     unsigned int nPostModuleStreamEndLumi() const;
0147 
0148     unsigned int nPreGlobalBeginLumi() const;
0149     unsigned int nPostGlobalBeginLumi() const;
0150     unsigned int nPreGlobalEndLumi() const;
0151     unsigned int nPostGlobalEndLumi() const;
0152 
0153     unsigned int nPreModuleGlobalBeginLumi() const;
0154     unsigned int nPostModuleGlobalBeginLumi() const;
0155     unsigned int nPreModuleGlobalEndLumi() const;
0156     unsigned int nPostModuleGlobalEndLumi() const;
0157 
0158     unsigned int nPreGlobalWriteLumi() const;
0159     unsigned int nPostGlobalWriteLumi() const;
0160 
0161     unsigned int nPreStreamBeginRun() const;
0162     unsigned int nPostStreamBeginRun() const;
0163     unsigned int nPreStreamEndRun() const;
0164     unsigned int nPostStreamEndRun() const;
0165 
0166     unsigned int nPreModuleStreamBeginRun() const;
0167     unsigned int nPostModuleStreamBeginRun() const;
0168     unsigned int nPreModuleStreamEndRun() const;
0169     unsigned int nPostModuleStreamEndRun() const;
0170 
0171     unsigned int nPreGlobalBeginRun() const;
0172     unsigned int nPostGlobalBeginRun() const;
0173     unsigned int nPreGlobalEndRun() const;
0174     unsigned int nPostGlobalEndRun() const;
0175 
0176     unsigned int nPreModuleGlobalBeginRun() const;
0177     unsigned int nPostModuleGlobalBeginRun() const;
0178     unsigned int nPreModuleGlobalEndRun() const;
0179     unsigned int nPostModuleGlobalEndRun() const;
0180 
0181     unsigned int nPreGlobalWriteRun() const;
0182     unsigned int nPostGlobalWriteRun() const;
0183 
0184   private:
0185     bool verbose_;
0186     bool printTimestamps_;
0187 
0188     std::atomic<unsigned int> nPreBeginJob_ = 0;
0189     std::atomic<unsigned int> nPostBeginJob_ = 0;
0190     std::atomic<unsigned int> nPreEndJob_ = 0;
0191     std::atomic<unsigned int> nPostEndJob_ = 0;
0192 
0193     std::atomic<unsigned int> nPreModuleBeginJob_ = 0;
0194     std::atomic<unsigned int> nPostModuleBeginJob_ = 0;
0195     std::atomic<unsigned int> nPreModuleEndJob_ = 0;
0196     std::atomic<unsigned int> nPostModuleEndJob_ = 0;
0197 
0198     std::atomic<unsigned int> nPreBeginStream_ = 0;
0199     std::atomic<unsigned int> nPostBeginStream_ = 0;
0200     std::atomic<unsigned int> nPreEndStream_ = 0;
0201     std::atomic<unsigned int> nPostEndStream_ = 0;
0202 
0203     std::atomic<unsigned int> nPreModuleBeginStream_ = 0;
0204     std::atomic<unsigned int> nPostModuleBeginStream_ = 0;
0205     std::atomic<unsigned int> nPreModuleEndStream_ = 0;
0206     std::atomic<unsigned int> nPostModuleEndStream_ = 0;
0207 
0208     std::atomic<unsigned int> nPreBeginProcessBlock_ = 0;
0209     std::atomic<unsigned int> nPostBeginProcessBlock_ = 0;
0210     std::atomic<unsigned int> nPreEndProcessBlock_ = 0;
0211     std::atomic<unsigned int> nPostEndProcessBlock_ = 0;
0212 
0213     std::atomic<unsigned int> nPreModuleBeginProcessBlock_ = 0;
0214     std::atomic<unsigned int> nPostModuleBeginProcessBlock_ = 0;
0215     std::atomic<unsigned int> nPreModuleEndProcessBlock_ = 0;
0216     std::atomic<unsigned int> nPostModuleEndProcessBlock_ = 0;
0217 
0218     std::atomic<unsigned int> nPreStreamBeginLumi_ = 0;
0219     std::atomic<unsigned int> nPostStreamBeginLumi_ = 0;
0220     std::atomic<unsigned int> nPreStreamEndLumi_ = 0;
0221     std::atomic<unsigned int> nPostStreamEndLumi_ = 0;
0222 
0223     std::atomic<unsigned int> nPreModuleStreamBeginLumi_ = 0;
0224     std::atomic<unsigned int> nPostModuleStreamBeginLumi_ = 0;
0225     std::atomic<unsigned int> nPreModuleStreamEndLumi_ = 0;
0226     std::atomic<unsigned int> nPostModuleStreamEndLumi_ = 0;
0227 
0228     std::atomic<unsigned int> nPreGlobalBeginLumi_ = 0;
0229     std::atomic<unsigned int> nPostGlobalBeginLumi_ = 0;
0230     std::atomic<unsigned int> nPreGlobalEndLumi_ = 0;
0231     std::atomic<unsigned int> nPostGlobalEndLumi_ = 0;
0232 
0233     std::atomic<unsigned int> nPreModuleGlobalBeginLumi_ = 0;
0234     std::atomic<unsigned int> nPostModuleGlobalBeginLumi_ = 0;
0235     std::atomic<unsigned int> nPreModuleGlobalEndLumi_ = 0;
0236     std::atomic<unsigned int> nPostModuleGlobalEndLumi_ = 0;
0237 
0238     std::atomic<unsigned int> nPreGlobalWriteLumi_ = 0;
0239     std::atomic<unsigned int> nPostGlobalWriteLumi_ = 0;
0240 
0241     std::atomic<unsigned int> nPreStreamBeginRun_ = 0;
0242     std::atomic<unsigned int> nPostStreamBeginRun_ = 0;
0243     std::atomic<unsigned int> nPreStreamEndRun_ = 0;
0244     std::atomic<unsigned int> nPostStreamEndRun_ = 0;
0245 
0246     std::atomic<unsigned int> nPreModuleStreamBeginRun_ = 0;
0247     std::atomic<unsigned int> nPostModuleStreamBeginRun_ = 0;
0248     std::atomic<unsigned int> nPreModuleStreamEndRun_ = 0;
0249     std::atomic<unsigned int> nPostModuleStreamEndRun_ = 0;
0250 
0251     std::atomic<unsigned int> nPreGlobalBeginRun_ = 0;
0252     std::atomic<unsigned int> nPostGlobalBeginRun_ = 0;
0253     std::atomic<unsigned int> nPreGlobalEndRun_ = 0;
0254     std::atomic<unsigned int> nPostGlobalEndRun_ = 0;
0255 
0256     std::atomic<unsigned int> nPreModuleGlobalBeginRun_ = 0;
0257     std::atomic<unsigned int> nPostModuleGlobalBeginRun_ = 0;
0258     std::atomic<unsigned int> nPreModuleGlobalEndRun_ = 0;
0259     std::atomic<unsigned int> nPostModuleGlobalEndRun_ = 0;
0260 
0261     std::atomic<unsigned int> nPreGlobalWriteRun_ = 0;
0262     std::atomic<unsigned int> nPostGlobalWriteRun_ = 0;
0263   };
0264 }  // namespace edmtest
0265 #endif