Dump /proc/<pid>/maps with every heap profile dump.


BUG=123750


Review URL: https://chromiumcodereview.appspot.com/10832290

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151465 0039d316-1c4b-4281-b951-d872f2087c98
parent 969ea51a
...@@ -90,9 +90,13 @@ int DeepHeapProfile::FillOrderedProfile(char buffer[], int buffer_size) { ...@@ -90,9 +90,13 @@ int DeepHeapProfile::FillOrderedProfile(char buffer[], int buffer_size) {
} }
} }
// Write maps into a .maps file with using the global buffer. // Write maps into "|filename_prefix|.<pid>.maps" using global buffer.
WriteMapsToFile(filename_prefix_, kProfilerBufferSize, profiler_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. // Reset committed sizes of buckets.
ResetCommittedSize(deep_table_); ResetCommittedSize(deep_table_);
...@@ -323,11 +327,18 @@ size_t DeepHeapProfile::GetCommittedSize( ...@@ -323,11 +327,18 @@ size_t DeepHeapProfile::GetCommittedSize(
// static // static
void DeepHeapProfile::WriteMapsToFile(const char* filename_prefix, void DeepHeapProfile::WriteMapsToFile(const char* filename_prefix,
unsigned count,
int buffer_size, int buffer_size,
char buffer[]) { char buffer[]) {
char filename[100]; char filename[100];
snprintf(filename, sizeof(filename), if (count > 0) {
"%s.%05d.maps", filename_prefix, static_cast<int>(getpid())); 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); RawFD maps_fd = RawOpenForWriting(filename);
RAW_DCHECK(maps_fd != kIllegalRawFD, ""); RAW_DCHECK(maps_fd != kIllegalRawFD, "");
......
...@@ -189,9 +189,12 @@ class DeepHeapProfile { ...@@ -189,9 +189,12 @@ class DeepHeapProfile {
uint64 first_address, uint64 first_address,
uint64 last_address); uint64 last_address);
// Write re-formatted /proc/self/maps into a file which has |filename_prefix| // Write re-formatted /proc/self/maps into a file with using |buffer| of
// with using |buffer| of size |buffer_size|. // size |buffer_size|.
// If |count| is zero, the filename will be "|filename_prefix|.<pid>.maps".
// Otherwise, "|filename_prefix|.<pid>.|count|.maps".
static void WriteMapsToFile(const char* filename_prefix, static void WriteMapsToFile(const char* filename_prefix,
unsigned count,
int buffer_size, int buffer_size,
char buffer[]); char buffer[]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment