Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/tcmalloc/chromium/src/heap-profiler.cc

Issue 10830113: Dump type statistics of malloc'ed objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refactored Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..efddfaebe0560d9011509577094686f744dd099a 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(PROFILING_ALLOCATED_TYPE)
+DEFINE_bool(heap_profile_dump_allocated_type,
+ EnvToBool("HEAP_PROFILE_DUMP_ALLOCATED_TYPE", false),
+ "If heap-profiling is on, dump allocated type statistics.");
+#endif // PROFILING_ALLOCATED_TYPE
//----------------------------------------------------------------------
@@ -305,6 +310,15 @@ static void DumpProfileLocked(const char* reason) {
RawWrite(fd, profile, strlen(profile));
RawClose(fd);
+#if defined(PROFILING_ALLOCATED_TYPE)
+ if (FLAGS_heap_profile_dump_allocated_type) {
+ snprintf(file_name, sizeof(file_name), "%s.%05d.%04d.type",
+ filename_prefix, getpid(), dump_count);
+ RAW_VLOG(0, "Dumping allocated type statistics to %s", file_name);
+ heap_profile->DumpAllocatedTypeStatistics(file_name);
+ }
+#endif // PROFILING_ALLOCATED_TYPE
+
dumping = false;
}

Powered by Google App Engine
This is Rietveld 408576698