| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TimerForSequencer.cpp
Go to the documentation of this file.
1
2 // local
3 #include "TimerForSequencer.h"
4
5 //-----------------------------------------------------------------------------
6 // Implementation file for class : TimerForSequencer
7 //
8 // 2013-04-21 : Chris Jones
9 //-----------------------------------------------------------------------------
10
11 double TimerForSequencer::stop()
12 {
13 double cpuTime = double(System::cpuTime( System::microSec ) - m_startCpu );
14 double lastTime = double(System::currentTime( System::microSec ) - m_startClock );
15
16 //== Change to normalized millisecond
17 cpuTime *= m_factor;
18 lastTime *= m_factor;
19
20 //== Update the counter
21 m_num += 1;
22 m_sum += lastTime;
23 m_sumCpu += cpuTime;
24
25 if ( 1 == m_num )
26 {
27 m_min = lastTime;
28 m_max = lastTime;
29 }
30 else
31 {
32 if ( lastTime < m_min ) m_min = lastTime;
33 if ( lastTime > m_max ) m_max = lastTime;
34 }
35 m_lastTime = lastTime;
36 m_lastCpu = cpuTime;
37 return lastTime;
38 }
39
40 MsgStream & TimerForSequencer::fillStream(MsgStream & s) const
41 {
42 double ave = 0.;
43 double cpu = 0.;
44
45 if ( 0 != m_num )
46 {
47 ave = m_sum / m_num;
48 cpu = m_sumCpu / m_num;
49 }
50
51 return s << m_name.substr(0,m_size)
52 << format( "| %9.3f | %9.3f | %8.3f %9.1f | %7d | %9.3f |",
53 cpu, ave, m_min, m_max, m_num, m_sum * 0.001 );
54 }
55
56 std::string TimerForSequencer::header( std::string::size_type size )
57 {
58 if ( size < 21 ) size = 21;
59 const std::string blank( size - 20, ' ' );
60 const std::string s =
61 "Algorithm" + blank + "(millisec) | <user> | <clock> |" +
62 " min max | entries | total (s) |";
63 return s;
64 }