ATLAS Offline Software
ProfileJob_preInclude.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 # $Id: ProfileJob_preInclude.py 496380 2012-04-18 12:28:09Z ritsch $
4 #
5 # This job fragment can be pre-included in Reco_trf.py jobs to profile
6 # the entrie job (initialization, event loop and finalization) using GPT.
7 #
8 # WARNING: Unfortunately at the moment this doesn't really work.
9 # GPT has serious issues with CPU profiling while Athena is
10 # still loading its shared libraries. This leads to lots of
11 # semi-random crashes. So, avoid this preInclude unless
12 # you're trying to get it to work...
13 #
14 
15 # First off, let's disable PerfMon. It doesn't mix well with GPT.
16 include( "PerfMonGPerfTools/DisablePerfMon_jobOFragment.py" ) # noqa: F821
17 
18 # Set up the profiler service:
19 from AthenaCommon.AppMgr import ServiceMgr
20 from PerfMonGPerfTools.PerfMonGPerfToolsConf import GPT__ProfilerService
21 ServiceMgr += GPT__ProfilerService( "ProfilerService" )
22 ServiceMgr.ProfilerService.ControlledProfiling = False
23 # Tell the service to profile the entire job:
24 ServiceMgr.ProfilerService.InitEvent = -1
25 ServiceMgr.ProfilerService.ProfileFileName = "gpt-fulljob.profile"
26 
27 # Set up the profiler service as the first service to be created:
28 theApp.CreateSvc.insert( 0, "GPT::ProfilerService/ProfilerService" ) # noqa: F821
29 
30 # Print a message with what happened:
31 from AthenaCommon.Logging import logging
32 log = logging.getLogger( "ProfileJob_preInclude" )
33 log.info( "The entire job will get CPU profiling" )
python.Include.include
include
Definition: Include.py:318