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

Side by Side Diff: Source/platform/heap/BlinkGCMemoryDumpProvider.cpp

Issue 1203493004: [tracing] Adding class-wise memory statistics to blink gc memory dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Disabling the classes dump, avoid double counting, and comments. Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/platform/heap/GCInfo.h » ('j') | Source/platform/heap/ThreadState.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "public/platform/WebMemoryAllocatorDump.h" 10 #include "public/platform/WebMemoryAllocatorDump.h"
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() 23 BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider()
24 { 24 {
25 } 25 }
26 26
27 bool BlinkGCMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump* memory Dump) 27 bool BlinkGCMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump* memory Dump)
28 { 28 {
29 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::TakeSn apshot, Heap::ForcedGC); 29 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::TakeSn apshot, Heap::ForcedGC);
30 String dumpName = String::format("blink_gc/thread_%lu", static_cast<unsigned long>(WTF::currentThread())); 30 String dumpName = String::format("blink_gc/thread_%lu", static_cast<unsigned long>(WTF::currentThread()));
31 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum p(dumpName); 31 WebMemoryAllocatorDump* allocatorDump = m_currentProcessMemoryDump->getMemor yAllocatorDump(dumpName);
32 if (!allocatorDump)
33 allocatorDump = m_currentProcessMemoryDump->createMemoryAllocatorDump(du mpName);
32 allocatorDump->AddScalar("size", "bytes", Heap::allocatedSpace()); 34 allocatorDump->AddScalar("size", "bytes", Heap::allocatedSpace());
33 35
34 dumpName.append("/allocated_objects"); 36 dumpName.append("/allocated_objects");
35 WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump( dumpName); 37 WebMemoryAllocatorDump* objectsDump = m_currentProcessMemoryDump->createMemo ryAllocatorDump(dumpName);
36 objectsDump->AddScalar("size", "bytes", Heap::allocatedObjectSize() + Heap:: markedObjectSize()); 38 objectsDump->AddScalar("size", "bytes", Heap::allocatedObjectSize() + Heap:: markedObjectSize());
37 objectsDump->AddScalar("estimated_live_object_size", "bytes", Heap::estimate dLiveObjectSize()); 39 objectsDump->AddScalar("estimated_live_object_size", "bytes", Heap::estimate dLiveObjectSize());
38 40
39 // Merge all dumps collected by Heap::collectGarbage. 41 // Merge all dumps collected by Heap::collectGarbage.
40 memoryDump->takeAllDumpsFrom(m_currentProcessMemoryDump.get()); 42 memoryDump->takeAllDumpsFrom(m_currentProcessMemoryDump.get());
41 return true; 43 return true;
42 } 44 }
43 45
44 WebMemoryAllocatorDump* BlinkGCMemoryDumpProvider::createMemoryAllocatorDumpForC urrentGC(const String& absoluteName) 46 WebMemoryAllocatorDump* BlinkGCMemoryDumpProvider::createMemoryAllocatorDumpForC urrentGC(const String& absoluteName)
45 { 47 {
46 return m_currentProcessMemoryDump->createMemoryAllocatorDump(absoluteName); 48 return m_currentProcessMemoryDump->createMemoryAllocatorDump(absoluteName);
47 } 49 }
48 50
49 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC() 51 void BlinkGCMemoryDumpProvider::clearProcessDumpForCurrentGC()
50 { 52 {
51 m_currentProcessMemoryDump->clear(); 53 m_currentProcessMemoryDump->clear();
52 } 54 }
53 55
54 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() 56 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider()
55 : m_currentProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemo ryDump())) 57 : m_currentProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemo ryDump()))
56 { 58 {
57 } 59 }
58 60
59 } // namespace blink 61 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/GCInfo.h » ('j') | Source/platform/heap/ThreadState.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698