3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 13:28:47 +00:00

Add gprof support

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-01-15 17:43:22 -08:00
parent eea3384106
commit 53094c6173

View file

@ -72,6 +72,7 @@ PREFIX=os.path.split(os.path.split(os.path.split(PYTHON_PACKAGE_DIR)[0])[0])[0]
GMP=False GMP=False
VS_PAR=False VS_PAR=False
VS_PAR_NUM=8 VS_PAR_NUM=8
GPROF=False
def is_windows(): def is_windows():
return IS_WINDOWS return IS_WINDOWS
@ -373,6 +374,7 @@ def display_help(exit_code):
print(" --staticlib build Z3 static library.") print(" --staticlib build Z3 static library.")
if not IS_WINDOWS: if not IS_WINDOWS:
print(" -g, --gmp use GMP.") print(" -g, --gmp use GMP.")
print(" --gprof enable gprof")
print("") print("")
print("Some influential environment variables:") print("Some influential environment variables:")
if not IS_WINDOWS: if not IS_WINDOWS:
@ -389,12 +391,12 @@ def display_help(exit_code):
# Parse configuration option for mk_make script # Parse configuration option for mk_make script
def parse_options(): def parse_options():
global VERBOSE, DEBUG_MODE, IS_WINDOWS, VS_X64, ONLY_MAKEFILES, SHOW_CPPS, VS_PROJ, TRACE, VS_PAR, VS_PAR_NUM global VERBOSE, DEBUG_MODE, IS_WINDOWS, VS_X64, ONLY_MAKEFILES, SHOW_CPPS, VS_PROJ, TRACE, VS_PAR, VS_PAR_NUM
global DOTNET_ENABLED, JAVA_ENABLED, STATIC_LIB, PREFIX, GMP, PYTHON_PACKAGE_DIR global DOTNET_ENABLED, JAVA_ENABLED, STATIC_LIB, PREFIX, GMP, PYTHON_PACKAGE_DIR, GPROF
try: try:
options, remainder = getopt.gnu_getopt(sys.argv[1:], options, remainder = getopt.gnu_getopt(sys.argv[1:],
'b:dsxhmcvtnp:gj', 'b:dsxhmcvtnp:gj',
['build=', 'debug', 'silent', 'x64', 'help', 'makefiles', 'showcpp', 'vsproj', ['build=', 'debug', 'silent', 'x64', 'help', 'makefiles', 'showcpp', 'vsproj',
'trace', 'nodotnet', 'staticlib', 'prefix=', 'gmp', 'java', 'parallel=']) 'trace', 'nodotnet', 'staticlib', 'prefix=', 'gmp', 'java', 'parallel=', 'gprof'])
except: except:
print("ERROR: Invalid command line option") print("ERROR: Invalid command line option")
display_help(1) display_help(1)
@ -439,6 +441,8 @@ def parse_options():
GMP = True GMP = True
elif opt in ('-j', '--java'): elif opt in ('-j', '--java'):
JAVA_ENABLED = True JAVA_ENABLED = True
elif opt == '--gprof':
GPROF = True
else: else:
print("ERROR: Invalid command line option '%s'" % opt) print("ERROR: Invalid command line option '%s'" % opt)
display_help(1) display_help(1)
@ -1321,6 +1325,9 @@ def mk_config():
CXX = find_cxx_compiler() CXX = find_cxx_compiler()
CC = find_c_compiler() CC = find_c_compiler()
SLIBEXTRAFLAGS = '' SLIBEXTRAFLAGS = ''
if GPROF:
CXXFLAGS = '%s -pg' % CXXFLAGS
LDFLAGS = '%s -pg' % LDFLAGS
if GMP: if GMP:
test_gmp(CXX) test_gmp(CXX)
ARITH = "gmp" ARITH = "gmp"
@ -1340,7 +1347,10 @@ def mk_config():
if DEBUG_MODE: if DEBUG_MODE:
CXXFLAGS = '%s -g -Wall' % CXXFLAGS CXXFLAGS = '%s -g -Wall' % CXXFLAGS
else: else:
CXXFLAGS = '%s -O3 -D _EXTERNAL_RELEASE -fomit-frame-pointer' % CXXFLAGS if GPROF:
CXXFLAGS = '%s -O3 -D _EXTERNAL_RELEASE' % CXXFLAGS
else:
CXXFLAGS = '%s -O3 -D _EXTERNAL_RELEASE -fomit-frame-pointer' % CXXFLAGS
if is_CXX_clangpp(): if is_CXX_clangpp():
CXXFLAGS = '%s -Wno-unknown-pragmas -Wno-overloaded-virtual -Wno-unused-value' % CXXFLAGS CXXFLAGS = '%s -Wno-unknown-pragmas -Wno-overloaded-virtual -Wno-unused-value' % CXXFLAGS
sysname = os.uname()[0] sysname = os.uname()[0]
@ -1403,6 +1413,8 @@ def mk_config():
print('OpenMP: %s' % HAS_OMP) print('OpenMP: %s' % HAS_OMP)
print('Prefix: %s' % PREFIX) print('Prefix: %s' % PREFIX)
print('64-bit: %s' % is64()) print('64-bit: %s' % is64())
if GPROF:
print('gprof: enabled')
print('Python version: %s' % distutils.sysconfig.get_python_version()) print('Python version: %s' % distutils.sysconfig.get_python_version())
if is_java_enabled(): if is_java_enabled():
print('Java Home: %s' % JAVA_HOME) print('Java Home: %s' % JAVA_HOME)