BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
BesTimerSvc Class Reference

#include <BesTimerSvc.h>

+ Inheritance diagram for BesTimerSvc:

Public Member Functions

 BesTimerSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~BesTimerSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual BesTimeraddItem (const std::string &name)
 
virtual std::vector< BesTimer * >::iterator begin (void)
 
virtual std::vector< BesTimer * >::iterator end (void)
 
virtual void print ()
 
virtual BesTimeraddItem (const std::string &name)=0
 
virtual std::vector< BesTimer * >::iterator begin (void)=0
 
virtual std::vector< BesTimer * >::iterator end (void)=0
 
virtual void print (void)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from IBesTimerSvc
static const InterfaceID & interfaceID ()
 

Detailed Description

Definition at line 16 of file BesTimerSvc.h.

Constructor & Destructor Documentation

◆ BesTimerSvc()

BesTimerSvc::BesTimerSvc ( const std::string &  name,
ISvcLocator *  svcloc 
)

Definition at line 16 of file BesTimerSvc.cxx.

16: Service(name, svcloc) {}

◆ ~BesTimerSvc()

BesTimerSvc::~BesTimerSvc ( )

Definition at line 18 of file BesTimerSvc.cxx.

18 {
19 std::vector < BesTimer* >::iterator it = m_itemList.begin();
20 for (; it != m_itemList.end(); it++) {
21 delete (*it);
22 }
23}

Member Function Documentation

◆ addItem()

BesTimer * BesTimerSvc::addItem ( const std::string &  name)
virtual

Implements IBesTimerSvc.

Definition at line 56 of file BesTimerSvc.cxx.

56 {
57
58 // Create a BesTimer and return a pointer to it
59 // If an item of that name already exists, flag error
60 // by returning NULL
61
62 MsgStream log(messageService(), name());
63 log << MSG::DEBUG << name() << " adding " << itemName << endreq;
64
65 BesTimer* item = new BesTimer(itemName);
66 m_itemList.push_back(item);
67 return item;
68}

◆ begin()

std::vector< BesTimer * >::iterator BesTimerSvc::begin ( void  )
virtual

Implements IBesTimerSvc.

Definition at line 114 of file BesTimerSvc.cxx.

114 {
115 return m_itemList.begin();
116}

◆ end()

std::vector< BesTimer * >::iterator BesTimerSvc::end ( void  )
virtual

Implements IBesTimerSvc.

Definition at line 117 of file BesTimerSvc.cxx.

117 {
118 return m_itemList.end();
119}

◆ finalize()

StatusCode BesTimerSvc::finalize ( )
virtual

Definition at line 47 of file BesTimerSvc.cxx.

47 {
48 MsgStream log(messageService(), name());
49 log << MSG::INFO << name() << ": End of Run Statistics" << endreq;
50 this->print();
51 return StatusCode::SUCCESS;
52}
virtual void print()
Definition: BesTimerSvc.cxx:70

◆ initialize()

StatusCode BesTimerSvc::initialize ( )
virtual

Definition at line 34 of file BesTimerSvc.cxx.

34 {
35 MsgStream log(messageService(), name());
36 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
37
38 StatusCode sc = Service::initialize();
39 if ( sc.isFailure() ) return sc;
40 // Set my own properties
41 setProperties();
42
43 return StatusCode::SUCCESS;
44}

◆ print()

void BesTimerSvc::print ( void  )
virtual

Implements IBesTimerSvc.

Definition at line 70 of file BesTimerSvc.cxx.

70 {
71 MsgStream log(messageService(), name());
72
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());
80 }
81 }
82
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;
89 }
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;
98
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;
103 } else {
104 log << MSG::INFO << nam << " mean(N) : " << std::setw(12) << (*it)->meanPropVal() <<
105 " mean(t/N) : "
106 << 1000.*(*it)->meanTimePerObject() << " us " << endreq;
107 }
108 }
109 }
110
111 log << MSG::INFO << "==============================BesTimerSvc::Print===============================" << endreq;
112 }

Referenced by finalize().

◆ queryInterface()

StatusCode BesTimerSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

Definition at line 25 of file BesTimerSvc.cxx.

25 {
26
27 if ( IID_IBesTimerSvc.versionMatch(riid) ) {
28 *ppvInterface = static_cast<IBesTimerSvc*> (this);
29 } else {
30 return Service::queryInterface(riid, ppvInterface) ;
31 }
32 return StatusCode::SUCCESS;
33}

The documentation for this class was generated from the following files: