Chromium Code Reviews| 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 "gin/v8_isolate_memory_dump_provider.h" | 5 #include "gin/v8_isolate_memory_dump_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 124 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 125 heap_statistics.malloced_memory()); | 125 heap_statistics.malloced_memory()); |
| 126 const char* system_allocator_name = | 126 const char* system_allocator_name = |
| 127 base::trace_event::MemoryDumpManager::GetInstance() | 127 base::trace_event::MemoryDumpManager::GetInstance() |
| 128 ->system_allocator_pool_name(); | 128 ->system_allocator_pool_name(); |
| 129 if (system_allocator_name) { | 129 if (system_allocator_name) { |
| 130 process_memory_dump->AddSuballocation(malloc_dump->guid(), | 130 process_memory_dump->AddSuballocation(malloc_dump->guid(), |
| 131 system_allocator_name); | 131 system_allocator_name); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // If light dump is requested, then object statistics are not dumped | 134 // Only if heavy dump is requested, then object statistics are dumped. |
|
Primiano Tucci (use gerrit)
2016/06/01 09:58:26
The wording of this comment is a bit odd now.
Mayb
ssid
2016/06/01 18:53:46
Done.
| |
| 135 if (args.level_of_detail == base::trace_event::MemoryDumpLevelOfDetail::LIGHT) | 135 if (args.level_of_detail != |
| 136 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) { | |
| 136 return; | 137 return; |
| 138 } | |
| 137 | 139 |
| 138 // Dump statistics of the heap's live objects from last GC. | 140 // Dump statistics of the heap's live objects from last GC. |
| 139 // TODO(primiano): these should not be tracked in the same trace event as they | 141 // TODO(primiano): these should not be tracked in the same trace event as they |
| 140 // report stats for the last GC (not the current state). See crbug.com/498779. | 142 // report stats for the last GC (not the current state). See crbug.com/498779. |
| 141 std::string object_name_prefix = dump_base_name + "/heap_objects_at_last_gc"; | 143 std::string object_name_prefix = dump_base_name + "/heap_objects_at_last_gc"; |
| 142 bool did_dump_object_stats = false; | 144 bool did_dump_object_stats = false; |
| 143 const size_t object_types = | 145 const size_t object_types = |
| 144 isolate_holder_->isolate()->NumberOfTrackedHeapObjectTypes(); | 146 isolate_holder_->isolate()->NumberOfTrackedHeapObjectTypes(); |
| 145 for (size_t type_index = 0; type_index < object_types; type_index++) { | 147 for (size_t type_index = 0; type_index < object_types; type_index++) { |
| 146 v8::HeapObjectStatistics object_statistics; | 148 v8::HeapObjectStatistics object_statistics; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 175 } | 177 } |
| 176 | 178 |
| 177 if (did_dump_object_stats) { | 179 if (did_dump_object_stats) { |
| 178 process_memory_dump->AddOwnershipEdge( | 180 process_memory_dump->AddOwnershipEdge( |
| 179 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), | 181 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), |
| 180 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); | 182 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); |
| 181 } | 183 } |
| 182 } | 184 } |
| 183 | 185 |
| 184 } // namespace gin | 186 } // namespace gin |
| OLD | NEW |