| Index: third_party/tcmalloc/chromium/src/heap-profile-table.cc
|
| diff --git a/third_party/tcmalloc/chromium/src/heap-profile-table.cc b/third_party/tcmalloc/chromium/src/heap-profile-table.cc
|
| index 696f41e0b9cedbbaf36f43fd71e36605eb0e8117..02e32965ea6740d0706838418aabc5ac44e85c4a 100644
|
| --- a/third_party/tcmalloc/chromium/src/heap-profile-table.cc
|
| +++ b/third_party/tcmalloc/chromium/src/heap-profile-table.cc
|
| @@ -290,6 +290,14 @@ void HeapProfileTable::MarkAsIgnored(const void* ptr) {
|
| }
|
| }
|
|
|
| +void HeapProfileTable::MarkAllAsIgnored() {
|
| + alloc_address_map_->Iterate(MarkAllIterator, true);
|
| +}
|
| +
|
| +void HeapProfileTable::MarkAllAsLive() {
|
| + alloc_address_map_->Iterate(MarkAllIterator, false);
|
| +}
|
| +
|
| // We'd be happier using snprintfer, but we don't to reduce dependencies.
|
| int HeapProfileTable::UnparseBucket(const Bucket& b,
|
| char* buf, int buflen, int bufsize,
|
| @@ -396,6 +404,17 @@ void HeapProfileTable::ClearMMapData() {
|
| mmap_address_map_ = NULL;
|
| }
|
|
|
| +void HeapProfileTable::DumpLiveObjects(const char* file_name) {
|
| + RawFD fd = RawOpenForWriting(file_name);
|
| + if (fd == kIllegalRawFD) {
|
| + RAW_LOG(ERROR, "Failed dumping live objects to %s", file_name);
|
| + return;
|
| + }
|
| + const DumpArgs args(fd, NULL);
|
| + alloc_address_map_->Iterate<const DumpArgs&>(DumpLiveIterator, args);
|
| + RawClose(fd);
|
| +}
|
| +
|
| void HeapProfileTable::IterateOrderedAllocContexts(
|
| AllocContextIterator callback) const {
|
| Bucket** list = MakeSortedBucketList();
|
| @@ -474,6 +493,28 @@ void HeapProfileTable::DumpNonLiveIterator(const void* ptr, AllocValue* v,
|
| RawWrite(args.fd, buf, len);
|
| }
|
|
|
| +inline
|
| +void HeapProfileTable::DumpLiveIterator(const void* ptr, AllocValue* v,
|
| + const DumpArgs& args) {
|
| + if (!v->live()) {
|
| + return;
|
| + }
|
| + if (v->ignore()) {
|
| + return;
|
| + }
|
| + Bucket b;
|
| + memset(&b, 0, sizeof(b));
|
| + b.allocs = 1;
|
| + b.alloc_size = v->bytes;
|
| + b.depth = v->bucket()->depth;
|
| + b.stack = v->bucket()->stack;
|
| + char addr[16];
|
| + snprintf(addr, "%p", ptr);
|
| + char buf[1024];
|
| + int len = UnparseBucket(b, buf, 0, sizeof(buf), addr, args.profile_stats);
|
| + RawWrite(args.fd, buf, len);
|
| +}
|
| +
|
| inline void HeapProfileTable::ZeroBucketCountsIterator(
|
| const void* ptr, AllocValue* v, HeapProfileTable* heap_profile) {
|
| Bucket* b = v->bucket();
|
|
|