ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8#include "CounterSequence.h"
9#include <cstdint>
10
11
12CounterSequence::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}
21
22
23StatusCode CounterSequence::newEvent(const CostData& data, size_t index, const float weight) {
24
25 ATH_CHECK( increment("Sequence_perEvent", weight) );
26 float viewTime = 0;
27 // Monitor algorithms associated with sequence name
28 const std::string slotStr{"slot"};
29 const std::string startStr{"start"};
30 const std::string stopStr{"stop"};
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>(slotStr);
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>(startStr); // in mus
42 const uint64_t stop = alg->getDetail<uint64_t>(stopStr); // in mus
43 const float cpuTime = timeToMilliSec(start, stop);
44 ATH_CHECK( fill("Time_perEvent", cpuTime, weight) );
45 viewTime += cpuTime;
46
47 }
48
49 ATH_CHECK( fill("Time_perCall", viewTime, weight) );
50
51 return StatusCode::SUCCESS;
52}
#define ATH_CHECK
Evaluate an expression and check for errors.
@ kPerEvent
Variable should buffer fill calls in an accumulator and fill the underlying histogram once at the end...
Definition Variable.h:21
@ kPerCall
Variable should fill underlying histogram on each fill.
Definition Variable.h:20
@ kLinear
Linear x-binning.
Definition Variable.h:29
Caches and propagates event data to be used by monitoring algorithms.
Definition CostData.h:26
float timeToMilliSec(const uint64_t start, const uint64_t stop) const
Helper function.
CounterBase()=delete
Forbid default constructor.
StatusCode increment(std::string_view name, float weight=1.0)
Convenience function.
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.
const std::string & getName() const
Getter for Counter's name.
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...
virtual StatusCode newEvent(const CostData &data, size_t index, const float weight=1.) override
Concrete implimentation.
CounterSequence()=delete
Forbid default constructor.
Definition index.py:1
TrigComposite_v1 TrigComposite
Declare the latest version of the class.