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

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 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
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..f51761cef70fe9a5372811a67a8694bd0b2e29e1 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(char* buf, int buflen, const char* reason) {
Alexander Potapenko 2013/05/27 08:54:44 It's probably better to put |reason| first. I don'
Dai Mikurube (NOT FULLTIME) 2013/05/27 10:08:24 Reasonable, too. Done.
// 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(buf, buflen - 1, reason);
} 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(buffer, kProfileBufferSize, NULL);
Alexander Potapenko 2013/05/27 08:54:44 /*reason*/NULL
Dai Mikurube (NOT FULLTIME) 2013/05/27 10:08:24 Done.
}
// defined below
@@ -299,7 +299,7 @@ static void DumpProfileLocked(const char* reason) {
}
char* profile = DoGetHeapProfileLocked(global_profiler_buffer,
- kProfileBufferSize);
+ kProfileBufferSize, reason);
RawWrite(fd, profile, strlen(profile));
RawClose(fd);

Powered by Google App Engine
This is Rietveld 408576698