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 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
 
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 26 of file ThroughputService.cc.

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

26  :
27  // startup time
29  // configuration
30  m_time_range( config.getUntrackedParameter<double>("timeRange") ),
31  m_time_resolution( config.getUntrackedParameter<double>("timeResolution") ),
32  m_dqm_path( config.getUntrackedParameter<std::string>("dqmPath") ),
33  m_dqm_bynproc( config.getUntrackedParameter<bool>("dqmPathByProcesses") )
34 {
37  registry.watchPostEvent( this, & ThroughputService::postEvent );
38 }
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 17 of file ThroughputService.cc.

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

17  {
19  desc.addUntracked<double>( "timeRange", 60000.0 );
20  desc.addUntracked<double>( "timeResolution", 10.0 );
21  desc.addUntracked<std::string>( "dqmPath", "HLT/Throughput" );
22  desc.addUntracked<bool>( "dqmPathByProcesses", false );
23  descriptions.add("ThroughputService", desc);
24 }
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 88 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().

89 {
91  m_retired_events.fill( std::chrono::duration_cast<std::chrono::duration<double>>(timestamp - m_startup).count() );
92 }
std::chrono::steady_clock::time_point m_startup
void fill(Args &&...args) const
ConcurrentMonitorElement m_retired_events
void ThroughputService::preallocate ( edm::service::SystemBounds const &  bounds)
private

Definition at line 43 of file ThroughputService.cc.

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

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

Definition at line 53 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(), str, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ThroughputService().

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

Definition at line 81 of file ThroughputService.cc.

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

Referenced by ThroughputService().

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

Member Data Documentation

const bool ThroughputService::m_dqm_bynproc
private

Definition at line 56 of file ThroughputService.h.

Referenced by preallocate().

std::string ThroughputService::m_dqm_path
private

Definition at line 55 of file ThroughputService.h.

Referenced by preallocate(), and preGlobalBeginRun().

ConcurrentMonitorElement ThroughputService::m_retired_events
private

Definition at line 46 of file ThroughputService.h.

Referenced by postEvent(), and preGlobalBeginRun().

ConcurrentMonitorElement ThroughputService::m_sourced_events
private

Definition at line 45 of file ThroughputService.h.

Referenced by preGlobalBeginRun(), and preSourceEvent().

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

Definition at line 48 of file ThroughputService.h.

Referenced by postEvent(), and preSourceEvent().

const double ThroughputService::m_time_range
private

Definition at line 51 of file ThroughputService.h.

Referenced by preGlobalBeginRun().

const double ThroughputService::m_time_resolution
private

Definition at line 52 of file ThroughputService.h.

Referenced by preGlobalBeginRun().