ATLAS Offline Software
Loading...
Searching...
No Matches
ROBDataMonitor.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <iomanip>
7
8using namespace robmonitor;
9
10//
11//--- ROBDataStruct
12// -------------
13ROBDataStruct::ROBDataStruct(const uint32_t srcId)
14 : rob_id(srcId)
15{}
16
18 return ((rob_history == robmonitor::UNCLASSIFIED) ? true : false);
19}
20
22 return ((rob_history == robmonitor::HLT_CACHED) ? true : false);
23}
24
26 return ((rob_history == robmonitor::DCM_CACHED) ? true : false);
27}
28
30 return ((rob_history == robmonitor::RETRIEVED) ? true : false);
31}
32
34 return ((rob_history == robmonitor::IGNORED) ? true : false);
35}
36
38 return ((rob_history == robmonitor::UNDEFINED) ? true : false);
39}
40
42 return (rob_status_word == 0) ? true : false;
43}
44
45// Extraction operator for ROBDataStruct
46std::ostream& robmonitor::operator<<(std::ostream& os, const ROBDataStruct& rhs) {
47 os << "[SourceID,Size(words),History,(Status words)]=["
48 << std::hex << std::setfill( '0' ) << "0x" << std::setw(6) << rhs.rob_id
49 << std::dec << std::setfill(' ')
50 << "," << std::setw(8) << rhs.rob_size;
51 os << "," << std::setw(12);
53 os << "UNCLASSIFIED";
54 } else if (rhs.rob_history == robmonitor::RETRIEVED) {
55 os << "RETRIEVED";
56 } else if (rhs.rob_history == robmonitor::HLT_CACHED) {
57 os << "HLT_CACHED";
58 } else if (rhs.rob_history == robmonitor::DCM_CACHED) {
59 os << "DCM_CACHED";
60 }else if (rhs.rob_history == robmonitor::IGNORED) {
61 os << "IGNORED";
62 } else if (rhs.rob_history == robmonitor::UNDEFINED) {
63 os << "UNDEFINED";
64 } else {
65 os << "invalid code";
66 }
67 os << ",(";
68 os << std::hex << std::setfill( '0' ) << "0x" << std::setw(8) << rhs.rob_status_word;
69 os << ")]";
70 return os;
71}
72
73//
74//--- ROBDataMonitorStruct
75// --------------------
76ROBDataMonitorStruct::ROBDataMonitorStruct(const uint32_t l1_id, const std::string& req_nam="UNKNOWN")
77 :lvl1ID(l1_id),
78 requestor_name(req_nam)
79{}
80
82 const std::vector<uint32_t>& req_robs,
83 const std::string& req_nam="UNKNOWN")
84 :lvl1ID(l1_id),
85 requestor_name(req_nam)
86{
87 for (uint32_t rob : req_robs) {
89 }
90}
91
93 return requested_ROBs.size();
94}
95
97 ptrdiff_t ret=0;
98 for (const auto& p : requested_ROBs) {
99 if (p.second.isUnclassified()) ++ret;
100 }
101 return ret;
102}
103
105 ptrdiff_t ret=0;
106 for (const auto& p : requested_ROBs) {
107 if (p.second.isHLTCached()) ++ret;
108 }
109 return ret;
110}
111
113 ptrdiff_t ret=0;
114 for (const auto& p : requested_ROBs) {
115 if (p.second.isDCMCached()) ++ret;
116 }
117 return ret;
118}
119
121 ptrdiff_t ret=0;
122 for (const auto& p : requested_ROBs) {
123 if (p.second.isRetrieved()) ++ret;
124 }
125 return ret;
126}
127
129 ptrdiff_t ret=0;
130 for (const auto& p : requested_ROBs) {
131 if (p.second.isIgnored()) ++ret;
132 }
133 return ret;
134}
135
137 ptrdiff_t ret=0;
138 for (const auto& p : requested_ROBs) {
139 if (p.second.isUndefined()) ++ret;
140 }
141 return ret;
142}
143
145 ptrdiff_t ret=0;
146 for (const auto& p : requested_ROBs) {
147 if (p.second.isStatusOk()) ++ret;
148 }
149 return ret;
150}
151
153 float secs = 0 ;
154 if (end_time >= start_time)
155 secs = (end_time - start_time)/1e3;
156 return secs;
157}
158
159// Extraction operator for ROBDataMonitorStruct
160std::ostream& robmonitor::operator<<(std::ostream& os, const ROBDataMonitorStruct& rhs) {
161 const std::string prefix(" ");
162 const std::string prefix2("-> ");
163 os << "ROB Request for L1 ID = " << std::dec << rhs.lvl1ID << " (decimal), L1 ID = 0x"
164 << std::hex << rhs.lvl1ID << " (hex)" << std::dec;
165 os << "\n" << prefix << "Requestor name = " << rhs.requestor_name;
166
167 const std::time_t s_time(rhs.start_time / static_cast<int>(1e6));
168 struct tm buf;
169 gmtime_r(&s_time, &buf);
170 os << "\n" << prefix << "Start time of ROB request = "
171 << std::put_time(&buf, "%c")
172 << " UTC + " << (rhs.start_time % static_cast<int>(1e6)) / 1000.0f << " [ms]";
173
174 const std::time_t e_time(rhs.end_time / static_cast<int>(1e6));
175 gmtime_r(&e_time, &buf);
176 os << "\n" << prefix << "Stop time of ROB request = "
177 << std::put_time(&buf, "%c")
178 << " UTC + " << (rhs.end_time % static_cast<int>(1e6)) / 1000.0f << " [ms]";
179 os << "\n" << prefix << "Elapsed time for ROB request [ms] = " << rhs.elapsedTime();
180 os << "\n" << prefix << "Requested ROBs:";
181 os << "\n" << prefix << prefix2 << "All " << rhs.allROBs() ;
182 os << "\n" << prefix << prefix2 << "Unclassified " << rhs.unclassifiedROBs() ;
183 os << "\n" << prefix << prefix2 << "HLT Cached " << rhs.HLTcachedROBs() ;
184 os << "\n" << prefix << prefix2 << "DCM Cached " << rhs.DCMcachedROBs() ;
185 os << "\n" << prefix << prefix2 << "Retrieved " << rhs.retrievedROBs() ;
186 os << "\n" << prefix << prefix2 << "Ignored " << rhs.ignoredROBs() ;
187 os << "\n" << prefix << prefix2 << "Undefined " << rhs.undefinedROBs() ;
188 os << "\n" << prefix << prefix2 << "Status OK " << rhs.statusOkROBs() ;
189 for (const auto& [id, rob] : rhs.requested_ROBs ) {
190 os << "\n" << prefix << prefix2 << rob;
191 }
192 return os;
193}
The structure which is used to monitor the ROB data request in L2 It is created for every addROBData ...
uint64_t start_time
map of ROBs requested
unsigned retrievedROBs() const
number of retrieved ROBs in structure
unsigned ignoredROBs() const
number of ignored ROBs in structure
float elapsedTime() const
elapsed time for ROB request in [ms]
unsigned HLTcachedROBs() const
number of ROBDataProviderSvc cached ROBs in structure
unsigned undefinedROBs() const
number of undefined ROBs in structure
std::map< const uint32_t, robmonitor::ROBDataStruct > requested_ROBs
name of requesting algorithm
unsigned statusOkROBs() const
number of ROBs with no status words set in structure
unsigned allROBs() const
stop time of ROB request (microsec since epoch)
std::string requestor_name
current L1 ID from L1 ROBs
ROBDataMonitorStruct()=default
default constructor
unsigned unclassifiedROBs() const
number of unclassified ROBs in structure
uint64_t end_time
start time of ROB request (microsec since epoch)
unsigned DCMcachedROBs() const
number of DCM cached ROBs in structure
A structure with data about ROB properties.
ROBDataStruct()=default
default constructor
bool isUndefined() const
ROB was not enabled.
bool isIgnored() const
ROB was ignored.
bool isHLTCached() const
ROB was found in ROBDataProviderSvc cache.
bool isStatusOk() const
ROB has no status words set.
bool isUnclassified() const
ROB is unclassified.
bool isRetrieved() const
ROB was retrieved over network.
bool isDCMCached() const
ROB was found in DCM cache.
robmonitor::ROBHistory rob_history
std::ostream & operator<<(std::ostream &os, const ROBDataStruct &rhs)