File indexing completed on 2024-04-06 12:18:45
0001 #ifndef ThroughputService_h
0002 #define ThroughputService_h
0003
0004
0005 #include <atomic>
0006 #include <chrono>
0007 #include <functional>
0008 #include <string>
0009
0010
0011 #include <oneapi/tbb/concurrent_vector.h>
0012
0013
0014 #include <TH1F.h>
0015
0016
0017 #include "DataFormats/Provenance/interface/EventID.h"
0018 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0019 #include "DataFormats/Provenance/interface/RunLumiEventNumber.h"
0020 #include "DataFormats/Provenance/interface/Timestamp.h"
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0025 #include "FWCore/ServiceRegistry/interface/GlobalContext.h"
0026 #include "FWCore/ServiceRegistry/interface/Service.h"
0027 #include "FWCore/ServiceRegistry/interface/StreamContext.h"
0028 #include "FWCore/ServiceRegistry/interface/SystemBounds.h"
0029
0030 class ThroughputService {
0031 public:
0032 typedef dqm::reco::DQMStore DQMStore;
0033
0034 ThroughputService(const edm::ParameterSet&, edm::ActivityRegistry&);
0035 ~ThroughputService() = default;
0036
0037 private:
0038 void preallocate(edm::service::SystemBounds const& bounds);
0039 void preGlobalBeginRun(edm::GlobalContext const& gc);
0040 void preSourceEvent(edm::StreamID sid);
0041 void postEvent(edm::StreamContext const& sc);
0042 void postEndJob();
0043
0044 public:
0045 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0046
0047 private:
0048 dqm::reco::MonitorElement* m_sourced_events = nullptr;
0049 dqm::reco::MonitorElement* m_retired_events = nullptr;
0050
0051 std::chrono::system_clock::time_point m_startup;
0052
0053
0054 const uint32_t m_resolution;
0055 std::atomic<uint32_t> m_counter;
0056 tbb::concurrent_vector<std::chrono::system_clock::time_point> m_events;
0057 bool m_print_event_summary;
0058
0059
0060 bool m_enable_dqm;
0061 const bool m_dqm_bynproc;
0062 std::string m_dqm_path;
0063 const double m_time_range;
0064 const double m_time_resolution;
0065 };
0066
0067 #endif