ATLAS Offline Software
Loading...
Searching...
No Matches
GPT_ProfilerServiceConfig.py
Go to the documentation of this file.
1"""GPerfTools profiler config
2
3Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4"""
5
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7from AthenaConfiguration.ComponentFactory import CompFactory
8
9
10def 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
26if __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()