| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "Source/platform/heap/BlinkGCMemoryDumpProvider.h" | 6 #include "Source/platform/heap/BlinkGCMemoryDumpProvider.h" |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "public/platform/WebMemoryAllocatorDump.h" | 9 #include "public/platform/WebMemoryAllocatorDump.h" |
| 10 #include "public/platform/WebProcessMemoryDump.h" | 10 #include "public/platform/WebProcessMemoryDump.h" |
| 11 #include "wtf/StdLibExtras.h" | 11 #include "wtf/StdLibExtras.h" |
| 12 #include "wtf/Threading.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() | 16 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() |
| 16 { | 17 { |
| 17 DEFINE_STATIC_LOCAL(BlinkGCMemoryDumpProvider, instance, ()); | 18 DEFINE_STATIC_LOCAL(BlinkGCMemoryDumpProvider, instance, ()); |
| 18 return &instance; | 19 return &instance; |
| 19 } | 20 } |
| 20 | 21 |
| 21 bool BlinkGCMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump* memory
Dump) | 22 bool BlinkGCMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump* memory
Dump) |
| 22 { | 23 { |
| 23 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum
p("blink_gc"); | 24 String dumpName = String::format("blink_gc/thread_%lu", static_cast<unsigned
long>(WTF::currentThread())); |
| 25 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum
p(dumpName); |
| 24 allocatorDump->AddScalar("size", "bytes", Heap::allocatedSpace()); | 26 allocatorDump->AddScalar("size", "bytes", Heap::allocatedSpace()); |
| 25 | 27 |
| 26 WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump(
"blink_gc/allocated_objects"); | 28 dumpName.append("/allocated_objects"); |
| 27 objectsDump->AddScalar("size", "bytes", Heap::allocatedObjectSize()); | 29 WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump(
dumpName); |
| 30 objectsDump->AddScalar("size", "bytes", Heap::allocatedObjectSize() + Heap::
markedObjectSize()); |
| 28 objectsDump->AddScalar("estimated_live_object_size", "bytes", Heap::estimate
dLiveObjectSize()); | 31 objectsDump->AddScalar("estimated_live_object_size", "bytes", Heap::estimate
dLiveObjectSize()); |
| 29 | 32 |
| 30 return true; | 33 return true; |
| 31 } | 34 } |
| 32 | 35 |
| 33 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() | 36 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() |
| 34 { | 37 { |
| 35 } | 38 } |
| 36 | 39 |
| 37 BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() | 40 BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() |
| 38 { | 41 { |
| 39 } | 42 } |
| 40 | 43 |
| 41 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |