1"""GPerfTools profiler config
3Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
6from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7from AthenaConfiguration.ComponentFactory
import CompFactory
11 """Configure GPerfTools CPU profiler"""
13 ProfilerService = CompFactory.GPT.ProfilerService
14 kwargs.setdefault("ProfileFileName", "gpt-execute.profile")
15 kwargs.setdefault("InitEvent", 1)
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)
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))
GPT_ProfilerServiceCfg(flags, **kwargs)