4 #include <fmt/printf.h>
6 #include <boost/algorithm/string.hpp>
7 #include <boost/algorithm/string/predicate.hpp>
16 namespace dqmservices {
19 const char* x = std::getenv(
"DQM2_SOCKET");
21 std::cerr <<
"Monitoring pipe: " << x << std::endl;
22 mstream_.connect(boost::asio::local::stream_protocol::endpoint(x));
24 std::cerr <<
"Monitoring file not found, disabling." << std::endl;
44 using std::chrono::duration_cast;
45 using std::chrono::milliseconds;
53 doc.put(
"cmssw_run",
run_);
54 doc.put(
"cmssw_lumi",
lumi_);
62 if ((lumi_last > 0) && (lumi_millis > 0)) {
63 doc.put(
"lumi_number", lumi_last);
64 doc.put(
"lumi_events", lumi_events);
65 doc.put(
"lumi_duration_ms", lumi_millis);
67 float rate = ((float)lumi_events * 1000) / lumi_millis;
68 doc.put(
"events_rate", rate);
72 plumi.put(
"n", lumi_last);
73 plumi.put(
"nevents", lumi_events);
74 plumi.put(
"nmillis", lumi_millis);
75 plumi.put(
"rate", rate);
77 std::time_t hkey = std::time(
nullptr);
78 doc.add_child(fmt::sprintf(
"extra.lumi_stats.%d", hkey), plumi);
85 using std::chrono::duration_cast;
86 using std::chrono::milliseconds;
106 using std::chrono::duration_cast;
107 using std::chrono::milliseconds;
114 doc.put(
"update_timestamp", std::time(
nullptr));
134 using std::chrono::duration_cast;
135 using std::chrono::milliseconds;
145 if (millis >= (25 * 1000)) {
LuminosityBlockID const & luminosityBlockID() const
void watchPreGlobalBeginLumi(PreGlobalBeginLumi::slot_type const &iSlot)
void evEvent(StreamID const &)
boost::asio::local::stream_protocol::iostream mstream_
tuple DQMMonitoringService
#define DEFINE_FWK_SERVICE(type)
LuminosityBlockNumber_t luminosityBlock() const
std::chrono::high_resolution_clock::time_point last_lumi_time_
DQMMonitoringService(const edm::ParameterSet &, edm::ActivityRegistry &)
void watchPreSourceEvent(PreSourceEvent::slot_type const &iSlot)
std::chrono::high_resolution_clock::time_point last_update_time_
void evLumi(GlobalContext const &)
void outputUpdate(ptree &doc)