| 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 <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (system_allocator_name) { | 173 if (system_allocator_name) { |
| 174 process_memory_dump->AddSuballocation(malloc_dump->guid(), | 174 process_memory_dump->AddSuballocation(malloc_dump->guid(), |
| 175 system_allocator_name); | 175 system_allocator_name); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // Add an empty row for the heap_spaces. This is to keep the shape of the | 178 // Add an empty row for the heap_spaces. This is to keep the shape of the |
| 179 // dump stable, whether code stats are enabled or not. | 179 // dump stable, whether code stats are enabled or not. |
| 180 auto* heap_spaces_dump = | 180 auto* heap_spaces_dump = |
| 181 process_memory_dump->CreateAllocatorDump(space_name_prefix); | 181 process_memory_dump->CreateAllocatorDump(space_name_prefix); |
| 182 | 182 |
| 183 // Dump statistics related to code and bytecode if requested. |
| 184 DumpCodeStatistics(heap_spaces_dump, isolate_holder_); |
| 185 |
| 183 // Dump object statistics only for detailed dumps. | 186 // Dump object statistics only for detailed dumps. |
| 184 if (args.level_of_detail != | 187 if (args.level_of_detail != |
| 185 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) { | 188 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) { |
| 186 return; | 189 return; |
| 187 } | 190 } |
| 188 | 191 |
| 189 // Dump statistics of the heap's live objects from last GC. | 192 // Dump statistics of the heap's live objects from last GC. |
| 190 // TODO(primiano): these should not be tracked in the same trace event as they | 193 // TODO(primiano): these should not be tracked in the same trace event as they |
| 191 // report stats for the last GC (not the current state). See crbug.com/498779. | 194 // report stats for the last GC (not the current state). See crbug.com/498779. |
| 192 std::string object_name_prefix = dump_base_name + "/heap_objects_at_last_gc"; | 195 std::string object_name_prefix = dump_base_name + "/heap_objects_at_last_gc"; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 223 object_name_prefix + "/CODE_TYPE/CODE_AGE"); | 226 object_name_prefix + "/CODE_TYPE/CODE_AGE"); |
| 224 process_memory_dump->AddOwnershipEdge(code_kind_dump->guid(), | 227 process_memory_dump->AddOwnershipEdge(code_kind_dump->guid(), |
| 225 code_age_dump->guid()); | 228 code_age_dump->guid()); |
| 226 } | 229 } |
| 227 | 230 |
| 228 if (did_dump_object_stats) { | 231 if (did_dump_object_stats) { |
| 229 process_memory_dump->AddOwnershipEdge( | 232 process_memory_dump->AddOwnershipEdge( |
| 230 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), | 233 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), |
| 231 heap_spaces_dump->guid()); | 234 heap_spaces_dump->guid()); |
| 232 } | 235 } |
| 233 | |
| 234 // Dump statistics related to code and bytecode if requested. | |
| 235 DumpCodeStatistics(heap_spaces_dump, isolate_holder_); | |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace gin | 238 } // namespace gin |
| OLD | NEW |