TestServiceTwo

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
// -*- C++ -*-
#ifndef FWCore_Integration_TestServiceTwo_h
#define FWCore_Integration_TestServiceTwo_h
//
// Package:     FWCore/Integration
// Class  :     TestServiceTwo
//
// Implementation:
//     Service initially intended for testing behavior after exceptions.
//     ExceptionThrowingProducer uses this and is in the same test plugin
//     library and could be used to access the service if it was ever useful
//     for debugging issues related to begin/end transitions.
//
//     This is almost identical to TestServiceOne. It was initially used to
//     test that after a signal all services get executed even if one of the
//     service functions throws.
//
//
// Original Author:  W. David Dagenhart
//         Created:  13 March 2024

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/ServiceRegistryfwd.h"

#include <atomic>

namespace edmtest {

  class TestServiceTwo {
  public:
    TestServiceTwo(const edm::ParameterSet&, edm::ActivityRegistry&);

    static void fillDescriptions(edm::ConfigurationDescriptions&);

    void preBeginProcessBlock(edm::GlobalContext const&);
    void preEndProcessBlock(edm::GlobalContext const&);

    void preStreamBeginLumi(edm::StreamContext const&);
    void postStreamBeginLumi(edm::StreamContext const&);
    void preStreamEndLumi(edm::StreamContext const&);
    void postStreamEndLumi(edm::StreamContext const&);

    void preModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
    void postModuleStreamBeginLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
    void preModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);
    void postModuleStreamEndLumi(edm::StreamContext const&, edm::ModuleCallingContext const&);

    void preGlobalBeginLumi(edm::GlobalContext const&);
    void postGlobalBeginLumi(edm::GlobalContext const&);
    void preGlobalEndLumi(edm::GlobalContext const&);
    void postGlobalEndLumi(edm::GlobalContext const&);

    void preModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
    void postModuleGlobalBeginLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
    void preModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);
    void postModuleGlobalEndLumi(edm::GlobalContext const&, edm::ModuleCallingContext const&);

    void preGlobalWriteLumi(edm::GlobalContext const&);
    void postGlobalWriteLumi(edm::GlobalContext const&);

    void preStreamBeginRun(edm::StreamContext const&);
    void postStreamBeginRun(edm::StreamContext const&);
    void preStreamEndRun(edm::StreamContext const&);
    void postStreamEndRun(edm::StreamContext const&);

    void preModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
    void postModuleStreamBeginRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
    void preModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);
    void postModuleStreamEndRun(edm::StreamContext const&, edm::ModuleCallingContext const&);

    void preGlobalBeginRun(edm::GlobalContext const&);
    void postGlobalBeginRun(edm::GlobalContext const&);
    void preGlobalEndRun(edm::GlobalContext const&);
    void postGlobalEndRun(edm::GlobalContext const&);

    void preModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
    void postModuleGlobalBeginRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
    void preModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);
    void postModuleGlobalEndRun(edm::GlobalContext const&, edm::ModuleCallingContext const&);

    void preGlobalWriteRun(edm::GlobalContext const&);
    void postGlobalWriteRun(edm::GlobalContext const&);

    unsigned int nPreStreamBeginLumi() const;
    unsigned int nPostStreamBeginLumi() const;
    unsigned int nPreStreamEndLumi() const;
    unsigned int nPostStreamEndLumi() const;

    unsigned int nPreModuleStreamBeginLumi() const;
    unsigned int nPostModuleStreamBeginLumi() const;
    unsigned int nPreModuleStreamEndLumi() const;
    unsigned int nPostModuleStreamEndLumi() const;

    unsigned int nPreGlobalBeginLumi() const;
    unsigned int nPostGlobalBeginLumi() const;
    unsigned int nPreGlobalEndLumi() const;
    unsigned int nPostGlobalEndLumi() const;

    unsigned int nPreModuleGlobalBeginLumi() const;
    unsigned int nPostModuleGlobalBeginLumi() const;
    unsigned int nPreModuleGlobalEndLumi() const;
    unsigned int nPostModuleGlobalEndLumi() const;

    unsigned int nPreGlobalWriteLumi() const;
    unsigned int nPostGlobalWriteLumi() const;

    unsigned int nPreStreamBeginRun() const;
    unsigned int nPostStreamBeginRun() const;
    unsigned int nPreStreamEndRun() const;
    unsigned int nPostStreamEndRun() const;

    unsigned int nPreModuleStreamBeginRun() const;
    unsigned int nPostModuleStreamBeginRun() const;
    unsigned int nPreModuleStreamEndRun() const;
    unsigned int nPostModuleStreamEndRun() const;

    unsigned int nPreGlobalBeginRun() const;
    unsigned int nPostGlobalBeginRun() const;
    unsigned int nPreGlobalEndRun() const;
    unsigned int nPostGlobalEndRun() const;

    unsigned int nPreModuleGlobalBeginRun() const;
    unsigned int nPostModuleGlobalBeginRun() const;
    unsigned int nPreModuleGlobalEndRun() const;
    unsigned int nPostModuleGlobalEndRun() const;

    unsigned int nPreGlobalWriteRun() const;
    unsigned int nPostGlobalWriteRun() const;

  private:
    bool verbose_;
    bool printTimestamps_;

    std::atomic<unsigned int> nPreStreamBeginLumi_ = 0;
    std::atomic<unsigned int> nPostStreamBeginLumi_ = 0;
    std::atomic<unsigned int> nPreStreamEndLumi_ = 0;
    std::atomic<unsigned int> nPostStreamEndLumi_ = 0;

    std::atomic<unsigned int> nPreModuleStreamBeginLumi_ = 0;
    std::atomic<unsigned int> nPostModuleStreamBeginLumi_ = 0;
    std::atomic<unsigned int> nPreModuleStreamEndLumi_ = 0;
    std::atomic<unsigned int> nPostModuleStreamEndLumi_ = 0;

    std::atomic<unsigned int> nPreGlobalBeginLumi_ = 0;
    std::atomic<unsigned int> nPostGlobalBeginLumi_ = 0;
    std::atomic<unsigned int> nPreGlobalEndLumi_ = 0;
    std::atomic<unsigned int> nPostGlobalEndLumi_ = 0;

    std::atomic<unsigned int> nPreModuleGlobalBeginLumi_ = 0;
    std::atomic<unsigned int> nPostModuleGlobalBeginLumi_ = 0;
    std::atomic<unsigned int> nPreModuleGlobalEndLumi_ = 0;
    std::atomic<unsigned int> nPostModuleGlobalEndLumi_ = 0;

    std::atomic<unsigned int> nPreGlobalWriteLumi_ = 0;
    std::atomic<unsigned int> nPostGlobalWriteLumi_ = 0;

    std::atomic<unsigned int> nPreStreamBeginRun_ = 0;
    std::atomic<unsigned int> nPostStreamBeginRun_ = 0;
    std::atomic<unsigned int> nPreStreamEndRun_ = 0;
    std::atomic<unsigned int> nPostStreamEndRun_ = 0;

    std::atomic<unsigned int> nPreModuleStreamBeginRun_ = 0;
    std::atomic<unsigned int> nPostModuleStreamBeginRun_ = 0;
    std::atomic<unsigned int> nPreModuleStreamEndRun_ = 0;
    std::atomic<unsigned int> nPostModuleStreamEndRun_ = 0;

    std::atomic<unsigned int> nPreGlobalBeginRun_ = 0;
    std::atomic<unsigned int> nPostGlobalBeginRun_ = 0;
    std::atomic<unsigned int> nPreGlobalEndRun_ = 0;
    std::atomic<unsigned int> nPostGlobalEndRun_ = 0;

    std::atomic<unsigned int> nPreModuleGlobalBeginRun_ = 0;
    std::atomic<unsigned int> nPostModuleGlobalBeginRun_ = 0;
    std::atomic<unsigned int> nPreModuleGlobalEndRun_ = 0;
    std::atomic<unsigned int> nPostModuleGlobalEndRun_ = 0;

    std::atomic<unsigned int> nPreGlobalWriteRun_ = 0;
    std::atomic<unsigned int> nPostGlobalWriteRun_ = 0;
  };
}  // namespace edmtest
#endif