ATLAS Offline Software
Loading...
Searching...
No Matches
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.
16include( "PerfMonGPerfTools/DisablePerfMon_jobOFragment.py" ) # noqa: F821
17
18# Set up the profiler service:
19from AthenaCommon.AppMgr import ServiceMgr
20from PerfMonGPerfTools.PerfMonGPerfToolsConf import GPT__ProfilerService
21ServiceMgr += GPT__ProfilerService( "ProfilerService" )
22ServiceMgr.ProfilerService.ControlledProfiling = False
23# Tell the service to profile the entire job:
24ServiceMgr.ProfilerService.InitEvent = -1
25ServiceMgr.ProfilerService.ProfileFileName = "gpt-fulljob.profile"
26
27# Set up the profiler service as the first service to be created:
28theApp.CreateSvc.insert( 0, "GPT::ProfilerService/ProfilerService" ) # noqa: F821
29
30# Print a message with what happened:
31from AthenaCommon.Logging import logging
32log = logging.getLogger( "ProfileJob_preInclude" )
33log.info( "The entire job will get CPU profiling" )