CMS 3D CMS Logo

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

#include <ThroughputService.h>

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 preGlobalBeginRun (edm::GlobalContext const &)
 
void preSourceEvent (edm::StreamID sid)
 

Private Attributes

const std::string m_dqm_path
 
ConcurrentMonitorElement m_retired_events
 
ConcurrentMonitorElement m_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 30 of file ThroughputService.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file ThroughputService.cc.

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

22  :
23  // startup time
25  // configuration
26  m_time_range( config.getUntrackedParameter<double>("timeRange") ),
27  m_time_resolution( config.getUntrackedParameter<double>("timeResolution") ),
28  m_dqm_path( config.getUntrackedParameter<std::string>("dqmPath" ) )
29 {
32  registry.watchPostEvent( this, & ThroughputService::postEvent );
33 }
T getUntrackedParameter(std::string const &, T const &) const
const std::string m_dqm_path
void preSourceEvent(edm::StreamID sid)
void watchPostEvent(PostEvent::slot_type const &iSlot)
void postEvent(edm::StreamContext const &sc)
void preGlobalBeginRun(edm::GlobalContext const &)
std::chrono::steady_clock::time_point m_startup
void watchPreGlobalBeginRun(PreGlobalBeginRun::slot_type const &iSlot)
const double m_time_resolution
const double m_time_range
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
ThroughputService::~ThroughputService ( )
default

Referenced by ThroughputService().

Member Function Documentation

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

Definition at line 14 of file ThroughputService.cc.

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

14  {
16  desc.addUntracked<double>( "timeRange", 60000.0 );
17  desc.addUntracked<double>( "timeResolution", 10.0 );
18  desc.addUntracked<std::string>( "dqmPath", "HLT/Throughput" );
19  descriptions.add("ThroughputService", desc);
20 }
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 73 of file ThroughputService.cc.

References KineDebug3::count(), DEFINE_FWK_SERVICE, ConcurrentMonitorElement::fill(), m_retired_events, m_startup, cmsPerfSuiteHarvest::now, and cond::timestamp.

Referenced by ThroughputService().

74 {
76  m_retired_events.fill( std::chrono::duration_cast<std::chrono::duration<double>>(timestamp - m_startup).count() );
77 }
std::chrono::steady_clock::time_point m_startup
void fill(Args &&...args) const
ConcurrentMonitorElement m_retired_events
void ThroughputService::preGlobalBeginRun ( edm::GlobalContext const &  gc)
private

Definition at line 38 of file ThroughputService.cc.

References create_public_pileup_plots::bins, MessageLogger_cfi::cerr, cmsPerfStripChart::format, edm::GlobalContext::luminosityBlockID(), m_dqm_path, m_retired_events, m_sourced_events, m_time_range, m_time_resolution, edm::LuminosityBlockID::run(), ConcurrentMonitorElement::setXTitle(), ConcurrentMonitorElement::setYTitle(), harvestTrackValidationPlots::str, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ThroughputService().

39 {
40  // if the DQMStore is available, book the DQM histograms
41  if (edm::Service<DQMStore>().isAvailable()) {
42  std::string y_axis_title = (boost::format("events / %g s") % m_time_resolution).str();
43  unsigned int bins = std::round( m_time_range / m_time_resolution );
44  double range = bins * m_time_resolution;
45 
46  // define a callback that can book the histograms
47  auto bookTransactionCallback = [&, this] (DQMStore::ConcurrentBooker & booker) {
48  booker.setCurrentFolder(m_dqm_path);
49  m_sourced_events = booker.book1D("throughput_sourced", "Throughput (sourced events)", bins, 0., range);
50  m_sourced_events.setXTitle("time [s]");
51  m_sourced_events.setYTitle(y_axis_title.c_str());
52  m_retired_events = booker.book1D("throughput_retired", "Throughput (retired events)", bins, 0., range);
53  m_retired_events.setXTitle("time [s]");
54  m_retired_events.setYTitle(y_axis_title.c_str());
55  };
56 
57  // book MonitorElement's for this run
58  edm::Service<DQMStore>()->bookConcurrentTransaction(bookTransactionCallback, gc.luminosityBlockID().run());
59  } else {
60  std::cerr << "No DQMStore service, aborting." << std::endl;
61  abort();
62  }
63 }
const std::string m_dqm_path
void setYTitle(std::string const &title)
ConcurrentMonitorElement m_sourced_events
format
Some error handling for the usage.
ConcurrentMonitorElement m_retired_events
const double m_time_resolution
const double m_time_range
void setXTitle(std::string const &title)
void ThroughputService::preSourceEvent ( edm::StreamID  sid)
private

Definition at line 66 of file ThroughputService.cc.

References KineDebug3::count(), ConcurrentMonitorElement::fill(), m_sourced_events, m_startup, cmsPerfSuiteHarvest::now, and cond::timestamp.

Referenced by ThroughputService().

67 {
69  m_sourced_events.fill( std::chrono::duration_cast<std::chrono::duration<double>>(timestamp - m_startup).count() );
70 }
ConcurrentMonitorElement m_sourced_events
std::chrono::steady_clock::time_point m_startup
void fill(Args &&...args) const

Member Data Documentation

const std::string ThroughputService::m_dqm_path
private

Definition at line 54 of file ThroughputService.h.

Referenced by preGlobalBeginRun().

ConcurrentMonitorElement ThroughputService::m_retired_events
private

Definition at line 45 of file ThroughputService.h.

Referenced by postEvent(), and preGlobalBeginRun().

ConcurrentMonitorElement ThroughputService::m_sourced_events
private

Definition at line 44 of file ThroughputService.h.

Referenced by preGlobalBeginRun(), and preSourceEvent().

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

Definition at line 47 of file ThroughputService.h.

Referenced by postEvent(), and preSourceEvent().

const double ThroughputService::m_time_range
private

Definition at line 50 of file ThroughputService.h.

Referenced by preGlobalBeginRun().

const double ThroughputService::m_time_resolution
private

Definition at line 51 of file ThroughputService.h.

Referenced by preGlobalBeginRun().