Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/51988 )

Change subject: scons: Make the perf and prof builds into options.
......................................................................

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
---
M SConstruct
M src/SConscript
2 files changed, 28 insertions(+), 12 deletions(-)



diff --git a/SConstruct b/SConstruct
index 18d24bc..3b2bce9 100755
--- a/SConstruct
+++ b/SConstruct
@@ -125,6 +125,10 @@
           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,12 @@
 gem5py_env.Append(CCFLAGS=['${GEM5PY_CCFLAGS_EXTRA}'])
 gem5py_env.Append(LINKFLAGS=['${GEM5PY_LINKFLAGS_EXTRA}'])

+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:
diff --git a/src/SConscript b/src/SConscript
index 068c5f9..1504349 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -828,17 +828,11 @@
     'debug': env.Clone(ENV_LABEL='debug', OBJSUFFIX='.do'),
     'opt': env.Clone(ENV_LABEL='opt', OBJSUFFIX='.o'),
     'fast': env.Clone(ENV_LABEL='fast', OBJSUFFIX='.fo'),
-    'prof': env.Clone(ENV_LABEL='prof', OBJSUFFIX='.po'),
-    'perf': env.Clone(ENV_LABEL='perf', OBJSUFFIX='.gpo')
 }

 envs['debug'].Append(CPPDEFINES=['DEBUG', 'TRACING_ON=1'])
 envs['opt'].Append(CCFLAGS=['-g'], CPPDEFINES=['TRACING_ON=1'])
 envs['fast'].Append(CPPDEFINES=['NDEBUG', 'TRACING_ON=0'])
-envs['prof'].Append(CCFLAGS=['-g', '-pg'], LINKFLAGS=['-pg'],
-        CPPDEFINES=['NDEBUG', 'TRACING_ON=0'])
-envs['perf'].Append(CCFLAGS=['-g'], CPPDEFINES=['NDEBUG', 'TRACING_ON=0'],
-        LINKFLAGS=['-Wl,--no-as-needed', '-lprofiler', '-Wl,--as-needed'])

 # For Link Time Optimization, the optimisation flags used to compile
 # individual files are decoupled from those used at link time
@@ -850,17 +844,16 @@
     else:
         envs['debug'].Append(CCFLAGS=['-ggdb3'])
     envs['debug'].Append(LINKFLAGS=['-O0'])
-    # opt, fast, prof and perf all share the same cc flags, also add
-    # the optimization to the linkflags as LTO defers the optimization
-    # to link time
-    for target in ['opt', 'fast', 'prof', 'perf']:
+ # opt and fast share the same cc flags, also add the optimization to the
+    # linkflags as LTO defers the optimization to link time
+    for target in ['opt', 'fast']:
         envs[target].Append(CCFLAGS=['-O3', '${LTO_CCFLAGS}'])
         envs[target].Append(LINKFLAGS=['-O3', '${LTO_LINKFLAGS}'])

 elif env['CLANG']:
     envs['debug'].Append(CCFLAGS=['-g', '-O0'])
-    # opt, fast, prof and perf all share the same cc flags
-    for target in ['opt', 'fast', 'prof', 'perf']:
+    # opt and fast share the same cc flags
+    for target in ['opt', 'fast']:
         envs[target].Append(CCFLAGS=['-O3'])
 else:
     error('Unknown compiler, please fix compiler options')

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51988
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id8502825146b01b4869e18d1239e32ebe3303d87
Gerrit-Change-Number: 51988
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to