BOSS 7.1.1
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 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 ()
 

Detailed Description

Definition at line 17 of file BesTimerSvc.h.

Constructor & Destructor Documentation

◆ BesTimerSvc()

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

Definition at line 17 of file BesTimerSvc.cxx.

17: base_class(name, svcloc) {}

◆ ~BesTimerSvc()

BesTimerSvc::~BesTimerSvc ( )

Definition at line 19 of file BesTimerSvc.cxx.

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

Member Function Documentation

◆ addItem()

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

Definition at line 57 of file BesTimerSvc.cxx.

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

◆ begin()

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

Definition at line 115 of file BesTimerSvc.cxx.

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

◆ end()

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

Definition at line 118 of file BesTimerSvc.cxx.

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

◆ finalize()

StatusCode BesTimerSvc::finalize ( )
virtual

Definition at line 48 of file BesTimerSvc.cxx.

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

◆ initialize()

StatusCode BesTimerSvc::initialize ( )
virtual

Definition at line 35 of file BesTimerSvc.cxx.

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

◆ print()

void BesTimerSvc::print ( )
virtual

Definition at line 71 of file BesTimerSvc.cxx.

71 {
72 MsgStream log(messageService(), name());
73
74 log << MSG::INFO << "==============================BesTimerSvc::Print===============================" << endreq;
75 unsigned int maxname=0;
76 std::vector < BesTimer* >::iterator it = m_itemList.begin();
77 for (; it != m_itemList.end(); it++) {
78 if ((*it)->name().length() > maxname) maxname = static_cast<int>((*it)->name().length());
79 if (!(*it)->propName().empty()) {
80 if ((*it)->propName().length() > maxname) maxname = static_cast<int>((*it)->propName().length());
81 }
82 }
83
84 it = m_itemList.begin();
85 for (; it != m_itemList.end(); it++) {
86 std::string nam = (*it)->name();
87 for (unsigned int i = static_cast<int>(nam.length()); i<maxname; i++) nam.insert(i," ");
88 log << MSG::INFO << nam << " mean(t) : " << std::setw(12) << (*it)->mean()<<
89 " ms rms : " << std::setw(12) << (*it)->rms() << " ms " << endreq;
90 }
91 log << MSG::INFO << "------------------------------------------------------------------------------" << endreq;
92 it = m_itemList.begin();
93 for (; it != m_itemList.end(); it++) {
94 if (!(*it)->propName().empty()) {
95 std::string nam = (*it)->name();
96 for (unsigned int i = static_cast<int>(nam.length()); i<maxname; i++) nam.insert(i," ");
97 log << MSG::INFO << nam << " mean(t) : " << std::setw(12) << (*it)->mean()<<
98 " ms rms : " << std::setw(12) << (*it)->rms() << " ms " << endreq;
99
100 nam = (*it)->propName();
101 for (unsigned int i = static_cast<int>(nam.length()); i<maxname; i++) nam.insert(i," ");
102 if ((*it)->meanPropVal() == 0) {
103 log << MSG::INFO << nam << " mean(N) : " << std::setw(12) << endreq;
104 } else {
105 log << MSG::INFO << nam << " mean(N) : " << std::setw(12) << (*it)->meanPropVal() <<
106 " mean(t/N) : "
107 << 1000.*(*it)->meanTimePerObject() << " us " << endreq;
108 }
109 }
110 }
111
112 log << MSG::INFO << "==============================BesTimerSvc::Print===============================" << endreq;
113 }

Referenced by finalize().


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