7#include "GaudiKernel/Kernel.h"
8#include "GaudiKernel/IInterface.h"
9#include "GaudiKernel/StatusCode.h"
11#include "GaudiKernel/SvcFactory.h"
12#include "GaudiKernel/MsgStream.h"
13#include "BesTimerSvc/BesTimerSvc.h"
19 std::vector < BesTimer* >::iterator it = m_itemList.begin();
20 for (; it != m_itemList.end(); it++) {
27 if ( IID_IBesTimerSvc.versionMatch(riid) ) {
30 return Service::queryInterface(riid, ppvInterface) ;
32 return StatusCode::SUCCESS;
35 MsgStream log(messageService(), name());
36 log << MSG::INFO << name() <<
": Start of run initialisation" << endreq;
38 StatusCode sc = Service::initialize();
39 if ( sc.isFailure() )
return sc;
43 return StatusCode::SUCCESS;
48 MsgStream log(messageService(), name());
49 log << MSG::INFO << name() <<
": End of Run Statistics" << endreq;
51 return StatusCode::SUCCESS;
62 MsgStream log(messageService(), name());
63 log << MSG::DEBUG << name() <<
" adding " << itemName << endreq;
66 m_itemList.push_back(item);
71 MsgStream log(messageService(), name());
73 log << MSG::INFO <<
"==============================BesTimerSvc::Print===============================" << endreq;
74 unsigned int maxname=0;
75 std::vector < BesTimer* >::iterator it = m_itemList.begin();
76 for (; it != m_itemList.end(); it++) {
77 if ((*it)->name().length() > maxname) maxname =
static_cast<int>((*it)->name().length());
78 if (!(*it)->propName().empty()) {
79 if ((*it)->propName().length() > maxname) maxname =
static_cast<int>((*it)->propName().length());
83 it = m_itemList.begin();
84 for (; it != m_itemList.end(); it++) {
85 std::string nam = (*it)->name();
86 for (
unsigned int i =
static_cast<int>(nam.length()); i<maxname; i++) nam.insert(i,
" ");
87 log << MSG::INFO << nam <<
" mean(t) : " << std::setw(12) << (*it)->mean()<<
88 " ms rms : " << std::setw(12) << (*it)->rms() <<
" ms " << endreq;
90 log << MSG::INFO <<
"------------------------------------------------------------------------------" << endreq;
91 it = m_itemList.begin();
92 for (; it != m_itemList.end(); it++) {
93 if (!(*it)->propName().empty()) {
94 std::string nam = (*it)->name();
95 for (
unsigned int i =
static_cast<int>(nam.length()); i<maxname; i++) nam.insert(i,
" ");
96 log << MSG::INFO << nam <<
" mean(t) : " << std::setw(12) << (*it)->mean()<<
97 " ms rms : " << std::setw(12) << (*it)->rms() <<
" ms " << endreq;
99 nam = (*it)->propName();
100 for (
unsigned int i =
static_cast<int>(nam.length()); i<maxname; i++) nam.insert(i,
" ");
101 if ((*it)->meanPropVal() == 0) {
102 log << MSG::INFO << nam <<
" mean(N) : " << std::setw(12) << endreq;
104 log << MSG::INFO << nam <<
" mean(N) : " << std::setw(12) << (*it)->meanPropVal() <<
106 << 1000.*(*it)->meanTimePerObject() <<
" us " << endreq;
111 log << MSG::INFO <<
"==============================BesTimerSvc::Print===============================" << endreq;
115 return m_itemList.begin();
118 return m_itemList.end();
virtual std::vector< BesTimer * >::iterator begin(void)
virtual BesTimer * addItem(const std::string &name)
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
virtual StatusCode initialize()
virtual StatusCode finalize()
virtual std::vector< BesTimer * >::iterator end(void)
BesTimerSvc(const std::string &name, ISvcLocator *svcloc)