Commit 17bd72be authored by Gabriel Marin's avatar Gabriel Marin Committed by Commit Bot

tcmalloc: compile heap profiler code only when explicitly requested

Conditionally compile the heap profiler code and its dependencies when
enable_profiling is set to true.
This removes 9 static initializers in memory_region_map.cc with the new
tcmalloc in release builds.

BUG=b:119055819
TEST=Unit tests pass

Change-Id: I99adbf662d97f40304e698661506ad0d2c066d79
Reviewed-on: https://chromium-review.googlesource.com/c/1464324
Commit-Queue: Gabriel Marin <gmx@chromium.org>
Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636570}
parent ebf7b226
...@@ -143,9 +143,6 @@ if (use_allocator == "tcmalloc") { ...@@ -143,9 +143,6 @@ if (use_allocator == "tcmalloc") {
"$tcmalloc_dir/src/gperftools/malloc_extension.h", "$tcmalloc_dir/src/gperftools/malloc_extension.h",
"$tcmalloc_dir/src/gperftools/malloc_hook.h", "$tcmalloc_dir/src/gperftools/malloc_hook.h",
"$tcmalloc_dir/src/gperftools/stacktrace.h", "$tcmalloc_dir/src/gperftools/stacktrace.h",
"$tcmalloc_dir/src/heap-profile-table.cc",
"$tcmalloc_dir/src/heap-profile-table.h",
"$tcmalloc_dir/src/heap-profiler.cc",
"$tcmalloc_dir/src/internal_logging.cc", "$tcmalloc_dir/src/internal_logging.cc",
"$tcmalloc_dir/src/internal_logging.h", "$tcmalloc_dir/src/internal_logging.h",
"$tcmalloc_dir/src/linked_list.h", "$tcmalloc_dir/src/linked_list.h",
...@@ -154,8 +151,6 @@ if (use_allocator == "tcmalloc") { ...@@ -154,8 +151,6 @@ if (use_allocator == "tcmalloc") {
"$tcmalloc_dir/src/malloc_hook.cc", "$tcmalloc_dir/src/malloc_hook.cc",
"$tcmalloc_dir/src/maybe_threads.cc", "$tcmalloc_dir/src/maybe_threads.cc",
"$tcmalloc_dir/src/maybe_threads.h", "$tcmalloc_dir/src/maybe_threads.h",
"$tcmalloc_dir/src/memory_region_map.cc",
"$tcmalloc_dir/src/memory_region_map.h",
"$tcmalloc_dir/src/page_heap.cc", "$tcmalloc_dir/src/page_heap.cc",
"$tcmalloc_dir/src/page_heap.h", "$tcmalloc_dir/src/page_heap.h",
"$tcmalloc_dir/src/raw_printer.cc", "$tcmalloc_dir/src/raw_printer.cc",
...@@ -238,6 +233,11 @@ if (use_allocator == "tcmalloc") { ...@@ -238,6 +233,11 @@ if (use_allocator == "tcmalloc") {
sources += [ sources += [
"$tcmalloc_dir/src/base/thread_lister.c", "$tcmalloc_dir/src/base/thread_lister.c",
"$tcmalloc_dir/src/base/thread_lister.h", "$tcmalloc_dir/src/base/thread_lister.h",
"$tcmalloc_dir/src/heap-profile-table.cc",
"$tcmalloc_dir/src/heap-profile-table.h",
"$tcmalloc_dir/src/heap-profiler.cc",
"$tcmalloc_dir/src/memory_region_map.cc",
"$tcmalloc_dir/src/memory_region_map.h",
"$tcmalloc_dir/src/profile-handler.cc", "$tcmalloc_dir/src/profile-handler.cc",
"$tcmalloc_dir/src/profile-handler.h", "$tcmalloc_dir/src/profile-handler.h",
"$tcmalloc_dir/src/profiledata.cc", "$tcmalloc_dir/src/profiledata.cc",
......
...@@ -48,7 +48,7 @@ void GetHeapSample(std::string* writer) { ...@@ -48,7 +48,7 @@ void GetHeapSample(std::string* writer) {
} }
bool IsHeapProfilerRunning() { bool IsHeapProfilerRunning() {
#if defined(USE_TCMALLOC) #if defined(USE_TCMALLOC) && defined(ENABLE_PROFILING)
return ::IsHeapProfilerRunning(); return ::IsHeapProfilerRunning();
#endif #endif
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment