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

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

Issue 10832290: Dump /proc/<pid>/maps with every heap profile dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comments. 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
« no previous file with comments | « third_party/tcmalloc/chromium/src/deep-heap-profile.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/deep-heap-profile.cc
diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
index 3577d04c92989b60bc4848ea31b70e96df744bed..1119d9fa26d275ac3bd1b78764c03e7172aa43bc 100644
--- a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
+++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
@@ -90,9 +90,13 @@ int DeepHeapProfile::FillOrderedProfile(char buffer[], int buffer_size) {
}
}
- // Write maps into a .maps file with using the global buffer.
- WriteMapsToFile(filename_prefix_, kProfilerBufferSize, profiler_buffer_);
+ // Write maps into "|filename_prefix|.<pid>.maps" using global buffer.
+ WriteMapsToFile(filename_prefix_, 0,
+ kProfilerBufferSize, profiler_buffer_);
}
+ // Write maps into "|filename_prefix|.<pid>.|count|.maps" using global buffer.
+ WriteMapsToFile(filename_prefix_, dump_count_,
+ kProfilerBufferSize, profiler_buffer_);
// Reset committed sizes of buckets.
ResetCommittedSize(deep_table_);
@@ -323,11 +327,18 @@ size_t DeepHeapProfile::GetCommittedSize(
// static
void DeepHeapProfile::WriteMapsToFile(const char* filename_prefix,
+ unsigned count,
int buffer_size,
char buffer[]) {
char filename[100];
- snprintf(filename, sizeof(filename),
- "%s.%05d.maps", filename_prefix, static_cast<int>(getpid()));
+ if (count > 0) {
+ snprintf(filename, sizeof(filename),
+ "%s.%05d.%04d.maps", filename_prefix, static_cast<int>(getpid()),
+ count);
+ } else {
+ snprintf(filename, sizeof(filename),
+ "%s.%05d.maps", filename_prefix, static_cast<int>(getpid()));
+ }
RawFD maps_fd = RawOpenForWriting(filename);
RAW_DCHECK(maps_fd != kIllegalRawFD, "");
« no previous file with comments | « third_party/tcmalloc/chromium/src/deep-heap-profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698