ATLAS Offline Software
TrigMonTimer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGMON_TIMER_H
6 #define TRIGMON_TIMER_H
7 
8 /*
9  @author Rustem Ospanov
10  @date July 2009
11 
12  @brief Time stamp encoded as int and microsecond.
13  Sec has range from 0 to 3599.
14  Microsec has range from 0 to 999999.
15  Elapsed time is computed by passing starting time stamp to
16  getElapsed() function. Only time periods that are less
17  than one hour can be measured.
18 */
19 
20 // Framework
21 #include "AthenaKernel/CLASS_DEF.h"
22 
23 // C/C++
24 #include <stdint.h>
25 
27 {
28  public:
29 
30  TrigMonTimer();
31  TrigMonTimer(long int tv_sec, long int tv_usec);
32  explicit TrigMonTimer(uint32_t encoded);
34 
35  uint32_t getSec() const;
36  uint32_t getUSec() const { return getMicroSec(); }
37  uint32_t getMicroSec() const;
38  uint32_t getEncoded() const { return m_encoded; }
39 
40  double elapsed(const TrigMonTimer &start) const { return getElapsed(start); }
41  double getElapsed(const TrigMonTimer &start) const;
42 
43  private:
44 
45  uint32_t m_encoded; // encoded timestamp
46 };
47 
48 //
49 // store encoded timestamp in 32 bits
50 //
51 // ss...suu...u
52 //
53 // seconds [s] 12 bits, actual values: (0: 3,600)
54 // microseconds [u] 20 bits, actual values: (0:1,000,000)
55 //
56 //
57 
58 inline bool operator==(const TrigMonTimer &lhs, const TrigMonTimer &rhs) {
59  return lhs.getEncoded() == rhs.getEncoded();
60 }
61 inline bool operator <(const TrigMonTimer &lhs, const TrigMonTimer &rhs) {
62  return lhs.getEncoded() < rhs.getEncoded();
63 }
64 
65 CLASS_DEF( TrigMonTimer , 255578247 , 1 )
66 
67 #endif
TrigMonTimer::elapsed
double elapsed(const TrigMonTimer &start) const
Definition: TrigMonTimer.h:40
TrigMonTimer::~TrigMonTimer
~TrigMonTimer()
Definition: TrigMonTimer.h:33
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
operator==
bool operator==(const TrigMonTimer &lhs, const TrigMonTimer &rhs)
Definition: TrigMonTimer.h:58
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
TrigMonTimer
Definition: TrigMonTimer.h:27
TrigMonTimer::getSec
uint32_t getSec() const
Definition: TrigMonTimer.cxx:61
TrigMonTimer::getElapsed
double getElapsed(const TrigMonTimer &start) const
Definition: TrigMonTimer.cxx:75
TrigMonTimer::m_encoded
uint32_t m_encoded
Definition: TrigMonTimer.h:45
TrigMonTimer::getMicroSec
uint32_t getMicroSec() const
Definition: TrigMonTimer.cxx:68
TrigMonTimer::getUSec
uint32_t getUSec() const
Definition: TrigMonTimer.h:36
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
operator<
bool operator<(const TrigMonTimer &lhs, const TrigMonTimer &rhs)
Definition: TrigMonTimer.h:61
CLASS_DEF.h
macros to associate a CLID to a type
TrigMonTimer::TrigMonTimer
TrigMonTimer()
Definition: TrigMonTimer.cxx:25
TrigMonTimer::getEncoded
uint32_t getEncoded() const
Definition: TrigMonTimer.h:38