CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ThroughputService Class Reference

#include <ThroughputService.h>

Public Types

typedef dqm::reco::DQMStore DQMStore
 

Public Member Functions

 ThroughputService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
 ~ThroughputService ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void postEvent (edm::StreamContext const &sc)
 
void preallocate (edm::service::SystemBounds const &bounds)
 
void preGlobalBeginRun (edm::GlobalContext const &gc)
 
void preSourceEvent (edm::StreamID sid)
 

Private Attributes

const bool m_dqm_bynproc
 
std::string m_dqm_path
 
dqm::reco::MonitorElementm_retired_events
 
dqm::reco::MonitorElementm_sourced_events
 
std::chrono::steady_clock::time_point m_startup
 
const double m_time_range
 
const double m_time_resolution
 

Detailed Description

Definition at line 29 of file ThroughputService.h.

Member Typedef Documentation

Definition at line 31 of file ThroughputService.h.

Constructor & Destructor Documentation

ThroughputService::ThroughputService ( const edm::ParameterSet config,
edm::ActivityRegistry registry 
)

Definition at line 25 of file ThroughputService.cc.

References postEvent(), preGlobalBeginRun(), preSourceEvent(), edm::ActivityRegistry::watchPostEvent(), edm::ActivityRegistry::watchPreGlobalBeginRun(), edm::ActivityRegistry::watchPreSourceEvent(), and ~ThroughputService().

26  : // startup time
28  // configuration
29  m_time_range(config.getUntrackedParameter<double>("timeRange")),
30  m_time_resolution(config.getUntrackedParameter<double>("timeResolution")),
31  m_dqm_path(config.getUntrackedParameter<std::string>("dqmPath")),
32  m_dqm_bynproc(config.getUntrackedParameter<bool>("dqmPathByProcesses")) {
36 }
T getUntrackedParameter(std::string const &, T const &) const
void preSourceEvent(edm::StreamID sid)
void watchPostEvent(PostEvent::slot_type const &iSlot)
void postEvent(edm::StreamContext const &sc)
void preGlobalBeginRun(edm::GlobalContext const &gc)
std::chrono::steady_clock::time_point m_startup
std::string m_dqm_path
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
const double m_time_resolution
const double m_time_range
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
const bool m_dqm_bynproc
ThroughputService::~ThroughputService ( )
default

Referenced by ThroughputService().

Member Function Documentation

void ThroughputService::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 16 of file ThroughputService.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

