ATLAS Offline Software
Loading...
Searching...
No Matches
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
22
23// C/C++
24#include <stdint.h>
25
27{
28 public:
29
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
58inline bool operator==(const TrigMonTimer &lhs, const TrigMonTimer &rhs) {
59 return lhs.getEncoded() == rhs.getEncoded();
60}
61inline bool operator <(const TrigMonTimer &lhs, const TrigMonTimer &rhs) {
62 return lhs.getEncoded() < rhs.getEncoded();
63}
64
65CLASS_DEF( TrigMonTimer , 255578247 , 1 )
66
67#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
bool operator<(const TrigMonTimer &lhs, const TrigMonTimer &rhs)
bool operator==(const TrigMonTimer &lhs, const TrigMonTimer &rhs)
uint32_t getSec() const
double elapsed(const TrigMonTimer &start) const
uint32_t getUSec() const
uint32_t getMicroSec() const
uint32_t m_encoded
double getElapsed(const TrigMonTimer &start) const
uint32_t getEncoded() const