|
ATLAS Offline Software
|
Go to the documentation of this file.
9 #ifndef PERFMONCOMPS_PERFMONMTSVC_H
10 #define PERFMONCOMPS_PERFMONMTSVC_H
17 #include "GaudiKernel/IIncidentListener.h"
33 #include <nlohmann/json.hpp>
41 class PerfMonMTSvc :
public extends<AthService, IPerfMonMTSvc, IIncidentListener> {
50 virtual void handle(
const Incident& incident )
override;
59 virtual void startAud(
const std::string& stepName,
const std::string&
compName)
override;
62 virtual void stopAud(
const std::string& stepName,
const std::string&
compName)
override;
69 void startCompAud(
const std::string& stepName,
const std::string&
compName,
const EventContext& ctx);
70 void stopCompAud(
const std::string& stepName,
const std::string&
compName,
const EventContext& ctx);
95 std::string
scaleTime(
double timeMeas)
const;
96 std::string
scaleMem(int64_t memMeas)
const;
116 this,
"doEventLoopMonitoring",
true,
117 "True if event loop monitoring is enabled, false o/w. Event loop monitoring may cause a decrease in the "
118 "performance due to the usage of locks."};
121 this,
"doComponentLevelMonitoring",
false,
122 "True if component level monitoring is enabled, false o/w. Component monitoring may cause a decrease in the "
123 "performance due to the usage of locks."};
125 Gaudi::Property<bool>
m_reportResultsToJSON{
this,
"reportResultsToJSON",
true,
"Report results into the json file."};
127 Gaudi::Property<std::string>
m_jsonFileName{
this,
"jsonFileName",
"PerfMonMTSvc_result.json",
128 "Name of the JSON file that contains the results."};
131 "Print detailed component-level metrics."};
134 this,
"memFitLowerLimit", 25,
135 "Lower limit (in number of events) for the memory fit."};
138 this,
"checkPointThreshold", 30,
139 "Least amount of time (in seconds) between event-level checks."};
141 Gaudi::Property<double>
m_wallTimeOffset{
this,
"wallTimeOffset", 0,
"Job start wall time in miliseconds."};
144 this,
"printNComps", 50,
"Maximum number of components to be printed."};
146 Gaudi::Property<int>
m_numberOfThreads{
this,
"numberOfThreads", 1,
"Number of threads in the job."};
148 Gaudi::Property<int>
m_numberOfSlots{
this,
"numberOfSlots", 1,
"Number of slots in the job."};
150 Gaudi::Property<uint64_t>
m_eventLoopMsgLimit{
this,
"eventLoopMsgLimit", 10,
"Maximum number of event-level messages."};
155 const std::set<std::string>
m_exclusionSet = {
"AthMasterSeq",
"AthAlgEvtSeq",
"AthAllAlgSeq",
"AthAlgSeq",
"AthOutSeq",
156 "AthCondSeq",
"AthBeginSeq",
"AthEndSeq",
"AthenaEventLoopMgr",
"AthenaHiveEventLoopMgr",
"AthMpEvtLoopMgr",
"AthenaMtesEventLoopMgr",
162 std::vector<std::string>
m_snapshotStepNames = {
"Configure",
"Initialize",
"FirstEvent",
"Execute",
"Finalize"};
189 typedef std::map<PMonMT::StepComp, PMonMT::ComponentData*>
data_map_t;
217 #endif // PERFMONCOMPS_PERFMONMTSVC_H
Gaudi::Property< bool > m_doComponentLevelMonitoring
Do component level monitoring.
void report2JsonFile()
Report to the JSON File.
std::atomic< bool > m_isFirstEvent
void stopSnapshotAud(const std::string &stepName, const std::string &compName)
void report2Log_Description() const
int getCpuEfficiency() const
void report2Log_ComponentLevel()
data_map_t m_compLevelDataMap_fin
Gaudi::Property< int > m_numberOfThreads
Get the number of threads.
PMonMT::SnapshotMeasurement m_measurementSnapshots
Measurement to capture snapshots.
data_map_t m_compLevelDataMap
int m_motherPID
Snapshots data.
void report2Log_CpuInfo() const
void report2Log_EnvInfo() const
virtual StatusCode initialize() override
Standard Gaudi Service initialization.
std::atomic< uint64_t > m_eventCounter
int get_cpu_core_info() const
virtual ~PerfMonMTSvc()=default
std::atomic< double > m_checkPointTime
Gaudi::Property< double > m_wallTimeOffset
Offset for the wall-time, comes from configuration.
void report2JsonFile_ComponentLevel(nlohmann::json &j) const
PerfMon::LinFitSglPass m_fit_vmem
virtual void handle(const Incident &incident) override
Incident service handle for post-finalize.
std::string get_cpu_model_info() const
void stopCompAud(const std::string &stepName, const std::string &compName, const EventContext &ctx)
PMonMT::SnapshotMeasurement m_measurementEvents
Measurement to capture events.
Gaudi::Property< uint64_t > m_eventLoopMsgLimit
Set the number of messages for the event-level report.
void report2Log_EventLevel()
void startSnapshotAud(const std::string &stepName, const std::string &compName)
Snapshot Auditing: Take snapshots at the beginning and at the end of each step.
std::atomic< bool > m_isEvtLoopStopped
void report2Log_Summary()
data_map_t m_compLevelDataMap_ini
data_map_t m_compLevelDataMap_evt
std::vector< PMonMT::SnapshotData > m_snapshotData
void report2Log_EventLevel_instant() const
virtual void startAud(const std::string &stepName, const std::string &compName) override
Start Auditing.
PerfMon::LinFitSglPass m_fit_pss
void report2Log()
Report to log.
Gaudi::Property< bool > m_reportResultsToJSON
Report results to JSON.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< std::string > m_jsonFileName
Name of the JSON file.
virtual StatusCode finalize() override
Standard Gaudi Service finalization.
void report2JsonFile_EventLevel(nlohmann::json &j) const
std::atomic< uint64_t > m_eventLoopMsgCounter
std::string scaleMem(int64_t memMeas) const
std::string scaleTime(double timeMeas) const
uint64_t get_memory_info() const
virtual void stopAud(const std::string &stepName, const std::string &compName) override
Stop Auditing.
void report2JsonFile_Summary(nlohmann::json &j) const
std::vector< std::string > m_snapshotStepNames
const std::set< std::string > m_exclusionSet
Exclude some common components from monitoring In the future this might be converted to a inclusion s...
std::mutex m_mutex_capture
Gaudi::Property< int > m_numberOfSlots
Get the number of slots.
Gaudi::Property< int > m_printNComps
Print the top N components.
Gaudi::Property< bool > m_printDetailedTables
Print detailed tables.
void aggregateSlotData()
A few helper functions.
std::vector< data_map_t > m_stdoutVec_serial
PMonMT::EventLevelData m_eventLevelData
PerfMonMTSvc(const std::string &name, ISvcLocator *pSvcLocator)
Standard Gaudi Service constructor.
Gaudi::Property< bool > m_doEventLoopMonitoring
Do event loop monitoring.
Gaudi::Property< uint64_t > m_checkPointThreshold
Frequency of event level monitoring.
data_map_t m_compLevelDataMap_1stevt
Gaudi::Property< uint64_t > m_memFitLowerLimit
Lower limit (in number of events) for the memory fit.
Define macros for attributes used to control the static checker.
std::string get_info_from_file(const std::string &fileName, const std::string &fieldName) const
A few helper methods to get system information These should be carried to PerfMonMTUtils at some poin...
std::vector< data_map_unique_t > m_compLevelDataMapVec
data_map_t m_compLevelDataMap_cbk
std::map< PMonMT::StepComp, std::unique_ptr< PMonMT::ComponentData > > data_map_unique_t
std::map< PMonMT::StepComp, PMonMT::ComponentData * > data_map_t
PMonMT::StepComp generate_state(const std::string &stepName, const std::string &compName) const
void report()
Report the results.
void startCompAud(const std::string &stepName, const std::string &compName, const EventContext &ctx)
Component Level Auditing: Take measurements at the beginning and at the end of each component call.
data_map_t m_compLevelDataMap_plp