6 from TrigCostAnalysis.TableConstructorBase
import TableConstructorBase, Column
7 from AthenaCommon.Logging
import logging
8 log = logging.getLogger(
'Algorithm_HLT')
11 @file Algorithm_HLT_TableConstructor.py
12 @brief Contains TableConstructor classes per Algorithm_HLT table. Defines what
13 should be saved in table and fills them
18 ''' @brief Class representing Algorithm_HLT table
20 def __init__(self, tableObj, underflowThreshold, overflowThreshold):
21 super().
__init__(tableObj, underflowThreshold, overflowThreshold)
27 "Time_perEventFractional",
30 "InEventView_perCall",
32 "NetworkRequest_perEvent",
33 "CachedROBSize_perEvent",
34 "NetworkROBSize_perEvent",
35 "RequestTime_perEvent"]
39 self.columns[
"name"] = Column(
"Name",
"Algorithms name")
40 self.columns[
"events"] = Column(
"Raw Active Events",
"Raw underlying statistics on number of events processed with the alg active")
41 self.columns[
"eventsWeighted"] = Column(
"Active Events",
"Total weighted number of events with the alg active")
42 self.columns[
"callsPerEvent"] = Column(
"Calls/Event",
"Mean number of alg calls in events with one or more calls")
43 self.columns[
"callsSlow"] = Column(
"Calls > 1000 ms",
"Weighted number of events in which this alg was exceptionally slow")
44 self.columns[
"eventRate"] = Column(
"Event Rate [Hz]",
"Walltime normalised rate of events with one or more executions of the alg",
True)
45 self.columns[
"callRate"] = Column(
"Call Rate [Hz]",
"Walltime normalised rate of calls in events with one or more executions of the alg",
True)
46 self.columns[
"totalTimeSec"] = Column(
"Alg Total Time [s]",
"Total weighted integrated walltime of the alg")
47 self.columns[
"totalTimePerc"] = Column(
"Alg Total Time [%]",
"Total weighted integrated walltime of the alg as a percentage of all algs")
48 self.columns[
"timePerCall"] = Column(
"Alg Total Time/Call [ms]",
"Mean weighted alg time. Normalised to all alg calls")
49 self.columns[
"timePerEvent"] = Column(
"Alg Total Time/Event [ms]",
"Mean weighted alg time. Normalised to all events with one or more alg calls")
50 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")
51 self.columns[
"dataRate"] = Column(
"Data Request Rate [Hz]",
"Rate of data requests to ROSes from this algorithm in this run range",
True)
52 self.columns[
"retrievedDataRate"] = Column(
"Retrieved Data request Rate [Hz]",
"Rate of data request with at least one network ROS request from this algorithm in this run range",
True)
53 self.columns[
"cachedDataSizeRate"] = Column(
"Cached ROB Rate [kB/s]",
"Average size of cached ROB data fetches for this algorithm in this run range",
True)
54 self.columns[
"retrievedDataSizeRate"] = Column(
"Retrieved ROB Rate [kB/s]",
"Average size of retrieved ROB data fetches for this algorithm in this run range")
58 weightedEvents = self.getHistogram(
"AlgCalls_perEvent").Integral()
59 weightedCalls = self.getXWeightedIntegral(
"AlgCalls_perEvent", isLog=
False)
60 slowCalls = self.getHistogram(
"Time_perCall").Integral(self.getHistogram(
"Time_perCall").
FindBin(1000.), self.getHistogram(
"Time_perCall").GetNbinsX())
62 self.columns[
"name"].addValue(itemName)
63 self.columns[
"events"].addValue(self.getHistogram(
"AlgCalls_perEvent").
GetEntries())
64 self.columns[
"eventsWeighted"].addValue(weightedEvents)
65 self.columns[
"callsPerEvent"].addValue(self.getHistogram(
"AlgCalls_perEvent").
GetMean())
66 self.columns[
"callsSlow"].addValue(slowCalls)
67 self.columns[
"eventRate"].addValue(weightedEvents)
68 self.columns[
"callRate"].addValue(weightedCalls)
69 self.columns[
"totalTimeSec"].addValue(self.getXWeightedIntegral(
"Time_perCall", isLog=
True) * 1e-3)
71 self.columns[
"timePerCall"].addValue(self.getHistogram(
"Time_perCall").
GetMean())
72 self.columns[
"timePerEvent"].addValue(self.getHistogram(
"Time_perEvent").
GetMean())
73 self.columns[
"requestTimePerEvent"].addValue(self.getHistogram(
"RequestTime_perEvent").
GetMean())
74 self.columns[
"dataRate"].addValue(self.getXWeightedIntegral(
"Request_perEvent", isLog=
False))
75 self.columns[
"retrievedDataRate"].addValue(self.getXWeightedIntegral(
"NetworkRequest_perEvent", isLog=
False))
76 self.columns[
"cachedDataSizeRate"].addValue(self.getXWeightedIntegral(
"CachedROBSize_perEvent", isLog=
False))
77 self.columns[
"retrievedDataSizeRate"].addValue(self.getXWeightedIntegral(
"NetworkROBSize_perEvent", isLog=
False))
80 log.info(
"Algorithm: {0:300} Mean Time per call [ms]: {1:10.4} Mean Time per event [ms]: {2:10.3}".
format(itemName, self.getHistogram(
"Time_perCall").
GetMean(), self.getHistogram(
"Time_perEvent").
GetMean()))
84 totalTimeEntries = self.columns[
"totalTimeSec"].content
85 totalTime =
sum(totalTimeEntries)
87 log.error(
"No histograms for the Algorithm HLT summary were found")
90 for entry
in totalTimeEntries:
91 self.columns[
"totalTimePerc"].addValue(100 * entry / totalTime)