summaryrefslogtreecommitdiffstats
path: root/third_party/tcmalloc
diff options
context:
space:
mode:
authordmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 13:16:28 +0000
committerdmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 13:16:28 +0000
commit4c48cbd91a38743e5c16284475568af35617442c (patch)
tree9d8abfdc2d3d7d8d3f7804b2c96e22ffeaac8612 /third_party/tcmalloc
parentd80f0e6608a6d789a97c3ad19080f7934ea42219 (diff)
downloadchromium_src-4c48cbd91a38743e5c16284475568af35617442c.zip
chromium_src-4c48cbd91a38743e5c16284475568af35617442c.tar.gz
chromium_src-4c48cbd91a38743e5c16284475568af35617442c.tar.bz2
Revert 182659 "Get a filename of dumped heap profile in a V8 ext..."
> Get a filename of dumped heap profile in a V8 extension HeapProfilerDump(). > > > BUG=chromium-os:38652 > TBR=darin@chromium.org > > > Review URL: https://chromiumcodereview.appspot.com/12212157 TBR=dmikurube@chromium.org Review URL: https://codereview.chromium.org/14969026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc')
-rw-r--r--third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h9
-rw-r--r--third_party/tcmalloc/chromium/src/heap-profiler.cc34
2 files changed, 11 insertions, 32 deletions
diff --git a/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h b/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h
index a2fe805..8e3ee96 100644
--- a/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h
+++ b/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h
@@ -90,15 +90,6 @@ PERFTOOLS_DLL_DECL void HeapProfilerStop();
*/
PERFTOOLS_DLL_DECL void HeapProfilerDump(const char *reason);
-/* Dump a profile to a file now and store the dumped filename to
- * "dumped_filename_buffer" which has a length of "filename_buffer_length"
- * in addition to HeapProfilerDump().
- */
-PERFTOOLS_DLL_DECL void HeapProfilerDumpWithFileName(
- const char *reason,
- char* dumped_filename_buffer,
- int filename_buffer_length);
-
/* Generate current heap profiling information.
* Returns an empty string when heap profiling is not active.
* The returned pointer is a '\0'-terminated string allocated using malloc()
diff --git a/third_party/tcmalloc/chromium/src/heap-profiler.cc b/third_party/tcmalloc/chromium/src/heap-profiler.cc
index df110f1..67cb31e 100644
--- a/third_party/tcmalloc/chromium/src/heap-profiler.cc
+++ b/third_party/tcmalloc/chromium/src/heap-profiler.cc
@@ -265,9 +265,7 @@ static void NewHook(const void* ptr, size_t size);
static void DeleteHook(const void* ptr);
// Helper for HeapProfilerDump.
-static void DumpProfileLocked(const char* reason,
- char* filename_buffer,
- size_t filename_buffer_length) {
+static void DumpProfileLocked(const char* reason) {
RAW_DCHECK(heap_lock.IsHeld(), "");
RAW_DCHECK(is_on, "");
RAW_DCHECK(!dumping, "");
@@ -277,17 +275,18 @@ static void DumpProfileLocked(const char* reason,
dumping = true;
// Make file name
+ char file_name[1000];
dump_count++;
- snprintf(filename_buffer, filename_buffer_length, "%s.%05d.%04d%s",
+ 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)", filename_buffer, reason);
+ RAW_VLOG(0, "Dumping heap profile to %s (%s)", file_name, reason);
// We must use file routines that don't access memory, since we hold
// a memory lock now.
- RawFD fd = RawOpenForWriting(filename_buffer);
+ RawFD fd = RawOpenForWriting(file_name);
if (fd == kIllegalRawFD) {
- RAW_LOG(ERROR, "Failed dumping heap profile to %s", filename_buffer);
+ RAW_LOG(ERROR, "Failed dumping heap profile to %s", file_name);
dumping = false;
return;
}
@@ -306,10 +305,10 @@ static void DumpProfileLocked(const char* reason,
#if defined(TYPE_PROFILING)
if (FLAGS_heap_profile_type_statistics) {
- snprintf(filename_buffer, filename_buffer_length, "%s.%05d.%04d.type",
+ snprintf(file_name, sizeof(file_name), "%s.%05d.%04d.type",
filename_prefix, getpid(), dump_count);
- RAW_VLOG(0, "Dumping type statistics to %s", filename_buffer);
- heap_profile->DumpTypeStatistics(filename_buffer);
+ RAW_VLOG(0, "Dumping type statistics to %s", file_name);
+ heap_profile->DumpTypeStatistics(file_name);
}
#endif // defined(TYPE_PROFILING)
@@ -358,8 +357,7 @@ static void MaybeDumpProfileLocked() {
last_dump_time = current_time;
}
if (need_to_dump) {
- char filename_buffer[1000];
- DumpProfileLocked(buf, filename_buffer, sizeof(filename_buffer));
+ DumpProfileLocked(buf);
last_dump_alloc = total.alloc_size;
last_dump_free = total.free_size;
@@ -612,17 +610,7 @@ extern "C" void HeapProfilerStop() {
extern "C" void HeapProfilerDump(const char* reason) {
SpinLockHolder l(&heap_lock);
if (is_on && !dumping) {
- char filename_buffer[1000];
- DumpProfileLocked(reason, filename_buffer, sizeof(filename_buffer));
- }
-}
-
-extern "C" void HeapProfilerDumpWithFileName(const char* reason,
- char* dumped_filename_buffer,
- int filename_buffer_length) {
- SpinLockHolder l(&heap_lock);
- if (is_on && !dumping) {
- DumpProfileLocked(reason, dumped_filename_buffer, filename_buffer_length);
+ DumpProfileLocked(reason);
}
}