| 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 "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
| 10 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 other_dump->AddScalar( | 97 other_dump->AddScalar( |
| 98 "allocated_objects_size", | 98 "allocated_objects_size", |
| 99 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 99 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 100 heap_statistics.used_heap_size() - known_spaces_used_size); | 100 heap_statistics.used_heap_size() - known_spaces_used_size); |
| 101 | 101 |
| 102 other_dump->AddScalar("virtual_size", | 102 other_dump->AddScalar("virtual_size", |
| 103 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 103 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 104 heap_statistics.total_heap_size() - known_spaces_size); | 104 heap_statistics.total_heap_size() - known_spaces_size); |
| 105 | 105 |
| 106 // If light dump is requested, then object statistics are not dumped | 106 // If light dump is requested, then object statistics are not dumped |
| 107 if (args.level_of_detail == | 107 if (args.level_of_detail == base::trace_event::MemoryDumpLevelOfDetail::LIGHT) |
| 108 base::trace_event::MemoryDumpArgs::LevelOfDetail::LOW) | |
| 109 return; | 108 return; |
| 110 | 109 |
| 111 // Dump statistics of the heap's live objects from last GC. | 110 // Dump statistics of the heap's live objects from last GC. |
| 112 // TODO(primiano): these should not be tracked in the same trace event as they | 111 // TODO(primiano): these should not be tracked in the same trace event as they |
| 113 // report stats for the last GC (not the current state). See crbug.com/498779. | 112 // report stats for the last GC (not the current state). See crbug.com/498779. |
| 114 std::string object_name_prefix = dump_base_name + "/heap_objects_at_last_gc"; | 113 std::string object_name_prefix = dump_base_name + "/heap_objects_at_last_gc"; |
| 115 bool did_dump_object_stats = false; | 114 bool did_dump_object_stats = false; |
| 116 const size_t object_types = | 115 const size_t object_types = |
| 117 isolate_holder_->isolate()->NumberOfTrackedHeapObjectTypes(); | 116 isolate_holder_->isolate()->NumberOfTrackedHeapObjectTypes(); |
| 118 for (size_t type_index = 0; type_index < object_types; type_index++) { | 117 for (size_t type_index = 0; type_index < object_types; type_index++) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 148 } | 147 } |
| 149 | 148 |
| 150 if (did_dump_object_stats) { | 149 if (did_dump_object_stats) { |
| 151 process_memory_dump->AddOwnershipEdge( | 150 process_memory_dump->AddOwnershipEdge( |
| 152 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), | 151 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), |
| 153 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); | 152 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); |
| 154 } | 153 } |
| 155 } | 154 } |
| 156 | 155 |
| 157 } // namespace gin | 156 } // namespace gin |
| OLD | NEW |