16  {
18  desc.addUntracked<double>("timeRange", 60000.0);
19  desc.addUntracked<double>("timeResolution", 10.0);
20  desc.addUntracked<std::string>("dqmPath", "HLT/Throughput");
21  desc.addUntracked<bool>("dqmPathByProcesses", false);
22  descriptions.add("ThroughputService", desc);
23 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void ThroughputService::postEvent ( edm::StreamContext const &  sc)
private

Definition at line 81 of file ThroughputService.cc.

References KineDebug3::count(), DEFINE_FWK_SERVICE, dqm::impl::MonitorElement::Fill(), m_retired_events, m_startup, fileCollector::now, and cond::timestamp.

Referenced by ThroughputService().

81  {
83  m_retired_events->Fill(std::chrono::duration_cast<std::chrono::duration<double>>(timestamp - m_startup).count());
84 }
dqm::reco::MonitorElement * m_retired_events
void Fill(long long x)
std::chrono::steady_clock::time_point m_startup
void ThroughputService::preallocate ( edm::service::SystemBounds const &  bounds)
private

Definition at line 40 of file ThroughputService.cc.

References dqm-mbProfile::format, m_dqm_bynproc, m_dqm_path, edm::service::SystemBounds::maxNumberOfStreams(), edm::service::SystemBounds::maxNumberOfThreads(), processor_model, and str.

40  {
41  auto concurrent_streams = bounds.maxNumberOfStreams();
42  auto concurrent_threads = bounds.maxNumberOfThreads();
43 
44  if (m_dqm_bynproc)
45  m_dqm_path += (boost::format("/Running on %s with %d streams on %d threads") % processor_model %
46  concurrent_streams % concurrent_threads)
47  .str();
48 }
std::string m_dqm_path
const std::string processor_model
const bool m_dqm_bynproc
#define str(s)
void ThroughputService::preGlobalBeginRun ( edm::GlobalContext const &  gc)
private

Definition at line 50 of file ThroughputService.cc.

References trigObjTnPSource_cfi::bins, beam_dqm_sourceclient-live_cfg::cerr, dqm-mbProfile::format, edm::GlobalContext::luminosityBlockID(), m_dqm_path, m_retired_events, m_sourced_events, m_time_range, m_time_resolution, FastTimerService_cff::range, edm::LuminosityBlockID::run(), dqm::impl::MonitorElement::setXTitle(), dqm::impl::MonitorElement::setYTitle(), str, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ThroughputService().

50  {
51  // if the DQMStore is available, book the DQM histograms
52  if (edm::Service<DQMStore>().isAvailable()) {
53  std::string y_axis_title = (boost::format("events / %g s") % m_time_resolution).str();
54  unsigned int bins = std::round(m_time_range / m_time_resolution);
55  double range = bins * m_time_resolution;
56 
57  // define a callback that can book the histograms
58  auto bookTransactionCallback = [&, this](DQMStore::IBooker& booker) {
59  booker.setCurrentFolder(m_dqm_path);
60  m_sourced_events = booker.book1D("throughput_sourced", "Throughput (sourced events)", bins, 0., range);
61  m_sourced_events->setXTitle("time [s]");
62  m_sourced_events->setYTitle(y_axis_title);
63  m_retired_events = booker.book1D("throughput_retired", "Throughput (retired events)", bins, 0., range);
64  m_retired_events->setXTitle("time [s]");
65  m_retired_events->setYTitle(y_axis_title);
66  };
67 
68  // book MonitorElement's for this run
69  edm::Service<DQMStore>()->bookConcurrentTransaction(bookTransactionCallback, gc.luminosityBlockID().run());
70  } else {
71  std::cerr << "No DQMStore service, aborting." << std::endl;
72  abort();
73  }
74 }
dqm::reco::MonitorElement * m_sourced_events
dqm::reco::MonitorElement * m_retired_events
virtual void setXTitle(std::string const &title)
std::string m_dqm_path
virtual void setYTitle(std::string const &title)
const double m_time_resolution
const double m_time_range
#define str(s)
void ThroughputService::preSourceEvent ( edm::StreamID  sid)
private

Definition at line 76 of file ThroughputService.cc.

References KineDebug3::count(), dqm::impl::MonitorElement::Fill(), m_sourced_events, m_startup, fileCollector::now, and cond::timestamp.

Referenced by ThroughputService().

76  {
78  m_sourced_events->Fill(std::chrono::duration_cast<std::chrono::duration<double>>(timestamp - m_startup).count());
79 }
dqm::reco::MonitorElement * m_sourced_events
void Fill(long long x)
std::chrono::steady_clock::time_point m_startup

Member Data Documentation

const bool ThroughputService::m_dqm_bynproc
private

Definition at line 57 of file ThroughputService.h.

Referenced by preallocate().

std::string ThroughputService::m_dqm_path
private

Definition at line 56 of file ThroughputService.h.

Referenced by preallocate(), and preGlobalBeginRun().

dqm::reco::MonitorElement* ThroughputService::m_retired_events
private

Definition at line 47 of file ThroughputService.h.

Referenced by postEvent(), and preGlobalBeginRun().

dqm::reco::MonitorElement* ThroughputService::m_sourced_events
private

Definition at line 46 of file ThroughputService.h.

Referenced by preGlobalBeginRun(), and preSourceEvent().

std::chrono::steady_clock::time_point ThroughputService::m_startup
private

Definition at line 49 of file ThroughputService.h.

Referenced by postEvent(), and preSourceEvent().

const double ThroughputService::m_time_range
private

Definition at line 52 of file ThroughputService.h.

Referenced by preGlobalBeginRun().

const double ThroughputService::m_time_resolution
private

Definition at line 53 of file ThroughputService.h.

Referenced by preGlobalBeginRun().