ATLAS Offline Software
Tools
PmbCxxUtils
PmbCxxUtils
BasicStopWatch.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef PMONUTILS_BASICSTOPWATCH_H
6
#define PMONUTILS_BASICSTOPWATCH_H
7
8
#include <chrono>
9
#include <string>
10
11
#include "tbb/concurrent_hash_map.h"
12
13
namespace
PMonUtils
{
14
15
typedef
tbb::concurrent_hash_map<std::string, double>
BasicStopWatchResultMap_t
;
16
17
class
BasicStopWatch
{
18
19
public
:
20
// Constructor
21
BasicStopWatch
(
const
std::string&
name
,
BasicStopWatchResultMap_t
&
result
) :
22
m_name
(
name
),
m_result
(
result
),
m_start
(std::chrono::steady_clock::
now
()) { }
23
24
// Destructor
25
~BasicStopWatch
() {
26
std::chrono::duration<double, std::milli> total =
std::chrono::steady_clock::now
() -
m_start
;
27
tbb::concurrent_hash_map<std::string, double>::accessor
acc
;
28
m_result
.insert(
acc
,
m_name
);
29
acc
->second += total.count();
30
acc
.release();
31
}
32
33
private
:
34
// Name of the current StopWatch
35
std::string
m_name
;
36
37
// Reference to the BasicStopWatchResultMap_t
38
BasicStopWatchResultMap_t
&
m_result
;
39
40
// Start time of the current StopWatch
41
std::chrono::time_point<std::chrono::steady_clock>
m_start
;
42
43
};
// end class BasicStopWatch
44
45
}
// end namespace PMonUtils
46
47
#endif
PMonUtils::BasicStopWatch::m_name
std::string m_name
Definition:
BasicStopWatch.h:35
get_generator_info.result
result
Definition:
get_generator_info.py:21
PMonUtils::BasicStopWatchResultMap_t
tbb::concurrent_hash_map< std::string, double > BasicStopWatchResultMap_t
Definition:
BasicStopWatch.h:15
PMonUtils::BasicStopWatch
Definition:
BasicStopWatch.h:17
PMonUtils
Definition:
SimKernel.h:33
PMonUtils::BasicStopWatch::m_result
BasicStopWatchResultMap_t & m_result
Definition:
BasicStopWatch.h:38
python.handimod.now
now
Definition:
handimod.py:675
PMonUtils::BasicStopWatch::BasicStopWatch
BasicStopWatch(const std::string &name, BasicStopWatchResultMap_t &result)
Definition:
BasicStopWatch.h:21
PMonUtils::BasicStopWatch::~BasicStopWatch
~BasicStopWatch()
Definition:
BasicStopWatch.h:25
AthenaPoolTestRead.acc
acc
Definition:
AthenaPoolTestRead.py:16
PMonUtils::BasicStopWatch::m_start
std::chrono::time_point< std::chrono::steady_clock > m_start
Definition:
BasicStopWatch.h:41
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
xAOD::JetAttributeAccessor::accessor
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
Definition:
JetAccessorMap.h:26
Generated on Sun Dec 22 2024 21:07:23 for ATLAS Offline Software by
1.8.18