diff --git a/Trigger/TrigCost/TrigCostAnalysis/python/TableConstructors/Sequence_HLT_TableConstructor.py b/Trigger/TrigCost/TrigCostAnalysis/python/TableConstructors/Sequence_HLT_TableConstructor.py index 1dc2e1ad2b2f9a6f60320f067849ad357aa2640c..b4068d4cbea620b7ab8d22b542b134436c79e400 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/python/TableConstructors/Sequence_HLT_TableConstructor.py +++ b/Trigger/TrigCost/TrigCostAnalysis/python/TableConstructors/Sequence_HLT_TableConstructor.py @@ -19,7 +19,7 @@ class Sequence_HLT_TableConstructor(TableConstructorBase): super(). __init__(tableObj) self.expectedHistograms = ["Sequence_perEvent", "AlgCalls_perEvent", - #"Time_perCall", + "Time_perCall", "Time_perEvent", "Request_perEvent", "NetworkRequest_perEvent", @@ -32,13 +32,13 @@ class Sequence_HLT_TableConstructor(TableConstructorBase): self.columns["name"] = Column("Name", "Sequence name") self.columns["events"] = Column("Raw Active Events", "Raw underlying statistics on how many events in which this sequence was executed.") self.columns["eventsWeighted"] = Column("Active Events", "How many events in which this sequence was executed.") - # self.columns["callsPerEvent"] = Column("Calls/Event", "Total number of calls made to this sequence.") - # self.columns["callsSlow"] = Column("Calls > 1000 ms", "Number of sequence executions which were particularly slow.") + self.columns["callsPerEvent"] = Column("Calls/Event", "Total number of calls made to this sequence.") + self.columns["callsSlow"] = Column("Calls > 1000 ms", "Number of sequence executions which were particularly slow.") self.columns["eventRate"] = Column("Event Rate [Hz]", "Rate in this run range of events with at least one execution of this sequence.", True) - #self.columns["callRate"] = Column("Call Rate [Hz]", "Rate in this run range of calls to this sequence.", True) - #self.columns["totalTimeSec"] = Column("Sequence Total Time [s]", "Total time for this sequence") - #self.columns["totalTimePerc"] = Column("Sequence Total Time [%]", "Total time for this sequence as a percentage of all sequence executions in this run range") - #self.columns["timePerCall"] = Column("Sequence Total Time/Call [ms]", "Average execution time per sequence call in this run range.") + self.columns["callRate"] = Column("Call Rate [Hz]", "Rate in this run range of calls to this sequence.", True) + self.columns["totalTimeSec"] = Column("Sequence Total Time [s]", "Total time for this sequence") + self.columns["totalTimePerc"] = Column("Sequence Total Time [%]", "Total time for this sequence as a percentage of all sequence executions in this run range") + self.columns["timePerCall"] = Column("Sequence Total Time/Call [ms]", "Average execution time per sequence call in this run range.") self.columns["timePerEvent"] = Column("Sequence Total Time/Event [ms]", "Mean weighted alg time. Normalised to all events with one or more alg calls") self.columns["algsPerEvent"] = Column("Run Algs/Event", "Total number of algorithms executed by this sequence.") self.columns["requestTimePerEvent"] = Column("ROS Data Request Time/Event [ms]", "Average time waiting for ROS data per event for events with at least one execution in this run range") @@ -50,19 +50,19 @@ class Sequence_HLT_TableConstructor(TableConstructorBase): def fillColumns(self, histName): weightedEvents = self.getHistogram("Sequence_perEvent").Integral() - #weightedCalls = self.getXWeightedIntegral("Sequence_perEvent", isLog=False) - #slowCalls = self.getHistogram("Time_perCall").Integral(self.getHistogram("Time_perCall").FindBin(1000.), self.getHistogram("Time_perCall").GetNbinsX()) + weightedCalls = self.getXWeightedIntegral("Sequence_perEvent", isLog=False) + slowCalls = self.getHistogram("Time_perCall").Integral(self.getHistogram("Time_perCall").FindBin(1000.), self.getHistogram("Time_perCall").GetNbinsX()) self.columns["name"].addValue(histName) self.columns["events"].addValue(self.getHistogram("Sequence_perEvent").GetEntries()) self.columns["eventsWeighted"].addValue(weightedEvents) - #self.columns["callsPerEvent"].addValue(self.getHistogram("Sequence_perEvent").GetMean()) - #self.columns["callsSlow"].addValue(slowCalls) + self.columns["callsPerEvent"].addValue(self.getHistogram("Sequence_perEvent").GetMean()) + self.columns["callsSlow"].addValue(slowCalls) self.columns["eventRate"].addValue(weightedEvents) - #self.columns["callRate"].addValue(weightedCalls) - #self.columns["totalTimeSec"].addValue(self.getXWeightedIntegral("Time_perCall", isLog=True) * 1e-3) + self.columns["callRate"].addValue(weightedCalls) + self.columns["totalTimeSec"].addValue(self.getXWeightedIntegral("Time_perCall", isLog=True) * 1e-3) #self.columns["totalTimePerc"] in post processing - #self.columns["timePerCall"].addValue((self.getHistogram("Time_perCall").GetMean())) + self.columns["timePerCall"].addValue((self.getHistogram("Time_perCall").GetMean())) self.columns["timePerEvent"].addValue(self.getHistogram("Time_perEvent").GetMean()) self.columns["algsPerEvent"].addValue(self.getHistogram("AlgCalls_perEvent").GetMean()) self.columns["requestTimePerEvent"].addValue(self.getHistogram("RequestTime_perEvent").GetMean()) @@ -73,9 +73,8 @@ class Sequence_HLT_TableConstructor(TableConstructorBase): def postProcessing(self): - #totalTimeEntries = self.columns["totalTimeSec"].content - #totalTime = sum(totalTimeEntries) + totalTimeEntries = self.columns["totalTimeSec"].content + totalTime = sum(totalTimeEntries) - #for entry in totalTimeEntries: - # self.columns["totalTimePerc"].addValue(100 * entry / totalTime) - pass + for entry in totalTimeEntries: + self.columns["totalTimePerc"].addValue(100 * entry / totalTime) diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx index 732ef30a2806ed707f9e39e7bc84113a30fb7541..65d96da865ea12493c6e6586438d14441f028dac 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx @@ -139,7 +139,7 @@ void CostData::setChainToUniqAlgMap( const std::map<std::string, std::set<size_t m_chainToUniqAlgIdx = &chainToAlgIdx; } -void CostData::setSequencersMap( const std::map<std::string, std::set<size_t>>& seqToAlg ) { +void CostData::setSequencersMap( const std::map<std::string, std::map<int16_t, std::set<size_t>>>& seqToAlg ) { m_sequencers = &seqToAlg; } @@ -152,7 +152,7 @@ const std::map<std::string, std::set<size_t>>& CostData::chainToUniqAlgMap() con return *m_chainToUniqAlgIdx; } -const std::map<std::string, std::set<size_t>>& CostData::sequencersMap() const { +const std::map<std::string, std::map<int16_t, std::set<size_t>>>& CostData::sequencersMap() const { return *m_sequencers; } diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h index a178a52e8099fae417372132e0b8718ec5da9253..3c4082dce06afe14a1f04ee490e1901d6adf3364 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h +++ b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h @@ -91,12 +91,12 @@ class CostData { /** * @brief Getter of the sequence to alg idx map. */ - const std::map<std::string, std::set<size_t>>& sequencersMap() const; + const std::map<std::string, std::map<int16_t, std::set<size_t>>>& sequencersMap() const; /** * @brief Set the sequence to alg idx map. */ - void setSequencersMap( const std::map<std::string, std::set<size_t>>& seqToAlg ); + void setSequencersMap( const std::map<std::string, std::map<int16_t, std::set<size_t>>>& seqToAlg ); /** * @brief Getter of the seeded chains set. @@ -194,7 +194,7 @@ class CostData { const std::map<std::string, std::vector<uint32_t>>* m_rosToRob; //!< Mapping of ROS corresponding to ROB requests const std::map<std::string, std::set<size_t>>* m_chainToAlgIdx; //!<Mapping of chain to algorithms idx const std::map<std::string, std::set<size_t>>* m_chainToUniqAlgIdx; //!<Mapping of chain name to its unique algorithms - const std::map<std::string, std::set<size_t>>* m_sequencers; //!<Mapping of sequence to algorithms + const std::map<std::string, std::map<int16_t, std::set<size_t>>>* m_sequencers; //!<Mapping of sequence to algorithms const std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo>* m_seededChains; //!<Set of seeded chains to monitor }; diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx index ca51845022e9fb0158fe09aacf4671446178529d..1fd4b187bef77ad425123183d6bb47e85dc497ef 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx @@ -217,7 +217,7 @@ StatusCode TrigCostAnalysis::execute() { // Save indexes of algorithm in costDataHandle std::map<std::string, std::set<size_t>> chainToAlgIdx; std::map<std::string, std::set<size_t>> chainToUniqAlgs; // List for unique algorithms for each chain - std::map<std::string, std::set<size_t>> seqToAlgIdx; + std::map<std::string, std::map<int16_t, std::set<size_t>>> seqToAlgIdx; // Map of algorithms split in views std::map<std::string, std::vector<TrigConf::Chain>> algToChain; ATH_CHECK( m_algToChainTool->getChainsForAllAlgs(context, algToChain) ); @@ -241,7 +241,8 @@ StatusCode TrigCostAnalysis::execute() { } if (algToSeq.count(algName)){ - seqToAlgIdx[algToSeq[algName]].insert(tc->index()); + const int16_t view = tc->getDetail<int16_t>("view"); + seqToAlgIdx[algToSeq[algName]][view].insert(tc->index()); } } diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterSequence.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterSequence.cxx index 08374a12ce85bc5ac409915c981bf45eb09c9258..88e69dd691e9079c24fb08cc80aa4759f8408b53 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterSequence.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterSequence.cxx @@ -13,7 +13,7 @@ CounterSequence::CounterSequence(const std::string& name, const MonitorBase* par { regHistogram("Sequence_perEvent", "Sequnece calls/Event;Sequence call;Events", VariableType::kPerEvent, kLinear, -0.5, 49.5); regHistogram("AlgCalls_perEvent", "Algorithm Calls/Event;Calls;Events", VariableType::kPerEvent, kLinear, -0.5, 499.5, 100); - //regHistogram("Time_perCall", "CPU Time/Call;Time [ms];Calls", VariableType::kPerCall); + regHistogram("Time_perCall", "CPU Time/Call;Time [ms];Calls", VariableType::kPerCall); regHistogram("Time_perEvent", "CPU Time/Event;Time [ms];Events", VariableType::kPerEvent); regHistogram("Request_perEvent", "Number of requests/Event;Number of requests;Events", VariableType::kPerEvent, LogType::kLinear, -0.5, 299.5, 300); regHistogram("NetworkRequest_perEvent", "Number of network requests/Event;Number of requests;Events", VariableType::kPerEvent, LogType::kLinear, -0.5, 149.5, 150); @@ -23,12 +23,13 @@ CounterSequence::CounterSequence(const std::string& name, const MonitorBase* par } -StatusCode CounterSequence::newEvent(const CostData& data, size_t /*index*/, const float weight) { +StatusCode CounterSequence::newEvent(const CostData& data, size_t index, const float weight) { ATH_CHECK( increment("Sequence_perEvent", weight) ); - + float viewTime = 0; // Monitor algorithms associated with sequence name - for (const size_t algIndex : data.sequencersMap().at(getName())){ + for (const size_t algIndex : data.sequencersMap().at(getName()).at(index)){ + const xAOD::TrigComposite* alg = data.costCollection().at(algIndex); const uint32_t slot = alg->getDetail<uint32_t>("slot"); if (slot != data.onlineSlot()) { @@ -37,15 +38,11 @@ StatusCode CounterSequence::newEvent(const CostData& data, size_t /*index*/, con ATH_CHECK( increment("AlgCalls_perEvent", weight) ); - - const uint32_t nameHash = alg->getDetail<TrigConf::HLTHash>("alg"); - const std::string name = TrigConf::HLTUtils::hash2string(nameHash, "ALG"); - const uint64_t start = alg->getDetail<uint64_t>("start"); // in mus const uint64_t stop = alg->getDetail<uint64_t>("stop"); // in mus const float cpuTime = timeToMilliSec(start, stop); ATH_CHECK( fill("Time_perEvent", cpuTime, weight) ); - //ATH_CHECK( fill("Time_perCall", cpuTime, weight) ); + viewTime += cpuTime; // Monitor data requests if (!data.algToRequestMap().count(algIndex)) continue; @@ -80,5 +77,7 @@ StatusCode CounterSequence::newEvent(const CostData& data, size_t /*index*/, con } } + ATH_CHECK( fill("Time_perCall", viewTime, weight) ); + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorSequence.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorSequence.cxx index a33dcb1e59d5e62effb23f125920089e218ec997..0b69e5d292b59010101bda6f86e81252db194983 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorSequence.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorSequence.cxx @@ -12,7 +12,9 @@ MonitorSequence::MonitorSequence(const std::string& name, const MonitoredRange* StatusCode MonitorSequence::newEvent(const CostData& data, const float weight) { for (const auto& sequencePair : data.sequencersMap()) { if (sequencePair.first.empty()) continue; - ATH_CHECK( getCounter(sequencePair.first)->newEvent(data, 0, weight) ); + for (const auto& viewAlgsPair : sequencePair.second){ + ATH_CHECK( getCounter(sequencePair.first)->newEvent(data, viewAlgsPair.first, weight) ); + } } return StatusCode::SUCCESS;