ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigCost
TrigCostAnalysis
src
counters
CounterSequence.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
xAODTrigger/TrigCompositeContainer.h
"
6
#include "
TrigDataAccessMonitoring/ROBDataMonitor.h
"
7
8
#include "
CounterSequence.h
"
9
#include <cstdint>
10
11
12
CounterSequence::CounterSequence
(
const
std::string& name,
const
MonitorBase
* parent)
13
:
CounterBase
(name, parent)
14
{
15
regHistogram
(
"Sequence_perEvent"
,
"Sequnece calls/Event;Sequence call;Events"
,
VariableType::kPerEvent
,
kLinear
, -0.5, 49.5);
16
regHistogram
(
"AlgCalls_perEvent"
,
"Algorithm Calls/Event;Calls;Events"
,
VariableType::kPerEvent
,
kLinear
, -0.5, 499.5, 100);
17
regHistogram
(
"Time_perCall"
,
"CPU Time/Call;Time [ms];Calls"
,
VariableType::kPerCall
);
18
regHistogram
(
"Time_perEvent"
,
"CPU Time/Event;Time [ms];Events"
,
VariableType::kPerEvent
);
19
regHistogram
(
"Request_perEvent"
,
"Number of requests/Event;Number of requests;Events"
,
VariableType::kPerEvent
,
LogType::kLinear
, -0.5, 299.5, 300);
20
regHistogram
(
"NetworkRequest_perEvent"
,
"Number of network requests/Event;Number of requests;Events"
,
VariableType::kPerEvent
,
LogType::kLinear
, -0.5, 149.5, 150);
21
regHistogram
(
"CachedROBSize_perEvent"
,
"Cached ROB Size/Event;ROB size;Events"
,
VariableType::kPerEvent
,
LogType::kLinear
, 0, 1024, 50);
22
regHistogram
(
"NetworkROBSize_perEvent"
,
"Network ROB Size/Event;ROB size;Events"
,
VariableType::kPerEvent
,
LogType::kLinear
, 0, 1024, 50);
23
regHistogram
(
"RequestTime_perEvent"
,
"ROB Elapsed Time/Event;Elapsed Time [ms];Events"
,
VariableType::kPerEvent
);
24
}
25
26
27
StatusCode
CounterSequence::newEvent
(
const
CostData
& data,
size_t
index
,
const
float
weight) {
28
29
ATH_CHECK
(
increment
(
"Sequence_perEvent"
, weight) );
30
float
viewTime = 0;
31
// Monitor algorithms associated with sequence name
32
const
std::string slotStr{
"slot"
};
33
const
std::string startStr{
"start"
};
34
const
std::string stopStr{
"stop"
};
35
for
(
const
size_t
algIndex : data.sequencersMap().at(
getName
()).at(
index
)){
36
37
const
xAOD::TrigComposite
* alg = data.costCollection().at(algIndex);
38
const
uint32_t slot = alg->getDetail<uint32_t>(slotStr);
39
if
(slot != data.onlineSlot()) {
40
continue
;
// When monitoring the master slot, this Monitor ignores algs running in different slots
41
}
42
43
ATH_CHECK
(
increment
(
"AlgCalls_perEvent"
, weight) );
44
45
const
uint64_t start = alg->getDetail<uint64_t>(startStr);
// in mus
46
const
uint64_t stop = alg->getDetail<uint64_t>(stopStr);
// in mus
47
const
float
cpuTime =
timeToMilliSec
(start, stop);
48
ATH_CHECK
(
fill
(
"Time_perEvent"
, cpuTime, weight) );
49
viewTime += cpuTime;
50
51
// Monitor data requests
52
if
(!data.algToRequestMap().count(algIndex))
continue
;
53
static
const
std::string historyStr{
"robs_history"
};
54
static
const
std::string sizeStr{
"robs_size"
};
55
for
(
size_t
requestIdx : data.algToRequestMap().at(algIndex)) {
56
const
xAOD::TrigComposite
* request = data.rosCollection().at(requestIdx);
57
const
std::vector<unsigned> robs_history = request->
getDetail
<std::vector<unsigned>>(historyStr);
58
const
std::vector<uint32_t> robs_size = request->
getDetail
<std::vector<uint32_t>>(sizeStr);
59
60
bool
networkRequestIncremented =
false
;
61
for
(
size_t
i = 0; i < robs_size.size(); ++i) {
62
// ROB request was fetched over the network
63
if
(robs_history[i] ==
robmonitor::RETRIEVED
) {
64
// size is stored in words, should be in kilobytes
65
ATH_CHECK
(
fill
(
"NetworkROBSize_perEvent"
, robs_size[i] / 500., weight) );
66
networkRequestIncremented =
true
;
67
}
68
// ROB request was cached
69
else
if
(robs_history[i] ==
robmonitor::HLT_CACHED
|| robs_history[i] ==
robmonitor::DCM_CACHED
) {
70
ATH_CHECK
(
fill
(
"CachedROBSize_perEvent"
, robs_size[i] / 500., weight) );
71
}
72
}
73
74
ATH_CHECK
(
increment
(
"Request_perEvent"
, weight) );
75
76
if
(networkRequestIncremented) {
77
ATH_CHECK
(
increment
(
"NetworkRequest_perEvent"
, weight) );
78
}
79
80
const
float
rosTime =
timeToMilliSec
(request->
getDetail
<uint64_t>(startStr), request->
getDetail
<uint64_t>(stopStr));
81
ATH_CHECK
(
fill
(
"RequestTime_perEvent"
, rosTime, weight) );
82
}
83
}
84
85
ATH_CHECK
(
fill
(
"Time_perCall"
, viewTime, weight) );
86
87
return
StatusCode::SUCCESS;
88
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CounterSequence.h
ROBDataMonitor.h
TrigCompositeContainer.h
kPerEvent
@ kPerEvent
Variable should buffer fill calls in an accumulator and fill the underlying histogram once at the end...
Definition
Variable.h:21
kPerCall
@ kPerCall
Variable should fill underlying histogram on each fill.
Definition
Variable.h:20
kLinear
@ kLinear
Linear x-binning.
Definition
Variable.h:29
CostData
Caches and propagates event data to be used by monitoring algorithms.
Definition
CostData.h:26
CounterBase::timeToMilliSec
float timeToMilliSec(const uint64_t start, const uint64_t stop) const
Helper function.
Definition
CounterBase.cxx:245
CounterBase::CounterBase
CounterBase()=delete
Forbid default constructor.
CounterBase::increment
StatusCode increment(std::string_view name, float weight=1.0)
Convenience function.
Definition
CounterBase.cxx:222
CounterBase::regHistogram
void regHistogram(const std::string &name, const std::string &title, const VariableType type=VariableType::kPerCall, const LogType xaxis=kLog, const float min=0.1, const float max=1000000., const size_t bins=70)
Book a histogram for this Counter, to be filled in per-event monitoring.
Definition
CounterBase.cxx:29
CounterBase::getName
const std::string & getName() const
Getter for Counter's name.
Definition
CounterBase.cxx:19
CounterBase::fill
StatusCode fill(std::string_view name, float value, float weight=1.0)
Fill (for per-Call) or accumulate in a buffer (for per-Event) a quantity histogrammed by a named Vari...
Definition
CounterBase.cxx:193
CounterSequence::newEvent
virtual StatusCode newEvent(const CostData &data, size_t index, const float weight=1.) override
Concrete implimentation.
Definition
CounterSequence.cxx:27
CounterSequence::CounterSequence
CounterSequence()=delete
Forbid default constructor.
MonitorBase
Forward declare.
Definition
Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h:33
xAOD::TrigComposite_v1::getDetail
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
index
Definition
index.py:1
robmonitor::RETRIEVED
@ RETRIEVED
Definition
ROBDataMonitor.h:26
robmonitor::DCM_CACHED
@ DCM_CACHED
Definition
ROBDataMonitor.h:28
robmonitor::HLT_CACHED
@ HLT_CACHED
Definition
ROBDataMonitor.h:27
xAOD::TrigComposite
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Definition
TrigComposite.h:16
Generated on
for ATLAS Offline Software by
1.17.0