sim: Add support for tcmalloc if it's installed and available.
This package is available in Ubuntu, Debian, and Redhat as google-perftools. With multiple tests on a single machine I've seen a little over 10% performance gain with tcmalloc.
This commit is contained in:
parent
1b370431d0
commit
aec7a44116
1 changed files with 11 additions and 0 deletions
11
SConstruct
11
SConstruct
|
@ -749,6 +749,14 @@ have_posix_clock = \
|
||||||
conf.CheckLibWithHeader('rt', 'time.h', 'C',
|
conf.CheckLibWithHeader('rt', 'time.h', 'C',
|
||||||
'clock_nanosleep(0,0,NULL,NULL);')
|
'clock_nanosleep(0,0,NULL,NULL);')
|
||||||
|
|
||||||
|
if conf.CheckLib('tcmalloc_minimal'):
|
||||||
|
have_tcmalloc = True
|
||||||
|
else:
|
||||||
|
have_tcmalloc = False
|
||||||
|
print termcap.Yellow + termcap.Bold + \
|
||||||
|
"You can get a 12% performance improvement by installing tcmalloc "\
|
||||||
|
"(google-perftools package on Ubuntu or RedHat)." + termcap.Normal
|
||||||
|
|
||||||
if not have_posix_clock:
|
if not have_posix_clock:
|
||||||
print "Can't find library for POSIX clocks."
|
print "Can't find library for POSIX clocks."
|
||||||
|
|
||||||
|
@ -1011,6 +1019,9 @@ for variant_path in variant_paths:
|
||||||
if env['USE_SSE2']:
|
if env['USE_SSE2']:
|
||||||
env.Append(CCFLAGS=['-msse2'])
|
env.Append(CCFLAGS=['-msse2'])
|
||||||
|
|
||||||
|
if have_tcmalloc:
|
||||||
|
env.Append(LIBS=['tcmalloc_minimal'])
|
||||||
|
|
||||||
# The src/SConscript file sets up the build rules in 'env' according
|
# The src/SConscript file sets up the build rules in 'env' according
|
||||||
# to the configured variables. It returns a list of environments,
|
# to the configured variables. It returns a list of environments,
|
||||||
# one for each variant build (debug, opt, etc.)
|
# one for each variant build (debug, opt, etc.)
|
||||||
|
|
Loading…
Reference in a new issue