Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-04 04:34:58

0001 // -*- C++ -*-
0002 #ifndef FWCore_Integration_TestServiceTwo_h
0003 #define FWCore_Integration_TestServiceTwo_h
0004 //
0005 // Package:     FWCore/Integration
0006 // Class  :     TestServiceTwo
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 //     This is almost identical to TestServiceOne. It was initially used to
0015 //     test that after a signal all services get executed even if one of the
0016 //     service functions throws.
0017 //
0018 //
0019 // Original Author:  W. David Dagenhart
0020 //         Created:  13 March 2024
0021 
0022 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 #include "FWCore/ServiceRegistry/interface/ServiceRegistryfwd.h"
0025 
0026 #include <atomic>
0027 
0028 namespace edmtest {
0029 
0030   class TestServiceTwo {
0031   public:
0032     TestServiceTwo(const edm::ParameterSet&, edm::ActivityRegistry&);
0033 
0034     static void fillDescriptions(edm::ConfigurationDescriptions&);
0035 
0036     void preBeginProcessBlock(edm::GlobalContext const&);
0037     void preEndProcessBlock(edm::GlobalContext const&);
0038 
0039     void preStreamBeginLumi(edm::StreamContext const&);
0040     void postStreamBeginLumi(edm::StreamContext const&);
0041     void preStreamEndLumi(edm::StreamContext const&);
0042     void postStreamEndLumi(edm::StreamContext const&);
0043 
0044     void preModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0045     void postModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0046     void preModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0047     void postModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
0048 
0049     void preGlobalBeginLumi(edm::GlobalContext const&);
0050     void postGlobalBeginLumi(edm::GlobalContext const&);
0051     void preGlobalEndLumi(edm::GlobalContext const&);
0052     void postGlobalEndLumi(edm::GlobalContext const&);
0053 
0054     void preModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0055     void postModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0056     void preModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0057     void postModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0058 
0059     void preGlobalWriteLumi(edm::GlobalContext const&);
0060     void postGlobalWriteLumi(edm::GlobalContext const&);
0061 
0062     void preStreamBeginRun(edm::StreamContext const&);
0063     void postStreamBeginRun(edm::StreamContext const&);
0064     void preStreamEndRun(edm::StreamContext const&);
0065     void postStreamEndRun(edm::StreamContext const&);
0066 
0067     void preModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0068     void postModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0069     void preModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0070     void postModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
0071 
0072     void preGlobalBeginRun(edm::GlobalContext const&);
0073     void postGlobalBeginRun(edm::GlobalContext const&);
0074     void preGlobalEndRun(edm::GlobalContext const&);
0075     void postGlobalEndRun(edm::GlobalContext const&);
0076 
0077     void preModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0078     void postModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0079     void preModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0080     void postModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
0081 
0082     void preGlobalWriteRun(edm::GlobalContext const&);
0083     void postGlobalWriteRun(edm::GlobalContext const&);
0084 
0085     unsigned int nPreStreamBeginLumi() const;
0086     unsigned int nPostStreamBeginLumi() const;
0087     unsigned int nPreStreamEndLumi() const;
0088     unsigned int nPostStreamEndLumi() const;
0089 
0090     unsigned int nPreModuleStreamBeginLumi() const;
0091     unsigned int nPostModuleStreamBeginLumi() const;
0092     unsigned int nPreModuleStreamEndLumi() const;
0093     unsigned int nPostModuleStreamEndLumi() const;
0094 
0095     unsigned int nPreGlobalBeginLumi() const;
0096     unsigned int nPostGlobalBeginLumi() const;
0097     unsigned int nPreGlobalEndLumi() const;
0098     unsigned int nPostGlobalEndLumi() const;
0099 
0100     unsigned int nPreModuleGlobalBeginLumi() const;
0101     unsigned int nPostModuleGlobalBeginLumi() const;
0102     unsigned int nPreModuleGlobalEndLumi() const;
0103     unsigned int nPostModuleGlobalEndLumi() const;
0104 
0105     unsigned int nPreGlobalWriteLumi() const;
0106     unsigned int nPostGlobalWriteLumi() const;
0107 
0108     unsigned int nPreStreamBeginRun() const;
0109     unsigned int nPostStreamBeginRun() const;
0110     unsigned int nPreStreamEndRun() const;
0111     unsigned int nPostStreamEndRun() const;
0112 
0113     unsigned int nPreModuleStreamBeginRun() const;
0114     unsigned int nPostModuleStreamBeginRun() const;
0115     unsigned int nPreModuleStreamEndRun() const;
0116     unsigned int nPostModuleStreamEndRun() const;
0117 
0118     unsigned int nPreGlobalBeginRun() const;
0119     unsigned int nPostGlobalBeginRun() const;
0120     unsigned int nPreGlobalEndRun() const;
0121     unsigned int nPostGlobalEndRun() const;
0122 
0123     unsigned int nPreModuleGlobalBeginRun() const;
0124     unsigned int nPostModuleGlobalBeginRun() const;
0125     unsigned int nPreModuleGlobalEndRun() const;
0126     unsigned int nPostModuleGlobalEndRun() const;
0127 
0128     unsigned int nPreGlobalWriteRun() const;
0129     unsigned int nPostGlobalWriteRun() const;
0130 
0131   private:
0132     bool verbose_;
0133     bool printTimestamps_;
0134 
0135     std::atomic<unsigned int> nPreStreamBeginLumi_ = 0;
0136     std::atomic<unsigned int> nPostStreamBeginLumi_ = 0;
0137     std::atomic<unsigned int> nPreStreamEndLumi_ = 0;
0138     std::atomic<unsigned int> nPostStreamEndLumi_ = 0;
0139 
0140     std::atomic<unsigned int> nPreModuleStreamBeginLumi_ = 0;
0141     std::atomic<unsigned int> nPostModuleStreamBeginLumi_ = 0;
0142     std::atomic<unsigned int> nPreModuleStreamEndLumi_ = 0;
0143     std::atomic<unsigned int> nPostModuleStreamEndLumi_ = 0;
0144 
0145     std::atomic<unsigned int> nPreGlobalBeginLumi_ = 0;
0146     std::atomic<unsigned int> nPostGlobalBeginLumi_ = 0;
0147     std::atomic<unsigned int> nPreGlobalEndLumi_ = 0;
0148     std::atomic<unsigned int> nPostGlobalEndLumi_ = 0;
0149 
0150     std::atomic<unsigned int> nPreModuleGlobalBeginLumi_ = 0;
0151     std::atomic<unsigned int> nPostModuleGlobalBeginLumi_ = 0;
0152     std::atomic<unsigned int> nPreModuleGlobalEndLumi_ = 0;
0153     std::atomic<unsigned int> nPostModuleGlobalEndLumi_ = 0;
0154 
0155     std::atomic<unsigned int> nPreGlobalWriteLumi_ = 0;
0156     std::atomic<unsigned int> nPostGlobalWriteLumi_ = 0;
0157 
0158     std::atomic<unsigned int> nPreStreamBeginRun_ = 0;
0159     std::atomic<unsigned int> nPostStreamBeginRun_ = 0;
0160     std::atomic<unsigned int> nPreStreamEndRun_ = 0;
0161     std::atomic<unsigned int> nPostStreamEndRun_ = 0;
0162 
0163     std::atomic<unsigned int> nPreModuleStreamBeginRun_ = 0;
0164     std::atomic<unsigned int> nPostModuleStreamBeginRun_ = 0;
0165     std::atomic<unsigned int> nPreModuleStreamEndRun_ = 0;
0166     std::atomic<unsigned int> nPostModuleStreamEndRun_ = 0;
0167 
0168     std::atomic<unsigned int> nPreGlobalBeginRun_ = 0;
0169     std::atomic<unsigned int> nPostGlobalBeginRun_ = 0;
0170     std::atomic<unsigned int> nPreGlobalEndRun_ = 0;
0171     std::atomic<unsigned int> nPostGlobalEndRun_ = 0;
0172 
0173     std::atomic<unsigned int> nPreModuleGlobalBeginRun_ = 0;
0174     std::atomic<unsigned int> nPostModuleGlobalBeginRun_ = 0;
0175     std::atomic<unsigned int> nPreModuleGlobalEndRun_ = 0;
0176     std::atomic<unsigned int> nPostModuleGlobalEndRun_ = 0;
0177 
0178     std::atomic<unsigned int> nPreGlobalWriteRun_ = 0;
0179     std::atomic<unsigned int> nPostGlobalWriteRun_ = 0;
0180   };
0181 }  // namespace edmtest
0182 #endif