|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef TRIGCOSTMONITOR_TRIGCOSTSVC_H
6 #define TRIGCOSTMONITOR_TRIGCOSTSVC_H
9 #include <shared_mutex>
13 #include "GaudiKernel/ToolHandle.h"
36 class TrigCostSvc :
public extends <AthService, ITrigCostSvc> {
67 virtual StatusCode startEvent(
const EventContext& context,
const bool enableMonitoring =
true)
override;
75 virtual StatusCode processAlg(
const EventContext& context,
const std::string& caller,
const AuditType
type)
override;
89 virtual bool isMonitoredEvent(
const EventContext& context,
const bool includeMultiSlot =
true)
const override;
136 int32_t
getROIID(
const EventContext& context);
155 tbb::concurrent_hash_map<std::thread::id, AlgorithmIdentifier, ThreadHashCompare>
m_threadToAlgMap;
161 Gaudi::Property<bool>
m_monitorAllEvents{
this,
"MonitorAllEvents",
false,
"Monitor every HLT event, e.g. for offline validation."};
162 Gaudi::Property<bool>
m_enableMultiSlot{
this,
"EnableMultiSlot",
false,
"Monitored events in the MasterSlot collect data from events running in other slots."};
163 Gaudi::Property<bool>
m_saveHashes{
this,
"SaveHashes",
false,
"Store a copy of the hash dictionary for easier debugging"};
164 Gaudi::Property<size_t>
m_masterSlot{
this,
"MasterSlot", 0,
"The slot responsible for saving MultiSlot data"};
165 Gaudi::Property<std::string>
m_costSupervisorAlgName{
this,
"CostSupervisorAlgName",
"TrigCostSupervisorAlg",
"The name of cost monitoring supervising algorithm, starting at the begining of the event"};
166 Gaudi::Property<std::string>
m_costFinalizeAlgName{
this,
"CostFinalizeAlgName",
"TrigCostFinalizeAlg",
"The name of cost monitoring finalize algorithm, starting at the end of the event"};
171 #endif // TRIGCOSTMONITOR_TRIGCOSTSVC_H
int32_t getROIID(const EventContext &context)
@breif Internal function to return a RoI from an extended event context context
virtual StatusCode startEvent(const EventContext &context, const bool enableMonitoring=true) override
Implementation of ITrigCostSvc::startEvent.
tbb::concurrent_hash_map< std::thread::id, AlgorithmIdentifier, ThreadHashCompare > m_threadToAlgMap
Keeps track of what is running right now in each thread.
std::unordered_map< uint32_t, uint32_t > m_threadToCounterMap
Map thread's hash ID to a counting numeral.
Static hash and equal members as required by tbb::concurrent_hash_map.
TrigCostSvc(const std::string &name, ISvcLocator *pSvcLocator)
Standard ATLAS Service constructor.
The structure which is used to monitor the ROB data request in L2 It is created for every addROBData ...
Small structure to hold an algorithm's name and store, plus some details on its EventView....
DataVector adapter that acts like it holds const pointers.
virtual ~TrigCostSvc()
Destructor.
Gaudi::Property< bool > m_monitorAllEvents
virtual StatusCode monitorROS(const EventContext &context, robmonitor::ROBDataMonitorStruct payload) override
Implementation of ITrigCostSvc::monitorROS.
size_t m_eventSlots
Number of concurrent processing slots.
AthenaMT service to collect trigger cost data from all threads and summarise it at the end of the eve...
Gaudi::Property< bool > m_saveHashes
StatusCode checkSlot(const EventContext &context) const
Sanity check that the job is respecting the number of slots which were declared at config time.
virtual StatusCode discardEvent(const EventContext &context) override
Discard a cost monitored event.
TrigCostDataStore< TrigTimeStamp > m_algStopTime
Thread-safe store of algorithm stop times.
size_t m_threadCounter
Count how many unique thread ID we have seen.
virtual StatusCode initialize() override
Initialise, create enough storage to store m_eventSlots.
virtual StatusCode generateTimeoutReport(const EventContext &context, std::string &report) override
Handle class for recording to StoreGate.
utility class to measure time duration in AthenaMT The pattern when it is useful: AlgA tags the begin...
::StatusCode StatusCode
StatusCode definition for legacy code.
std::unique_ptr< std::atomic< bool >[] > m_eventMonitored
Used to cache if the event in a given slot is being monitored.
static size_t hash(const std::thread::id &thread)
virtual StatusCode processAlg(const EventContext &context, const std::string &caller, const AuditType type) override
Implementation of ITrigCostSvc::processAlg.
virtual StatusCode finalize() override
Finalize, act on m_saveHashes.
virtual StatusCode endEvent(const EventContext &context, SG::WriteHandle< xAOD::TrigCompositeContainer > &costOutputHandle, SG::WriteHandle< xAOD::TrigCompositeContainer > &rosOutputHandle) override
Implementation of ITrigCostSvc::endEvent.
TrigCostDataStore< std::vector< robmonitor::ROBDataMonitorStruct > > m_rosData
Thread-safe store of ROS data.
std::mutex m_globalMutex
Used to protect all-slot modifications.
Gaudi::Property< std::string > m_costSupervisorAlgName
static bool equal(const std::thread::id &x, const std::thread::id &y)
virtual bool isMonitoredEvent(const EventContext &context, const bool includeMultiSlot=true) const override
std::unique_ptr< std::shared_mutex[] > m_slotMutex
Used to control and protect whole-table operations.
TrigCostDataStore< AlgorithmPayload > m_algStartInfo
Thread-safe store of algorithm start payload.
Gaudi::Property< std::string > m_costFinalizeAlgName
Gaudi::Property< size_t > m_masterSlot
StatusCode monitor(const EventContext &context, const AlgorithmIdentifier &ai, const TrigTimeStamp &now, const AuditType type)
Internal call to save monitoring data for a given AlgorithmIdentifier.
Gaudi::Property< bool > m_enableMultiSlot