#include <Monitoring.h>
Public Member Functions | |
size_t | newTransaction () |
size_t | numberOfTransactions () const |
void | report (std::ostream &out) const |
SessionMonitoringData (boost::posix_time::ptime start, const std::string &connectionString) | |
void | stop () |
size_t | stopTransaction (bool commit_status=true) |
~SessionMonitoringData () | |
Public Attributes | |
std::string | m_connectionString |
boost::posix_time::ptime | m_start |
boost::posix_time::ptime | m_stop |
Private Attributes | |
TransactionMonitoringData * | m_currentTransaction |
size_t | m_ncur |
std::map< std::string, TransactionMonitoringData * > | m_transactions |
Definition at line 20 of file Monitoring.h.
ora::SessionMonitoringData::SessionMonitoringData | ( | boost::posix_time::ptime | start, |
const std::string & | connectionString | ||
) |
Definition at line 18 of file Monitoring.cc.
: m_connectionString( connectionString ), m_start(start), m_stop(boost::posix_time::neg_infin), m_currentTransaction(0), m_transactions(), m_ncur(0){ }
ora::SessionMonitoringData::~SessionMonitoringData | ( | ) |
Definition at line 27 of file Monitoring.cc.
{ for(std::map<std::string,TransactionMonitoringData*>::const_iterator iT = m_transactions.begin(); iT != m_transactions.end();iT++ ){ delete iT->second; } }
size_t ora::SessionMonitoringData::newTransaction | ( | ) |
Definition at line 34 of file Monitoring.cc.
References ora::guidFromTime().
{ m_currentTransaction = new TransactionMonitoringData( boost::posix_time::microsec_clock::universal_time() ); m_transactions.insert(std::make_pair(guidFromTime(),m_currentTransaction)); m_ncur = m_transactions.size(); return m_ncur; }
size_t ora::SessionMonitoringData::numberOfTransactions | ( | ) | const |
Definition at line 58 of file Monitoring.cc.
{ return m_transactions.size(); }
void ora::SessionMonitoringData::report | ( | std::ostream & | out | ) | const |
Definition at line 62 of file Monitoring.cc.
References AlCaHLTBitMon_QueryRunRegistry::data, i, ora::TransactionMonitoringData::m_start, ora::TransactionMonitoringData::m_status, and ora::TransactionMonitoringData::m_stop.
{ size_t i=1; for(std::map<std::string,TransactionMonitoringData*>::const_iterator iT = m_transactions.begin(); iT != m_transactions.end();iT++ ){ TransactionMonitoringData& data = *iT->second; boost::posix_time::time_duration duration; if( !data.m_stop.is_neg_infinity() ){ duration = data.m_stop-data.m_start; } out <<" -> Transaction #"<<i<<" duration="<<boost::posix_time::to_simple_string(duration)<<" status="<<(data.m_status?std::string("COMMIT"):std::string("ROLLBACK"))<<std::endl; i++; } }
void ora::SessionMonitoringData::stop | ( | ) |
Definition at line 52 of file Monitoring.cc.
{ m_stop = boost::posix_time::microsec_clock::universal_time(); m_currentTransaction = 0; m_ncur = 0; }
size_t ora::SessionMonitoringData::stopTransaction | ( | bool | commit_status = true | ) |
Definition at line 41 of file Monitoring.cc.
{ size_t ncur = 0; if(m_currentTransaction){ m_currentTransaction->stop( commit_status ); m_currentTransaction = 0; ncur = m_ncur; m_ncur = 0; } return ncur; }
std::string ora::SessionMonitoringData::m_connectionString |
Definition at line 29 of file Monitoring.h.
Referenced by ora::Monitoring::report().
Definition at line 33 of file Monitoring.h.
size_t ora::SessionMonitoringData::m_ncur [private] |
Definition at line 35 of file Monitoring.h.
boost::posix_time::ptime ora::SessionMonitoringData::m_start |
Definition at line 30 of file Monitoring.h.
Referenced by ora::Monitoring::report().
boost::posix_time::ptime ora::SessionMonitoringData::m_stop |
Definition at line 31 of file Monitoring.h.
Referenced by ora::Monitoring::report().
std::map<std::string,TransactionMonitoringData*> ora::SessionMonitoringData::m_transactions [private] |
Definition at line 34 of file Monitoring.h.