Base class to provide some basic common infrastructure for timing measurements...
More...
#include <CaloGPUTimed.h>
|
| template<class T> |
| | CaloGPUTimed (T *ptr) |
| void | record_times (const size_t event_num, const std::vector< size_t > ×) const |
| template<class ... Args> |
| void | record_times (const size_t event_num, const size_t &value) const |
| template<class ... Args> |
| void | record_times (const size_t event_num, const size_t &value, Args &&... args) const |
| void | print_times (const std::string &header, const size_t time_size) const |
|
| std::shared_mutex | m_timeMutex |
| | Mutex that is locked when recording times.
|
| std::vector< size_t > m_times | ATLAS_THREAD_SAFE |
| | Vector to hold execution times to be recorded if necessary.
|
| std::vector< size_t > m_eventNumbers | ATLAS_THREAD_SAFE |
| | Vector to hold the event numbers to be recorded if necessary.
|
| Gaudi::Property< bool > | m_measureTimes |
| | If true, times are recorded to the file given by m_timeFileName.
|
| Gaudi::Property< std::string > | m_timeFileName |
| | File to which times should be saved.
|
Base class to provide some basic common infrastructure for timing measurements...
- Author
- Nuno Fernandes nuno..nosp@m.dos..nosp@m.santo.nosp@m.s.fe.nosp@m.rnand.nosp@m.es@c.nosp@m.ern.c.nosp@m.h
- Date
- 01 June 2022
Definition at line 24 of file CaloGPUTimed.h.
◆ CaloGPUTimed()
template<class T>
| CaloGPUTimed::CaloGPUTimed |
( |
T * | ptr | ) |
|
|
inlineprotected |
Definition at line 55 of file CaloGPUTimed.h.
55 :
56 m_measureTimes(ptr,
"MeasureTimes",
false,
"Save time measurements"),
57 m_timeFileName(ptr,
"TimeFileOutput",
"times.txt",
"File to which time measurements should be saved")
58 {
59 }
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
Gaudi::Property< std::string > m_timeFileName
File to which times should be saved.
◆ print_times()
| void CaloGPUTimed::print_times |
( |
const std::string & | header, |
|
|
const size_t | time_size ) const |
|
inlineprotected |
Definition at line 143 of file CaloGPUTimed.h.
144 {
145 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
146
148 {
149 return;
150 }
151
152 std::vector<size_t>
indices(m_eventNumbers.size());
153
156 {
157 return m_eventNumbers[a] < m_eventNumbers[b];
158 }
159 );
161
162 out <<
"Event_Number Total " <<
header <<
"\n";
163
164 for (const size_t idx : indices)
165 {
166 out << m_eventNumbers[
idx] <<
" ";
167
168 size_t total = 0;
169
170 for (
size_t i = 0;
i < time_size; ++
i)
171 {
172 total += m_times[
idx * time_size +
i];
173 }
174
176
177 for (
size_t i = 0;
i < time_size; ++
i)
178 {
179 out << m_times[
idx * time_size +
i] <<
" ";
180 }
182 }
183
185
187 }
std::shared_mutex m_timeMutex
Mutex that is locked when recording times.
std::pair< long int, long int > indices
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
◆ record_times() [1/3]
template<class ... Args>
| void CaloGPUTimed::record_times |
( |
const size_t | event_num, |
|
|
const size_t & | value ) const |
|
inlineprotected |
Definition at line 105 of file CaloGPUTimed.h.
106 {
107 const size_t time_size = 1;
108
109 size_t old_size;
110
111 {
112 std::unique_lock<std::shared_mutex> lock(
m_timeMutex);
113 old_size = m_times.size();
114 m_times.resize(old_size + time_size);
115 m_eventNumbers.push_back(event_num);
116 }
117 {
118 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
120 }
121 }
void record_times_helper(const size_t) const
◆ record_times() [2/3]
template<class ... Args>
| void CaloGPUTimed::record_times |
( |
const size_t | event_num, |
|
|
const size_t & | value, |
|
|
Args &&... | args ) const |
|
inlineprotected |
Definition at line 124 of file CaloGPUTimed.h.
125 {
126 const size_t time_size = sizeof...(args) + 1;
127
128 size_t old_size;
129
130 {
131 std::unique_lock<std::shared_mutex> lock(
m_timeMutex);
132 old_size = m_times.size();
133 m_times.resize(old_size + time_size);
134 m_eventNumbers.push_back(event_num);
135 }
136 {
137 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
139 }
140
141 }
◆ record_times() [3/3]
| void CaloGPUTimed::record_times |
( |
const size_t | event_num, |
|
|
const std::vector< size_t > & | times ) const |
|
inlineprotected |
Definition at line 86 of file CaloGPUTimed.h.
87 {
88 size_t old_size;
89 {
90 std::unique_lock<std::shared_mutex> lock(
m_timeMutex);
91 old_size = m_times.size();
92 m_times.resize(old_size +
times.size());
93 m_eventNumbers.push_back(event_num);
94 }
95 {
96 std::shared_lock<std::shared_mutex> lock(
m_timeMutex);
97 for (
size_t i = 0;
i <
times.size(); ++
i)
98 {
99 m_times[old_size +
i] =
times[
i];
100 }
101 }
102 }
◆ record_times_helper() [1/3]
template<class Arg>
| void CaloGPUTimed::record_times_helper |
( |
const size_t | index, |
|
|
Arg && | arg ) const |
|
inlineprivate |
Definition at line 70 of file CaloGPUTimed.h.
71 {
72
73 m_times[
index] = std::forward<Arg>(arg);
74
75
76 }
◆ record_times_helper() [2/3]
| void CaloGPUTimed::record_times_helper |
( |
const size_t | | ) |
const |
|
inlineprivate |
◆ record_times_helper() [3/3]
template<class ... Args>
| void CaloGPUTimed::record_times_helper |
( |
size_t | index, |
|
|
Args &&... | args ) const |
|
inlineprivate |
◆ ATLAS_THREAD_SAFE [1/2]
| std::vector<size_t> m_times CaloGPUTimed::ATLAS_THREAD_SAFE |
|
mutableprotected |
Vector to hold execution times to be recorded if necessary.
Definition at line 35 of file CaloGPUTimed.h.
◆ ATLAS_THREAD_SAFE [2/2]
| std::vector<size_t> m_eventNumbers CaloGPUTimed::ATLAS_THREAD_SAFE |
|
mutableprotected |
Vector to hold the event numbers to be recorded if necessary.
Definition at line 40 of file CaloGPUTimed.h.
◆ m_measureTimes
| Gaudi::Property<bool> CaloGPUTimed::m_measureTimes |
|
protected |
If true, times are recorded to the file given by m_timeFileName.
Defaults to false.
Definition at line 46 of file CaloGPUTimed.h.
◆ m_timeFileName
| Gaudi::Property<std::string> CaloGPUTimed::m_timeFileName |
|
protected |
File to which times should be saved.
Definition at line 50 of file CaloGPUTimed.h.
◆ m_timeMutex
| std::shared_mutex CaloGPUTimed::m_timeMutex |
|
mutableprotected |
Mutex that is locked when recording times.
Definition at line 32 of file CaloGPUTimed.h.
The documentation for this class was generated from the following file: