ATLAS Offline Software
CounterSequence.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "CounterSequence.h"
9 
10 
13 {
14  regHistogram("Sequence_perEvent", "Sequnece calls/Event;Sequence call;Events", VariableType::kPerEvent, kLinear, -0.5, 49.5);
15  regHistogram("AlgCalls_perEvent", "Algorithm Calls/Event;Calls;Events", VariableType::kPerEvent, kLinear, -0.5, 499.5, 100);
16  regHistogram("Time_perCall", "CPU Time/Call;Time [ms];Calls", VariableType::kPerCall);
17  regHistogram("Time_perEvent", "CPU Time/Event;Time [ms];Events", VariableType::kPerEvent);
18  regHistogram("Request_perEvent", "Number of requests/Event;Number of requests;Events", VariableType::kPerEvent, LogType::kLinear, -0.5, 299.5, 300);
19  regHistogram("NetworkRequest_perEvent", "Number of network requests/Event;Number of requests;Events", VariableType::kPerEvent, LogType::kLinear, -0.5, 149.5, 150);
20  regHistogram("CachedROBSize_perEvent", "Cached ROB Size/Event;ROB size;Events", VariableType::kPerEvent, LogType::kLinear, 0, 1024, 50);
21  regHistogram("NetworkROBSize_perEvent", "Network ROB Size/Event;ROB size;Events", VariableType::kPerEvent, LogType::kLinear, 0, 1024, 50);
22  regHistogram("RequestTime_perEvent", "ROB Elapsed Time/Event;Elapsed Time [ms];Events", VariableType::kPerEvent);
23 }
24 
25 
27 
28  ATH_CHECK( increment("Sequence_perEvent", weight) );
29  float viewTime = 0;
30  // Monitor algorithms associated with sequence name
31  for (const size_t algIndex : data.sequencersMap().at(getName()).at(index)){
32 
33  const xAOD::TrigComposite* alg = data.costCollection().at(algIndex);
34  const uint32_t slot = alg->getDetail<uint32_t>("slot");
35  if (slot != data.onlineSlot()) {
36  continue; // When monitoring the master slot, this Monitor ignores algs running in different slots
37  }
38 
39  ATH_CHECK( increment("AlgCalls_perEvent", weight) );
40 
41  const uint64_t start = alg->getDetail<uint64_t>("start"); // in mus
42  const uint64_t stop = alg->getDetail<uint64_t>("stop"); // in mus
43  const float cpuTime = timeToMilliSec(start, stop);
44  ATH_CHECK( fill("Time_perEvent", cpuTime, weight) );
45  viewTime += cpuTime;
46 
47  // Monitor data requests
48  if (!data.algToRequestMap().count(algIndex)) continue;
49 
50  for (size_t requestIdx : data.algToRequestMap().at(algIndex)) {
51  const xAOD::TrigComposite* request = data.rosCollection().at(requestIdx);
52  const std::vector<unsigned> robs_history = request->getDetail<std::vector<unsigned>>("robs_history");
53  const std::vector<uint32_t> robs_size = request->getDetail<std::vector<uint32_t>>("robs_size");
54 
55  bool networkRequestIncremented = false;
56  for (size_t i = 0; i < robs_size.size(); ++i) {
57  // ROB request was fetched over the network
58  if (robs_history[i] == robmonitor::RETRIEVED) {
59  // size is stored in words, should be in kilobytes
60  ATH_CHECK( fill("NetworkROBSize_perEvent", robs_size[i] / 500., weight) );
61  networkRequestIncremented = true;
62  }
63  // ROB request was cached
64  else if (robs_history[i] == robmonitor::HLT_CACHED || robs_history[i] == robmonitor::DCM_CACHED) {
65  ATH_CHECK( fill("CachedROBSize_perEvent", robs_size[i] / 500., weight) );
66  }
67  }
68 
69  ATH_CHECK( increment("Request_perEvent", weight) );
70 
71  if (networkRequestIncremented) {
72  ATH_CHECK( increment("NetworkRequest_perEvent", weight) );
73  }
74 
75  const float rosTime = timeToMilliSec(request->getDetail<uint64_t>("start"), request->getDetail<uint64_t>("stop"));
76  ATH_CHECK( fill("RequestTime_perEvent", rosTime, weight) );
77  }
78  }
79 
80  ATH_CHECK( fill("Time_perCall", viewTime, weight) );
81 
82  return StatusCode::SUCCESS;
83 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
CounterSequence.h
CounterBase
Forward declare.
Definition: CounterBase.h:25
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:27
SGout2dot.alg
alg
Definition: SGout2dot.py:243
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
index
Definition: index.py:1
CounterBase::fill
StatusCode fill(const std::string &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:191
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
robmonitor::DCM_CACHED
@ DCM_CACHED
Definition: ROBDataMonitor.h:30
kPerEvent
@ kPerEvent
Variable should buffer fill calls in an accumulator and fill the underlying histogram once at the end...
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:19
ROBDataMonitor.h
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
CounterBase::getName
const std::string & getName() const
Getter for Counter's name.
Definition: CounterBase.cxx:17
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
TrigCompositeContainer.h
kPerCall
@ kPerCall
Variable should fill underlying histogram on each fill.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:18
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CounterSequence::CounterSequence
CounterSequence()=delete
Forbid default constructor.
kLinear
@ kLinear
Linear x-binning.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/Variable.h:27
MonitorBase
Forward declare.
Definition: Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h:33
robmonitor::RETRIEVED
@ RETRIEVED
Definition: ROBDataMonitor.h:28
robmonitor::HLT_CACHED
@ HLT_CACHED
Definition: ROBDataMonitor.h:29
CounterBase::increment
StatusCode increment(const std::string &name, float weight=1.0)
Convenience function.
Definition: CounterBase.cxx:220
xAOD::TrigComposite_v1::getDetail
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
CounterBase::timeToMilliSec
float timeToMilliSec(const uint64_t start, const uint64_t stop) const
Helper function.
Definition: CounterBase.cxx:243
CounterSequence::newEvent
virtual StatusCode newEvent(const CostData &data, size_t index, const float weight=1.) override
Concrete implimentation.
Definition: CounterSequence.cxx:26
CostData
Caches and propagates event data to be used by monitoring algorithms.
Definition: CostData.h:26