Skip to content

Commit 76a9227

Browse files
committed
Added support of WITH_GPROF to cmake
1 parent 65c43bc commit 76a9227

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

BUILD/SETUP.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,11 @@ gcov_configs="--with-gcov"
315315

316316
# gprof
317317

318-
gprof_compile_flags="-O2 -pg -g"
318+
gprof_compile_flags="-O2"
319319

320+
# Rest of the flags are set in CmakeFile.txt
320321
gprof_link_flags="--disable-shared $static_link"
321322

322-
disable_gprof_plugins="--with-zlib-dir=bundled --without-plugin-oqgraph --without-plugin-mroonga"
323+
disable_gprof_plugins="--with-zlib-dir=bundled --without-plugin-oqgraph --without-plugin-mroonga --with-gprof"
323324

324325
disable_asan_plugins="--without-plugin-rocksdb"

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,18 @@ IF (WITH_MSAN)
242242
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
243243
ENDIF()
244244

245+
OPTION(WITH_GPROF "Enable profilingg with gprof" OFF)
246+
IF (WITH_GPROF)
247+
MY_CHECK_AND_SET_COMPILER_FLAG("-pg -g -no-pie -fPIC")
248+
ENDIF()
249+
245250
# Be nice to profilers etc
246251
MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO)
247252

248253
# enable security hardening features, like most distributions do
249254
# in our benchmarks that costs about ~1% of performance, depending on the load
250255
OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON)
251-
IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN)
256+
IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF)
252257
# security-enhancing flags
253258
MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC")
254259
MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now")

0 commit comments

Comments
 (0)