summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-23 09:44:47 +0000
committerglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-23 09:44:47 +0000
commitda7325c4fd64d753081bef51936013075c89307f (patch)
tree0beea46e2b2b08738e5e2da0061ddd9beed75fbd /third_party
parent4c271b9cdc81ce440cd6dd103fd32e90d1c65382 (diff)
downloadchromium_src-da7325c4fd64d753081bef51936013075c89307f.zip
chromium_src-da7325c4fd64d753081bef51936013075c89307f.tar.gz
chromium_src-da7325c4fd64d753081bef51936013075c89307f.tar.bz2
Fix heap profiler to always append the process id to the heap dump.
To run Chrome: HEAP_PROFILE_ALLOCATION_INTERVAL=1000000 HEAPPROFILE=heapprof out/Debug/chrome To analyze: pprof --text out/Debug/chrome heapprof.21026.0039.heap pprof --gv out/Debug/chrome heapprof.21026.0039.heap (pprof is slooow) Review URL: http://codereview.chromium.org/6532051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86273 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/tcmalloc/chromium/src/base/sysinfo.cc5
-rw-r--r--third_party/tcmalloc/chromium/src/heap-profiler.cc4
2 files changed, 7 insertions, 2 deletions
diff --git a/third_party/tcmalloc/chromium/src/base/sysinfo.cc b/third_party/tcmalloc/chromium/src/base/sysinfo.cc
index 7af0495..adb2072 100644
--- a/third_party/tcmalloc/chromium/src/base/sysinfo.cc
+++ b/third_party/tcmalloc/chromium/src/base/sysinfo.cc
@@ -176,6 +176,9 @@ const char* GetenvBeforeMain(const char* name) {
// in their first character! If that assumption is violated, we'll
// still get a profile, but one with an unexpected name.
// TODO(csilvers): set an envvar instead when we can do it reliably.
+//
+// In Chromium this hack is intentionally disabled, because the path is not
+// re-initialized upon fork.
bool GetUniquePathFromEnv(const char* env_name, char* path) {
char* envval = getenv(env_name);
if (envval == NULL || *envval == '\0')
@@ -185,7 +188,9 @@ bool GetUniquePathFromEnv(const char* env_name, char* path) {
envval[0] & 127, envval+1, (unsigned int)(getpid()));
} else {
snprintf(path, PATH_MAX, "%s", envval);
+#if 0
envval[0] |= 128; // set high bit for kids to see
+#endif
}
return true;
}
diff --git a/third_party/tcmalloc/chromium/src/heap-profiler.cc b/third_party/tcmalloc/chromium/src/heap-profiler.cc
index 3055f4ce..d40d4ea 100644
--- a/third_party/tcmalloc/chromium/src/heap-profiler.cc
+++ b/third_party/tcmalloc/chromium/src/heap-profiler.cc
@@ -258,8 +258,8 @@ static void DumpProfileLocked(const char* reason) {
// Make file name
char file_name[1000];
dump_count++;
- snprintf(file_name, sizeof(file_name), "%s.%04d%s",
- filename_prefix, dump_count, HeapProfileTable::kFileExt);
+ snprintf(file_name, sizeof(file_name), "%s.%05d.%04d%s",
+ filename_prefix, getpid(), dump_count, HeapProfileTable::kFileExt);
// Dump the profile
RAW_VLOG(0, "Dumping heap profile to %s (%s)", file_name, reason);