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

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

Issue 14823009: Add the reason in heap profiler dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased again Created 7 years, 7 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
« no previous file with comments | « third_party/tcmalloc/chromium/src/deep-heap-profile.cc ('k') | tools/deep_memory_profiler/dmprof.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 67cb31e464d286fa30f228a9abac955fe8360f62..e08b0fcc7cbd233d0b3b73dba2dc7df519f86d16 100644
--- a/third_party/tcmalloc/chromium/src/heap-profiler.cc
+++ b/third_party/tcmalloc/chromium/src/heap-profiler.cc
@@ -225,7 +225,7 @@ static DeepHeapProfile* deep_profile = NULL; // deep memory profiler
//----------------------------------------------------------------------
// Input must be a buffer of size at least 1MB.
-static char* DoGetHeapProfileLocked(char* buf, int buflen) {
+static char* DoGetHeapProfileLocked(const char* reason, char* buf, int buflen) {
// We used to be smarter about estimating the required memory and
// then capping it to 1MB and generating the profile into that.
if (buf == NULL || buflen < 1)
@@ -237,7 +237,7 @@ static char* DoGetHeapProfileLocked(char* buf, int buflen) {
HeapProfileTable::Stats const stats = heap_profile->total();
(void)stats; // avoid an unused-variable warning in non-debug mode.
if (deep_profile) {
- bytes_written = deep_profile->FillOrderedProfile(buf, buflen - 1);
+ bytes_written = deep_profile->FillOrderedProfile(reason, buf, buflen - 1);
} else {
bytes_written = heap_profile->FillOrderedProfile(buf, buflen - 1);
}
@@ -257,7 +257,7 @@ extern "C" char* GetHeapProfile() {
// Use normal malloc: we return the profile to the user to free it:
char* buffer = reinterpret_cast<char*>(malloc(kProfileBufferSize));
SpinLockHolder l(&heap_lock);
- return DoGetHeapProfileLocked(buffer, kProfileBufferSize);
+ return DoGetHeapProfileLocked(/* reason */ NULL, buffer, kProfileBufferSize);
}
// defined below
@@ -298,7 +298,7 @@ static void DumpProfileLocked(const char* reason) {
reinterpret_cast<char*>(ProfilerMalloc(kProfileBufferSize));
}
- char* profile = DoGetHeapProfileLocked(global_profiler_buffer,
+ char* profile = DoGetHeapProfileLocked(reason, global_profiler_buffer,
kProfileBufferSize);
RawWrite(fd, profile, strlen(profile));
RawClose(fd);
« no previous file with comments | « third_party/tcmalloc/chromium/src/deep-heap-profile.cc ('k') | tools/deep_memory_profiler/dmprof.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698