174 {
177
179 return StatusCode::SUCCESS;
180 }
181
182
183
185
186
188
189
190
191
192
193
195
196
197
198
200 {
203 tbb::concurrent_hash_map<AlgorithmIdentifier, TrigTimeStamp, AlgorithmIdentifierHashCompare>::const_accessor stopTimeAcessor;
206 } else {
207
208 eventStopTime = stopTimeAcessor->second.microsecondsSinceEpoch();
209 }
210 }
211
212
214 {
217 tbb::concurrent_hash_map<AlgorithmIdentifier, AlgorithmPayload, AlgorithmIdentifierHashCompare>::const_accessor startAcessor;
220 } else {
221
222 eventStartTime = startAcessor->second.m_algStartTime.microsecondsSinceEpoch();
223 }
224 }
225
226
227 tbb::concurrent_hash_map< AlgorithmIdentifier, AlgorithmPayload, AlgorithmIdentifierHashCompare>::const_iterator beginIt;
228 tbb::concurrent_hash_map< AlgorithmIdentifier, AlgorithmPayload, AlgorithmIdentifierHashCompare>::const_iterator endIt;
229 tbb::concurrent_hash_map< AlgorithmIdentifier, AlgorithmPayload, AlgorithmIdentifierHashCompare>::const_iterator
it;
231
232 ATH_MSG_DEBUG(
"Monitored event with " << std::distance(beginIt, endIt) <<
" AlgorithmPayload objects.");
233
234 std::map<size_t, size_t> aiToHandleIndex;
235 for (it = beginIt;
it != endIt; ++
it) {
236 const AlgorithmIdentifier& ai =
it->first;
237 const AlgorithmPayload&
ap =
it->second;
239
240
242 {
243 tbb::concurrent_hash_map<AlgorithmIdentifier, TrigTimeStamp, AlgorithmIdentifierHashCompare>::const_accessor stopTimeAcessor;
246 } else {
247 stopTime = stopTimeAcessor->second.microsecondsSinceEpoch();
248 }
249
250 }
251
252
253
254
255 if (startTime > stopTime) {
256 ATH_MSG_VERBOSE(
"Disregard start-time:" << startTime <<
" > stop-time:" << stopTime
258 continue;
259 }
260
261
262
263
264
265
266 if (startTime > eventStopTime) {
268 continue;
269 }
270 if (stopTime > eventStopTime) {
272 << " truncating its ending time stamp from " << stopTime << " to " << eventStopTime);
273 stopTime = eventStopTime;
274 }
275
276
277
278
279 if (stopTime < eventStartTime) {
281 continue;
282 }
283 if (startTime < eventStartTime) {
285 << " truncating its starting time stamp from " << startTime << " to " << eventStartTime);
287 }
288
289
291 costOutputHandle->push_back(
tc );
292
293
294 const uint32_t threadID =
static_cast<uint32_t>( std::hash< std::thread::id >()(
ap.m_algThreadID) );
296 {
297
299 const std::unordered_map<uint32_t, uint32_t>::const_iterator mapIt =
m_threadToCounterMap.find(threadID);
303 } else {
304 threadEnumerator = mapIt->second;
305 }
306 }
307
312 result &=
tc->setDetail(
"thread", threadEnumerator);
313 result &=
tc->setDetail(
"thash", threadID);
315 result &=
tc->setDetail(
"roi",
ap.m_algROIID);
316 result &=
tc->setDetail(
"start", startTime);
317 result &=
tc->setDetail(
"stop", stopTime);
318 if (!result)
ATH_MSG_WARNING(
"Failed to append one or more details to trigger cost TC");
319
320 aiToHandleIndex[ai.
m_hash] = costOutputHandle->size() - 1;
321 }
322
323 if (
msg().
level() <= MSG::VERBOSE) {
335 }
336 }
337
338 return StatusCode::SUCCESS;
339}
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
static const std::string hash2string(HLTHash, const std::string &category=s_defaultCategory)
hash function translating identifiers into names (via internal dictionary)
virtual StatusCode processAlg(const EventContext &context, const std::string &caller, const AuditType type) override
Implementation of ITrigCostSvc::processAlg.
Gaudi::Property< std::string > m_costFinalizeAlgName
Gaudi::Property< std::string > m_costSupervisorAlgName
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
static AlgorithmIdentifier make(const EventContext &context, const std::string &caller, MsgStream &msg, const int16_t slotOverride=-1)
Construct an AlgorithmIdentifier.
std::string m_caller
Name of the algorithm.
std::string m_store
Name of the algorithm's store.
TrigConf::HLTHash callerHash(MsgStream &msg) const
TrigConf::HLTHash storeHash(MsgStream &msg) const
size_t m_hash
Hash of algorithm + store + realSlot.
StatusCode isValid() const
int16_t m_viewID
If not within an event view, then the m_iewID = s_noView = -1.