diff options
author | Andrew Morrow <acm@mongodb.com> | 2016-03-24 08:13:03 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2016-03-24 19:12:16 -0400 |
commit | 10b650835a78fbf7ebe9cf26926cc45556efd178 (patch) | |
tree | 41e2a43fd1096841e153e904803e90a3ee89f1af /src/mongo | |
parent | a19406fdedac2bff515a0b162c8d496b11f4e455 (diff) | |
download | mongo-10b650835a78fbf7ebe9cf26926cc45556efd178.tar.gz |
SERVER-13476 Make the gperftools cpu profiler work again
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/util/SConscript | 16 | ||||
-rw-r--r-- | src/mongo/util/quick_exit.cpp | 8 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/mongo/util/SConscript b/src/mongo/util/SConscript index 371b3f1c845..3e94e20e1ce 100644 --- a/src/mongo/util/SConscript +++ b/src/mongo/util/SConscript @@ -333,13 +333,27 @@ if has_option('gcov'): ], ) +if has_option('use-cpu-profiler'): + quick_exit_env.Append( + CPPDEFINES=[ + 'MONGO_CPU_PROFILER', + ], + ) + + if not use_system_version_of_library('tcmalloc'): + quick_exit_env.InjectThirdPartyIncludePaths( + 'tcmalloc' + ) + quick_exit_env.Library( target='quick_exit', source=[ 'quick_exit.cpp', ], LIBDEPS=[ - # NOTE: You *must not* add any library dependencies to the quick_exit library + # NOTE: You *must not* add any other library dependencies to + # the quick_exit library + "$BUILD_DIR/third_party/shim_allocator", ] ) diff --git a/src/mongo/util/quick_exit.cpp b/src/mongo/util/quick_exit.cpp index e53c99420a4..586ccb0d4cd 100644 --- a/src/mongo/util/quick_exit.cpp +++ b/src/mongo/util/quick_exit.cpp @@ -62,6 +62,10 @@ #include <sanitizer/lsan_interface.h> #endif +#if defined(MONGO_CPU_PROFILER) +#include <gperftools/profiler.h> +#endif + #ifdef MONGO_GCOV extern "C" void __gcov_flush(); #endif @@ -78,6 +82,10 @@ void quickExit(int code) { if (quickExitMutex) quickExitMutex->lock(); +#if defined(MONGO_CPU_PROFILER) + ::ProfilerStop(); +#endif + #ifdef MONGO_GCOV __gcov_flush(); #endif |