CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
dqmservices::DQMMonitoringService Class Reference

#include <DQMMonitoringService.h>

Public Member Functions

 DQMMonitoringService (const edm::ParameterSet &, edm::ActivityRegistry &)
 
void evEvent (StreamID const &)
 
void evLumi (GlobalContext const &)
 
void keepAlive ()
 
void outputUpdate (ptree &doc)
 
 ~DQMMonitoringService ()
 

Private Attributes

ptree doc_
 
long last_report_nevents_
 
std::chrono::high_resolution_clock::time_point last_report_time_
 
std::shared_ptr< std::ostream > mstream_
 
long nevents_
 

Detailed Description

Definition at line 42 of file DQMMonitoringService.h.

Constructor & Destructor Documentation

dqmservices::DQMMonitoringService::DQMMonitoringService ( const edm::ParameterSet pset,
edm::ActivityRegistry ar 
)

Definition at line 14 of file DQMMonitoringService.cc.

References dtNoiseDBValidation_cfg::cerr, evEvent(), evLumi(), last_report_nevents_, last_report_time_, mstream_, nevents_, fileCollector::now, edm::ActivityRegistry::watchPreGlobalBeginLumi(), edm::ActivityRegistry::watchPreSourceEvent(), and x.

14  {
15  const char* x = getenv("DQMMON_UPDATE_PIPE");
16 
17  if (x) {
18  std::cerr << "Monitoring pipe: " << x << std::endl;
19  mstream_.reset(new std::ofstream(x));
20  } else {
21  std::cerr << "Monitoring file not found, disabling." << std::endl;
22  }
23 
24  nevents_ = 0;
27 
30 }
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
std::chrono::high_resolution_clock::time_point last_report_time_
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
Definition: DDAxes.h:10
void evLumi(GlobalContext const &)
std::shared_ptr< std::ostream > mstream_
dqmservices::DQMMonitoringService::~DQMMonitoringService ( )

Definition at line 32 of file DQMMonitoringService.cc.

32  {
33 }

Member Function Documentation

void dqmservices::DQMMonitoringService::evEvent ( StreamID const &  iContext)

Definition at line 45 of file DQMMonitoringService.cc.

References prof2calltree::count, asciidump::doc, last_report_nevents_, last_report_time_, nevents_, fileCollector::now, outputUpdate(), RPCpg::rate(), and seconds().

Referenced by DQMMonitoringService().

45  {
46  nevents_ += 1;
47 
48  using std::chrono::duration_cast;
50 
52  auto count = duration_cast<seconds>(now - last_report_time_).count();
53 
54  if (count < 30) {
55  // we don't want to report too often
56  return;
57  }
58 
59  ptree doc;
60  doc.put("events_total", nevents_);
61 
62  if (count > 0) {
64  doc.put("events_rate", rate);
65  }
66 
69 
70  outputUpdate(doc);
71 }
double seconds()
tuple doc
Definition: asciidump.py:381
std::chrono::high_resolution_clock::time_point last_report_time_
double rate(double x)
Definition: Constants.cc:3
void dqmservices::DQMMonitoringService::evLumi ( GlobalContext const &  iContext)

Definition at line 35 of file DQMMonitoringService.cc.

References asciidump::doc, fjr2json::lumi, edm::LuminosityBlockID::luminosityBlock(), edm::GlobalContext::luminosityBlockID(), outputUpdate(), edm::LuminosityBlockID::run(), and DTTTrigCorrFirst::run.

Referenced by DQMMonitoringService().

35  {
36  unsigned int run = iContext.luminosityBlockID().run();
37  unsigned int lumi = iContext.luminosityBlockID().luminosityBlock();
38 
39  ptree doc;
40  doc.put("cmssw_run", run);
41  doc.put("cmssw_lumi", lumi);
42  outputUpdate(doc);
43 }
tuple lumi
Definition: fjr2json.py:35
tuple doc
Definition: asciidump.py:381
void dqmservices::DQMMonitoringService::keepAlive ( )

Definition at line 87 of file DQMMonitoringService.cc.

References mstream_.

87  {
88  if (!mstream_)
89  return;
90 
91  *mstream_ << "\n";
92  mstream_->flush();
93 }
std::shared_ptr< std::ostream > mstream_
void dqmservices::DQMMonitoringService::outputUpdate ( ptree &  doc)

Definition at line 73 of file DQMMonitoringService.cc.

References mstream_, NULL, and cond::rpcobgas::time.

Referenced by evEvent(), and evLumi().

73  {
74  if (!mstream_)
75  return;
76 
77  try {
78  doc.put("update_timestamp", std::time(NULL));
79 
80  write_json(*mstream_, doc, false);
81  mstream_->flush();
82  } catch (...) {
83  // pass
84  }
85 }
#define NULL
Definition: scimark2.h:8
tuple doc
Definition: asciidump.py:381
std::shared_ptr< std::ostream > mstream_

Member Data Documentation

ptree dqmservices::DQMMonitoringService::doc_
private

Definition at line 57 of file DQMMonitoringService.h.

long dqmservices::DQMMonitoringService::last_report_nevents_
private

Definition at line 60 of file DQMMonitoringService.h.

Referenced by DQMMonitoringService(), and evEvent().

std::chrono::high_resolution_clock::time_point dqmservices::DQMMonitoringService::last_report_time_
private

Definition at line 61 of file DQMMonitoringService.h.

Referenced by DQMMonitoringService(), and evEvent().

std::shared_ptr<std::ostream> dqmservices::DQMMonitoringService::mstream_
private

Definition at line 56 of file DQMMonitoringService.h.

Referenced by DQMMonitoringService(), keepAlive(), and outputUpdate().

long dqmservices::DQMMonitoringService::nevents_
private

Definition at line 59 of file DQMMonitoringService.h.

Referenced by DQMMonitoringService(), and evEvent().