BOSS 8.0.0
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 19 of file BesTimerSvc.h.

Constructor & Destructor Documentation

◆ BesTimerSvc()

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

Definition at line 16 of file BesTimerSvc.cxx.

17 : base_class( name, svcloc ) {}

Referenced by BesTimerSvc().

◆ ~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++ ) { delete ( *it ); }
22}

Member Function Documentation

◆ addItem()

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

Definition at line 52 of file BesTimerSvc.cxx.

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

◆ begin()

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

Definition at line 126 of file BesTimerSvc.cxx.

126{ return m_itemList.begin(); }

◆ end()

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

Definition at line 127 of file BesTimerSvc.cxx.

127{ return m_itemList.end(); }

◆ finalize()

StatusCode BesTimerSvc::finalize ( )
virtual

Definition at line 45 of file BesTimerSvc.cxx.

45 {
46 MsgStream log( msgSvc(), name() );
47 log << MSG::INFO << name() << ": End of Run Statistics" << endmsg;
48 this->print();
49 return StatusCode::SUCCESS;
50}
virtual void print()

◆ initialize()

StatusCode BesTimerSvc::initialize ( )
virtual

Definition at line 33 of file BesTimerSvc.cxx.

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

◆ print()

void BesTimerSvc::print ( )
virtual

Definition at line 66 of file BesTimerSvc.cxx.

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

Referenced by finalize().


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