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

Side by Side Diff: third_party/tcmalloc/chromium/src/heap-profiler.cc

Issue 6532051: Fix heap profiler to always append the process id to the heap dump.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/sysinfo.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 "Are you using another MallocHook client? " 251 "Are you using another MallocHook client? "
252 "Do not use --heap_profile=... to avoid this conflict."); 252 "Do not use --heap_profile=... to avoid this conflict.");
253 } 253 }
254 } 254 }
255 255
256 dumping = true; 256 dumping = true;
257 257
258 // Make file name 258 // Make file name
259 char file_name[1000]; 259 char file_name[1000];
260 dump_count++; 260 dump_count++;
261 snprintf(file_name, sizeof(file_name), "%s.%04d%s", 261 snprintf(file_name, sizeof(file_name), "%s.%05d.%04d%s",
262 filename_prefix, dump_count, HeapProfileTable::kFileExt); 262 filename_prefix, getpid(), dump_count, HeapProfileTable::kFileExt);
263 263
264 // Dump the profile 264 // Dump the profile
265 RAW_VLOG(0, "Dumping heap profile to %s (%s)", file_name, reason); 265 RAW_VLOG(0, "Dumping heap profile to %s (%s)", file_name, reason);
266 // We must use file routines that don't access memory, since we hold 266 // We must use file routines that don't access memory, since we hold
267 // a memory lock now. 267 // a memory lock now.
268 RawFD fd = RawOpenForWriting(file_name); 268 RawFD fd = RawOpenForWriting(file_name);
269 if (fd == kIllegalRawFD) { 269 if (fd == kIllegalRawFD) {
270 RAW_LOG(ERROR, "Failed dumping heap profile to %s", file_name); 270 RAW_LOG(ERROR, "Failed dumping heap profile to %s", file_name);
271 dumping = false; 271 dumping = false;
272 return; 272 return;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 612
613 // class used for finalization -- dumps the heap-profile at program exit 613 // class used for finalization -- dumps the heap-profile at program exit
614 struct HeapProfileEndWriter { 614 struct HeapProfileEndWriter {
615 ~HeapProfileEndWriter() { HeapProfilerDump("Exiting"); } 615 ~HeapProfileEndWriter() { HeapProfilerDump("Exiting"); }
616 }; 616 };
617 617
618 // We want to make sure tcmalloc is up and running before starting the profiler 618 // We want to make sure tcmalloc is up and running before starting the profiler
619 static const TCMallocGuard tcmalloc_initializer; 619 static const TCMallocGuard tcmalloc_initializer;
620 REGISTER_MODULE_INITIALIZER(heapprofiler, HeapProfilerInit()); 620 REGISTER_MODULE_INITIALIZER(heapprofiler, HeapProfilerInit());
621 static HeapProfileEndWriter heap_profile_end_writer; 621 static HeapProfileEndWriter heap_profile_end_writer;
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/sysinfo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698