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 
10 namespace ora {
11 
13  explicit TransactionMonitoringData( boost::posix_time::ptime start );
14  void stop(bool commit_status=true);
15  boost::posix_time::ptime m_start;
16  boost::posix_time::ptime m_stop;
17  bool m_status;
18  };
19 
21  public:
22  SessionMonitoringData( boost::posix_time::ptime start, const std::string& connectionString );
24  size_t newTransaction();
25  size_t stopTransaction( bool commit_status=true);
26  void stop();
27  size_t numberOfTransactions() const ;
28  void report( std::ostream& out ) const ;
29  std::string m_connectionString;
30  boost::posix_time::ptime m_start;
31  boost::posix_time::ptime m_stop;
32  private:
34  std::map<std::string,TransactionMonitoringData*> m_transactions;
35  size_t m_ncur;
36  };
37 
38  class Monitoring {
39  public:
40  static Monitoring& get();
41  static bool isEnabled();
42  static void enable();
43  static std::string& outFileName();
44  public:
45 
47  virtual ~Monitoring() throw();
48 
49  SessionMonitoringData* startSession( const std::string& connectionString );
50 
51  void report( std::ostream& out );
52  private:
53  static bool s_enabled;
54 
55  private:
56  //
57  Monitoring();
58  private:
59 
60  std::map<std::string,SessionMonitoringData*> m_sessions;
61  };
62 
63 }
64 
65 #endif
TransactionMonitoringData(boost::posix_time::ptime start)
Definition: Monitoring.cc:7
std::map< std::string, SessionMonitoringData * > m_sessions
Definition: Monitoring.h:60
size_t stopTransaction(bool commit_status=true)
Definition: Monitoring.cc:41
boost::posix_time::ptime m_stop
Definition: Monitoring.h:16
std::string m_connectionString
Definition: Monitoring.h:29
static bool s_enabled
Definition: Monitoring.h:53
static std::string & outFileName()
Definition: Monitoring.cc:95
SessionMonitoringData * startSession(const std::string &connectionString)
Definition: Monitoring.cc:132
static void enable()
Definition: Monitoring.cc:91
void report(std::ostream &out) const
Definition: Monitoring.cc:62
boost::posix_time::ptime m_stop
Definition: Monitoring.h:31
SessionMonitoringData(boost::posix_time::ptime start, const std::string &connectionString)
Definition: Monitoring.cc:18
TransactionMonitoringData * m_currentTransaction
Definition: Monitoring.h:33
void report(std::ostream &out)
Definition: Monitoring.cc:138
boost::posix_time::ptime m_start
Definition: Monitoring.h:15
void stop(bool commit_status=true)
Definition: Monitoring.cc:13
tuple out
Definition: dbtoconf.py:99
virtual ~Monitoring()
Definition: Monitoring.cc:106
size_t numberOfTransactions() const
Definition: Monitoring.cc:58
static bool isEnabled()
Definition: Monitoring.cc:83
std::map< std::string, TransactionMonitoringData * > m_transactions
Definition: Monitoring.h:34
boost::posix_time::ptime m_start
Definition: Monitoring.h:30