diff options
author | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-14 12:40:08 +0000 |
---|---|---|
committer | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-14 12:40:08 +0000 |
commit | 995bfd526e8192c1e1886bfc12eff6d6f93fc124 (patch) | |
tree | f21603dd840adfc6dfcaec9ee42eb0b2b9e4d6d9 /third_party | |
parent | 969ea51ab035298be2d2be927f9f28e3a3cbe9d7 (diff) | |
download | chromium_src-995bfd526e8192c1e1886bfc12eff6d6f93fc124.zip chromium_src-995bfd526e8192c1e1886bfc12eff6d6f93fc124.tar.gz chromium_src-995bfd526e8192c1e1886bfc12eff6d6f93fc124.tar.bz2 |
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
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/tcmalloc/chromium/src/deep-heap-profile.cc | 19 | ||||
-rw-r--r-- | third_party/tcmalloc/chromium/src/deep-heap-profile.h | 7 |
2 files changed, 20 insertions, 6 deletions
diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc index fb2143c..e86570a 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, ""); diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.h b/third_party/tcmalloc/chromium/src/deep-heap-profile.h index 5a5ae8e..1eebdaa 100644 --- a/third_party/tcmalloc/chromium/src/deep-heap-profile.h +++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.h @@ -189,9 +189,12 @@ class DeepHeapProfile { uint64 first_address, uint64 last_address); - // Write re-formatted /proc/self/maps into a file which has |filename_prefix| - // with using |buffer| of size |buffer_size|. + // Write re-formatted /proc/self/maps into a file with using |buffer| of + // 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, + unsigned count, int buffer_size, char buffer[]); |