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 "platform/heap/BlinkGCMemoryDumpProvider.h" | 5 #include "platform/heap/BlinkGCMemoryDumpProvider.h" |
6 | 6 |
7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 7 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
8 #include "base/trace_event/heap_profiler_allocation_register.h" | 8 #include "base/trace_event/heap_profiler_allocation_register.h" |
9 #include "base/trace_event/memory_allocator_dump.h" | 9 #include "base/trace_event/memory_allocator_dump.h" |
10 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 // more detailed stats. | 60 // more detailed stats. |
61 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) | 61 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) |
62 ThreadState::Current()->CollectGarbage(BlinkGC::kNoHeapPointersOnStack, | 62 ThreadState::Current()->CollectGarbage(BlinkGC::kNoHeapPointersOnStack, |
63 BlinkGC::kTakeSnapshot, | 63 BlinkGC::kTakeSnapshot, |
64 BlinkGC::kForcedGC); | 64 BlinkGC::kForcedGC); |
65 DumpMemoryTotals(memory_dump); | 65 DumpMemoryTotals(memory_dump); |
66 | 66 |
67 if (is_heap_profiling_enabled_) { | 67 if (is_heap_profiling_enabled_) { |
68 // Overhead should always be reported, regardless of light vs. heavy. | 68 // Overhead should always be reported, regardless of light vs. heavy. |
69 base::trace_event::TraceEventMemoryOverhead overhead; | 69 base::trace_event::TraceEventMemoryOverhead overhead; |
70 base::hash_map<base::trace_event::AllocationContext, | 70 std::unordered_map<base::trace_event::AllocationContext, |
Łukasz Anforowicz
2017/04/24 18:46:10
IWYU: #include <unordered_map>?
| |
71 base::trace_event::AllocationMetrics> | 71 base::trace_event::AllocationMetrics> |
72 metrics_by_context; | 72 metrics_by_context; |
73 { | 73 { |
74 MutexLocker locker(allocation_register_mutex_); | 74 MutexLocker locker(allocation_register_mutex_); |
75 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { | 75 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { |
76 for (const auto& alloc_size : *allocation_register_) { | 76 for (const auto& alloc_size : *allocation_register_) { |
77 base::trace_event::AllocationMetrics& metrics = | 77 base::trace_event::AllocationMetrics& metrics = |
78 metrics_by_context[alloc_size.context]; | 78 metrics_by_context[alloc_size.context]; |
79 metrics.size += alloc_size.size; | 79 metrics.size += alloc_size.size; |
80 metrics.count++; | 80 metrics.count++; |
81 } | 81 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 allocation_register_->Insert(address, size, context); | 139 allocation_register_->Insert(address, size, context); |
140 } | 140 } |
141 | 141 |
142 void BlinkGCMemoryDumpProvider::Remove(Address address) { | 142 void BlinkGCMemoryDumpProvider::Remove(Address address) { |
143 MutexLocker locker(allocation_register_mutex_); | 143 MutexLocker locker(allocation_register_mutex_); |
144 if (allocation_register_) | 144 if (allocation_register_) |
145 allocation_register_->Remove(address); | 145 allocation_register_->Remove(address); |
146 } | 146 } |
147 | 147 |
148 } // namespace blink | 148 } // namespace blink |
OLD | NEW |