Index: third_party/tcmalloc/chromium/src/heap-profiler.cc |
diff --git a/third_party/tcmalloc/chromium/src/heap-profiler.cc b/third_party/tcmalloc/chromium/src/heap-profiler.cc |
index 1c5fcf088e297739303d400da5f3d198bff7087b..04704f26050ecffce71085b6c6c69157872ff481 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; |
} |