scons: Make the perf and prof builds into options.

That makes it possible to add profiling options to debug or opt builds,
and not just the fast build which the perf/prof builds were implicitly
modeled after.

Change-Id: Id8502825146b01b4869e18d1239e32ebe3303d87
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51988
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Gabe Black
2021-10-25 00:24:49 -07:00
parent 93049b5143
commit 5290ae8dbd
2 changed files with 17 additions and 12 deletions

View File

@@ -125,6 +125,10 @@ AddOption('--with-systemc-tests', action='store_true',
help='Build systemc tests')
AddOption('--install-hooks', action='store_true',
help='Install revision control hooks non-interactively')
AddOption('--gprof', action='store_true',
help='Enable support for the gprof profiler')
AddOption('--pprof', action='store_true',
help='Enable support for the pprof profiler')
# Inject the built_tools directory into the python path.
sys.path[1:1] = [ Dir('#build_tools').abspath ]
@@ -539,6 +543,14 @@ gem5py_env = main.Clone()
gem5py_env.Append(CCFLAGS=['${GEM5PY_CCFLAGS_EXTRA}'])
gem5py_env.Append(LINKFLAGS=['${GEM5PY_LINKFLAGS_EXTRA}'])
if GetOption('gprof') and GetOption('pprof'):
error('Only one type of profiling should be enabled at a time')
if GetOption('gprof'):
main.Append(CCFLAGS=['-g', '-pg'], LINKFLAGS=['-pg'])
if GetOption('pprof'):
main.Append(CCFLAGS=['-g'],
LINKFLAGS=['-Wl,--no-as-needed', '-lprofiler', '-Wl,--as-needed'])
main['HAVE_PKG_CONFIG'] = main.Detect('pkg-config')
with gem5_scons.Configure(main) as conf: