ATLAS Offline Software
GPT_ProfilerServiceConfig.py
Go to the documentation of this file.
1 """GPerfTools profiler config
2 
3 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 """
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 
9 
10 def GPT_ProfilerServiceCfg(flags, **kwargs):
11  """Configure GPerfTools CPU profiler"""
12 
13  ProfilerService = CompFactory.GPT.ProfilerService
14  kwargs.setdefault("ProfileFileName", "gpt-execute.profile")
15  kwargs.setdefault("InitEvent", 1)
16 
17  acc = ComponentAccumulator()
18  acc.addService(ProfilerService(**kwargs), create=True)
19  acc.setAppProperty("AuditAlgorithms", True)
20  acc.setAppProperty("AuditTools", True)
21  acc.setAppProperty("AuditServices", True)
22  return acc
23 
24 
25 #Brief example of running profiler
26 if __name__ == "__main__":
27  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
28  from AthExHelloWorld.HelloWorldConfig import HelloWorldCfg
29  from AthenaConfiguration.AllConfigFlags import initConfigFlags
30  flags = initConfigFlags()
31  flags.Exec.MaxEvents = 10
32  cfg = MainServicesCfg(flags)
33  cfg.merge(HelloWorldCfg(flags))
34  cfg.merge(GPT_ProfilerServiceCfg(flags))
35  cfg.run()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
GPT_ProfilerServiceConfig.GPT_ProfilerServiceCfg
def GPT_ProfilerServiceCfg(flags, **kwargs)
Definition: GPT_ProfilerServiceConfig.py:10
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
HelloWorldConfig.HelloWorldCfg
def HelloWorldCfg(flags)
Definition: HelloWorldConfig.py:28