Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:14

0001 #ifndef DQMServices_StreamerIO_DQMMonitoringService_h
0002 #define DQMServices_StreamerIO_DQMMonitoringService_h
0003 
0004 #include <chrono>
0005 
0006 #include <boost/asio.hpp>
0007 #include <boost/property_tree/ptree.hpp>
0008 
0009 /*
0010  * This service is very similar to the FastMonitoringService in the HLT,
0011  * except that it is used for monitoring online DQM applications
0012  */
0013 
0014 namespace edm {
0015   class ActivityRegistry;
0016   class GlobalContext;
0017   class ParameterSet;
0018   class StreamID;
0019 }  // namespace edm
0020 
0021 namespace dqmservices {
0022 
0023   class DQMMonitoringService {
0024   public:
0025     DQMMonitoringService(const edm::ParameterSet&, edm::ActivityRegistry&);
0026     ~DQMMonitoringService() = default;
0027 
0028     void connect();
0029     void keepAlive();
0030 
0031     void outputLumiUpdate();
0032     void outputUpdate(boost::property_tree::ptree& doc);
0033 
0034     void evLumi(edm::GlobalContext const&);
0035     void evEvent(edm::StreamID const&);
0036 
0037     void tryUpdate();
0038 
0039   private:
0040     boost::asio::local::stream_protocol::iostream mstream_;
0041 
0042     // global number of events processed
0043     long nevents_;
0044 
0045     // time point, number of events and lumi number at the time we switched to it
0046     std::chrono::high_resolution_clock::time_point last_lumi_time_;
0047     std::chrono::high_resolution_clock::time_point last_update_time_;
0048     long last_lumi_nevents_;
0049     // last lumi (we report stats for it, after we switch to the next one)
0050     unsigned long last_lumi_;
0051 
0052     unsigned long run_;   // current run
0053     unsigned long lumi_;  // current lumi
0054   };
0055 
0056 }  // namespace dqmservices
0057 
0058 #endif  // DQMServices_StreamerIO_DQMMonitoringService_h