test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Monitoring.h
Go to the documentation of this file.
1 #ifndef INCLUDE_ORA_MONITORING_H
2 #define INCLUDE_ORA_MONITORING_H
3 
4 //
5 #include <string>
6 #include <map>
7 #include "boost/date_time/posix_time/posix_time.hpp"
8 #include <iostream>
9 #include <atomic>
10 
11 namespace ora {
12 
14  explicit TransactionMonitoringData( boost::posix_time::ptime start );
15  void stop(bool commit_status=true);
16  boost::posix_time::ptime m_start;
17  boost::posix_time::ptime m_stop;
18  bool m_status;
19  };
20 
22  public:
23  SessionMonitoringData( boost::posix_time::ptime start, const std::string& connectionString );
25  size_t newTransaction();
26  size_t stopTransaction( bool commit_status=true);
27  void stop();
28  size_t numberOfTransactions() const ;
29  void report( std::ostream& out ) const ;
31  boost::posix_time::ptime m_start;
32  boost::posix_time::ptime m_stop;
33  private:
35  std::map<std::string,TransactionMonitoringData*> m_transactions;
36  size_t m_ncur;
37  };
38 
39  class Monitoring {
40  public:
41  static Monitoring& get();
42  static bool isEnabled();
43  static void enable();
44  static const std::string& outFileName();
45  public:
46 
48  virtual ~Monitoring() throw();
49 
51 
52  void report( std::ostream& out );
53  private:
54  static std::atomic<bool> s_enabled;
55 
56  private:
57  //
58  Monitoring();
59  private:
60 
61  std::map<std::string,SessionMonitoringData*> m_sessions;
62  };
63 
64 }
65 
66 #endif
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
TransactionMonitoringData(boost::posix_time::ptime start)
Definition: Monitoring.cc:8
std::map< std::string, SessionMonitoringData * > m_sessions
Definition: Monitoring.h:61
size_t stopTransaction(bool commit_status=true)
Definition: Monitoring.cc:42
boost::posix_time::ptime m_stop
Definition: Monitoring.h:17
static const std::string & outFileName()
Definition: Monitoring.cc:96
std::string m_connectionString
Definition: Monitoring.h:30
SessionMonitoringData * startSession(const std::string &connectionString)
Definition: Monitoring.cc:128
static void enable()
Definition: Monitoring.cc:92
void report(std::ostream &out) const
Definition: Monitoring.cc:63
boost::posix_time::ptime m_stop
Definition: Monitoring.h:32
SessionMonitoringData(boost::posix_time::ptime start, const std::string &connectionString)
Definition: Monitoring.cc:19
TransactionMonitoringData * m_currentTransaction
Definition: Monitoring.h:34
static std::atomic< bool > s_enabled
Definition: Monitoring.h:54
void report(std::ostream &out)
Definition: Monitoring.cc:134
boost::posix_time::ptime m_start
Definition: Monitoring.h:16
void stop(bool commit_status=true)
Definition: Monitoring.cc:14
string connectionString
Definition: autoCondHLT.py:4
virtual ~Monitoring()
Definition: Monitoring.cc:102
size_t numberOfTransactions() const
Definition: Monitoring.cc:59
static bool isEnabled()
Definition: Monitoring.cc:84
std::map< std::string, TransactionMonitoringData * > m_transactions
Definition: Monitoring.h:35
boost::posix_time::ptime m_start
Definition: Monitoring.h:31