CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastMonitoringThread.h
Go to the documentation of this file.
1 #ifndef EVF_FASTMONITORINGTHREAD
2 #define EVF_FASTMONITORINGTHREAD
3 
4 #include "boost/thread/thread.hpp"
5 
6 #include <iostream>
7 #include <vector>
8 
12 
13 using namespace jsoncollector;
14 using std::vector;
15 
16 namespace evf{
17 
18  class FastMonitoringService;
19 
21  public:
22  enum Macrostate { sInit = 0, sJobReady, sRunGiven, sRunning, sStopping,
23  sShuttingDown, sDone, sJobEnded, sError, sErrorEnded, sEnd, sInvalid,MCOUNT};
24  struct MonitorData
25  {
27  const void *ministate_;
28  const void *microstate_;
29  unsigned int eventnumber_;
30  unsigned int processed_;
31  // accummulated size of processed files over a lumi (in Bytes)
32  unsigned long accuSize_;
33  unsigned int lumisection_; //only updated on beginLumi signal
34  unsigned int prescaleindex_; // ditto
35 
36  // Micro, mini, macrostate numbers
40  // Processed events count
42  // Throughput, MB/s
44  // Average time to obtain a file to read (ms)
46  // Number of files processed during lumi section
48  boost::shared_ptr<FastMonitor> jsonMonitor_;
49 
50  };
51  // a copy of the Framework/EventProcessor states
52 
53 
54  FastMonitoringThread() : m_stoprequest(false){}
55 
57  assert(!m_thread);
58  m_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(fp,cp)));
59  }
60  void stop(){
61  assert(m_thread);
62  m_stoprequest=true;
63  m_thread->join();
64  }
65 
66  private:
67 
68  volatile bool m_stoprequest;
69  boost::shared_ptr<boost::thread> m_thread;
73 
74  friend class FastMonitoringService;
75  };
76 } //end namespace evf
77 #endif
void start(void(FastMonitoringService::*fp)(), FastMonitoringService *cp)
static boost::mutex mutex
Definition: LHEProxy.cc:11
boost::shared_ptr< FastMonitor > jsonMonitor_
boost::shared_ptr< boost::thread > m_thread
volatile std::atomic< bool > shutdown_flag false