7 #include <fmt/printf.h> 21 desc.addUntracked<uint32_t>(
"eventRange", 10000)->setComment(
"Preallocate a buffer for N events");
22 desc.addUntracked<uint32_t>(
"eventResolution", 1)->setComment(
"Sample the processing time every N events");
23 desc.addUntracked<
bool>(
"printEventSummary",
false);
32 descriptions.
add(
"ThroughputService",
desc);
37 m_startup(
std::chrono::system_clock::
now()),
39 m_resolution(
config.getUntrackedParameter<uint32_t>(
"eventResolution")),
41 m_events(
config.getUntrackedParameter<uint32_t>(
"eventRange") / m_resolution),
42 m_print_event_summary(
config.getUntrackedParameter<
bool>(
"printEventSummary")),
43 m_enable_dqm(
config.getUntrackedParameter<
bool>(
"enableDQM")),
44 m_dqm_bynproc(m_enable_dqm ?
config.getUntrackedParameter<
bool>(
"dqmPathByProcesses") :
false),
45 m_dqm_path(m_enable_dqm ?
config.getUntrackedParameter<
std::
string>(
"dqmPath") :
""),
46 m_time_range(m_enable_dqm ?
config.getUntrackedParameter<double>(
"timeRange") : 0.),
47 m_time_resolution(m_enable_dqm ?
config.getUntrackedParameter<double>(
"timeResolution") : 0.) {
57 auto concurrent_streams =
bounds.maxNumberOfStreams();
58 auto concurrent_threads =
bounds.maxNumberOfThreads();
62 "/Running on %s with %d streams on %d threads",
processor_model, concurrent_streams, concurrent_threads);
71 edm::LogWarning(
"ThroughputService") <<
"The DQMStore is not avalable, the DQM plots will not be generated";
81 auto safe_for_dqm =
"/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# "s;
83 if (safe_for_dqm.find(
c) == std::string::npos)
129 edm::LogWarning(
"ThroughputService") <<
"Not enough events to measure the throughput with a resolution of " 154 double throughput_avg = double(
m_resolution) / time_avg;
155 double throughput_dev = double(
m_resolution) * time_dev / time_avg / time_avg;
157 info <<
"Average throughput: " << throughput_avg <<
" ± " << throughput_dev <<
" ev/s";
void preallocate(edm::service::SystemBounds const &bounds)
dqm::reco::MonitorElement * m_sourced_events
void watchPreallocate(Preallocate::slot_type const &iSlot)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
virtual void setCurrentFolder(std::string const &fullpath)
void preSourceEvent(edm::StreamID sid)
void watchPostEvent(PostEvent::slot_type const &iSlot)
dqm::reco::MonitorElement * m_retired_events
void postEvent(edm::StreamContext const &sc)
tbb::concurrent_vector< std::chrono::system_clock::time_point > m_events
void preGlobalBeginRun(edm::GlobalContext const &gc)
bool m_print_event_summary
virtual void setXTitle(std::string const &title)
const std::string processor_model
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
#define DEFINE_FWK_SERVICE(type)
virtual void setYTitle(std::string const &title)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ThroughputService(const edm::ParameterSet &, edm::ActivityRegistry &)
std::atomic< uint32_t > m_counter
std::chrono::system_clock::time_point m_startup
const double m_time_resolution
const double m_time_range
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
UseScope< MonitorElementData::Scope::RUN > UseRunScope
const uint32_t m_resolution