summaryrefslogtreecommitdiffstats
path: root/third_party/tcmalloc/chromium/src/heap-profiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/tcmalloc/chromium/src/heap-profiler.cc')
-rw-r--r--third_party/tcmalloc/chromium/src/heap-profiler.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/third_party/tcmalloc/chromium/src/heap-profiler.cc b/third_party/tcmalloc/chromium/src/heap-profiler.cc
index 1c5fcf0..04704f2 100644
--- a/third_party/tcmalloc/chromium/src/heap-profiler.cc
+++ b/third_party/tcmalloc/chromium/src/heap-profiler.cc
@@ -125,6 +125,11 @@ DEFINE_bool(only_mmap_profile,
DEFINE_bool(deep_heap_profile,
EnvToBool("DEEP_HEAP_PROFILE", false),
"If heap-profiling is on, profile deeper (only on Linux)");
+#if defined(TYPE_PROFILING)
+DEFINE_bool(heap_profile_type_statistics,
+ EnvToBool("HEAP_PROFILE_TYPE_STATISTICS", false),
+ "If heap-profiling is on, dump type statistics.");
+#endif // defined(TYPE_PROFILING)
//----------------------------------------------------------------------
@@ -305,6 +310,15 @@ static void DumpProfileLocked(const char* reason) {
RawWrite(fd, profile, strlen(profile));
RawClose(fd);
+#if defined(TYPE_PROFILING)
+ if (FLAGS_heap_profile_type_statistics) {
+ snprintf(file_name, sizeof(file_name), "%s.%05d.%04d.type",
+ filename_prefix, getpid(), dump_count);
+ RAW_VLOG(0, "Dumping type statistics to %s", file_name);
+ heap_profile->DumpTypeStatistics(file_name);
+ }
+#endif // defined(TYPE_PROFILING)
+
dumping = false;
}