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

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

Issue 2650863003: [tracing] Switch to new heap dump format. (Closed)
Patch Set: Rebase Created 3 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
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 "platform/heap/BlinkGCMemoryDumpProvider.h" 5 #include "platform/heap/BlinkGCMemoryDumpProvider.h"
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8 8
9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
10 #include "base/trace_event/memory_allocator_dump.h" 10 #include "base/trace_event/memory_allocator_dump.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 MemoryDumpLevelOfDetail level_of_detail = args.level_of_detail; 59 MemoryDumpLevelOfDetail level_of_detail = args.level_of_detail;
60 // In the case of a detailed dump perform a mark-only GC pass to collect 60 // In the case of a detailed dump perform a mark-only GC pass to collect
61 // more detailed stats. 61 // more detailed stats.
62 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) 62 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED)
63 ThreadState::Current()->CollectGarbage(BlinkGC::kNoHeapPointersOnStack, 63 ThreadState::Current()->CollectGarbage(BlinkGC::kNoHeapPointersOnStack,
64 BlinkGC::kTakeSnapshot, 64 BlinkGC::kTakeSnapshot,
65 BlinkGC::kForcedGC); 65 BlinkGC::kForcedGC);
66 DumpMemoryTotals(memory_dump); 66 DumpMemoryTotals(memory_dump);
67 67
68 if (allocation_register_.is_enabled()) { 68 if (allocation_register_.is_enabled()) {
69 // Overhead should always be reported, regardless of light vs. heavy. 69 memory_dump->DumpHeapUsage(allocation_register_, "blink_gc");
70 base::trace_event::TraceEventMemoryOverhead overhead;
71 std::unordered_map<base::trace_event::AllocationContext,
72 base::trace_event::AllocationMetrics>
73 metrics_by_context;
74 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) {
75 allocation_register_.UpdateAndReturnsMetrics(metrics_by_context);
76 }
77 allocation_register_.EstimateTraceMemoryOverhead(&overhead);
78 memory_dump->DumpHeapUsage(metrics_by_context, overhead, "blink_gc");
79 } 70 }
80 71
81 // Merge all dumps collected by ThreadHeap::collectGarbage. 72 // Merge all dumps collected by ThreadHeap::collectGarbage.
82 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) 73 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED)
83 memory_dump->TakeAllDumpsFrom(current_process_memory_dump_.get()); 74 memory_dump->TakeAllDumpsFrom(current_process_memory_dump_.get());
84 return true; 75 return true;
85 } 76 }
86 77
87 void BlinkGCMemoryDumpProvider::OnHeapProfilingEnabled(bool enabled) { 78 void BlinkGCMemoryDumpProvider::OnHeapProfilingEnabled(bool enabled) {
88 if (enabled) { 79 if (enabled) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 allocation_register_.Insert(address, size, context); 118 allocation_register_.Insert(address, size, context);
128 } 119 }
129 120
130 void BlinkGCMemoryDumpProvider::Remove(Address address) { 121 void BlinkGCMemoryDumpProvider::Remove(Address address) {
131 if (!allocation_register_.is_enabled()) 122 if (!allocation_register_.is_enabled())
132 return; 123 return;
133 allocation_register_.Remove(address); 124 allocation_register_.Remove(address);
134 } 125 }
135 126
136 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698