Skip to content
Snippets Groups Projects

TrigCost: Extend ROS Monitoring

Merged Aleksandra Poreba requested to merge aporeba/athena:cost-new-rob-hist into 22.0
18 files
+ 447
47
Compare changes
  • Side-by-side
  • Inline
Files
18
@@ -9,7 +9,7 @@
CounterChain::CounterChain(const std::string& name, const MonitorBase* parent)
: CounterBase(name, parent)
: CounterBase(name, parent), m_isInitialized(false)
{
regHistogram("Group_perCall", "Chain group/Call;Group;Calls", VariableType::kPerCall, kLinear, -0.5, 9.5, 10);
regHistogram("Chain_perEvent", "Chain calls/Event;Chain call;Events", VariableType::kPerEvent, kLinear, -0.5, 49.5);
@@ -25,17 +25,37 @@ CounterChain::CounterChain(const std::string& name, const MonitorBase* parent)
regHistogram("RequestTime_perEvent", "ROB Elapsed Time/Event;Elapsed Time [ms];Events", VariableType::kPerEvent);
}
CounterChain::CounterChain(const std::string& name, unsigned nRos, const MonitorBase* parent)
: CounterChain(name, parent)
{
regTProfile("ROSRequests_perEvent", "Number of ROS requests;ROS names;Numer of requests to ROS per event", VariableType::kPerCall, LogType::kLinear, 0, nRos, nRos);
regTProfile("ROBRequestsPerROS_perEvent", "Number of ROBs per ROS requests;ROS names;Numer of ROBs requested per request", VariableType::kPerCall, LogType::kLinear, 0, nRos, nRos);
regTProfile("ROBRequestsPerROSPerEvent_perEvent", "Number of ROBs per ROS requests per event;ROS names;Numer of ROBs requested by ROS per event", VariableType::kPerCall, LogType::kLinear, 0, nRos, nRos);
}
StatusCode CounterChain::newEvent(const CostData& data, size_t index, const float weight) {
ATH_CHECK( increment("Chain_perEvent", weight) );
// Fill the bins with groups and add the labels
int bin = 1;
for (const std::string& group : data.seededChains()[index].groups){
ATH_CHECK( getVariable("Group_perCall").setBinLabel(bin, group) );
ATH_CHECK( getVariable("Group_perCall").fill(group, weight) );
++bin;
if (!m_isInitialized && variableExists("ROSRequests_perEvent")) {
// Set histograms labels
for (const auto& rosToRobPair : data.costROSData().getROStoROBMap()) {
int binForROS = data.costROSData().getBinForROS(rosToRobPair.first) + 1;
ATH_CHECK( getVariable("ROSRequests_perEvent").setBinLabel(binForROS, rosToRobPair.first));
ATH_CHECK( getVariable("ROBRequestsPerROS_perEvent").setBinLabel(binForROS, rosToRobPair.first));
ATH_CHECK( getVariable("ROBRequestsPerROSPerEvent_perEvent").setBinLabel(binForROS, rosToRobPair.first));
}
// Fill the bins with groups and add the labels
int bin = 1;
for (const std::string& group : data.seededChains()[index].groups){
ATH_CHECK( getVariable("Group_perCall").setBinLabel(bin, group) );
ATH_CHECK( getVariable("Group_perCall").fill(group, weight) );
++bin;
}
m_isInitialized = true;
}
if (data.seededChains()[index].isPassRaw){
@@ -45,6 +65,8 @@ StatusCode CounterChain::newEvent(const CostData& data, size_t index, const floa
// Monitor algorithms associated with chain name
if (!data.chainToAlgMap().count(getName())) return StatusCode::SUCCESS;
std::map<std::string, int> nRosPerEvent; // Accumulate how many times ROS was requested in a request per this event
std::map<std::string, int> nRobsPerRosPerEvent; // Accumulate how many ROBs ROS requested per this event
for (const size_t algIndex : data.chainToAlgMap().at(getName())){
const xAOD::TrigComposite* alg = data.costCollection().at(algIndex);
const uint32_t slot = alg->getDetail<uint32_t>("slot");
@@ -65,10 +87,14 @@ StatusCode CounterChain::newEvent(const CostData& data, size_t index, const floa
for (size_t requestIdx : data.algToRequestMap().at(algIndex)) {
const xAOD::TrigComposite* request = data.rosCollection().at(requestIdx);
const std::vector<uint32_t> robIdsPerRequest = request->getDetail<std::vector<uint32_t>>("robs_id");
const std::vector<unsigned> robs_history = request->getDetail<std::vector<unsigned>>("robs_history");
const std::vector<uint32_t> robs_size = request->getDetail<std::vector<uint32_t>>("robs_size");
std::map<std::string, int> nRobsPerRosPerRequest; // Accumulate how many ROBs ROS requested per request
bool networkRequestIncremented = false;
std::set<std::string> requestedROSes;
for (size_t i = 0; i < robs_size.size(); ++i) {
// ROB request was fetched over the network
if (robs_history[i] == robmonitor::RETRIEVED) {
@@ -80,8 +106,28 @@ StatusCode CounterChain::newEvent(const CostData& data, size_t index, const floa
else if (robs_history[i] == robmonitor::HLT_CACHED || robs_history[i] == robmonitor::DCM_CACHED) {
ATH_CHECK( fill("CachedROBSize_perEvent", robs_size[i] / 500., weight) );
}
uint32_t robId = robIdsPerRequest[i];
if (variableExists("ROBRequestsPerROS_perEvent")){
std::string rosForROB = data.costROSData().getROSForROB(robId);
if (!rosForROB.empty()){
requestedROSes.insert(rosForROB);
nRobsPerRosPerRequest[rosForROB] += 1;
nRobsPerRosPerEvent[rosForROB] += 1;
}
}
}
// Save number of ROBs per ROS per request
for (const auto& robPerRosPair : nRobsPerRosPerRequest) {
ATH_CHECK( fill("ROBRequestsPerROS_perEvent", data.costROSData().getBinForROS(robPerRosPair.first), robPerRosPair.second, weight) );
}
// Save the requested ROSes per request
for (const std::string& rosName : requestedROSes){
nRosPerEvent[rosName] += 1;
}
ATH_CHECK( increment("Request_perEvent", weight) );
if (networkRequestIncremented) {
@@ -93,6 +139,16 @@ StatusCode CounterChain::newEvent(const CostData& data, size_t index, const floa
}
}
// Save the requested ROSes per event
for (const auto& robPerRosPair : nRosPerEvent) {
ATH_CHECK( fill("ROSRequests_perEvent", data.costROSData().getBinForROS(robPerRosPair.first), robPerRosPair.second, weight) );
}
// Save the number of ROBs per ROS per event
for (const auto& robPerRosPair : nRobsPerRosPerEvent) {
ATH_CHECK( fill("ROBRequestsPerROSPerEvent_perEvent", data.costROSData().getBinForROS(robPerRosPair.first), robPerRosPair.second, weight) );
}
// Monitor unique algorithms associated with chain name
if (!data.chainToUniqAlgMap().count(getName())) return StatusCode::SUCCESS;
Loading