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 <stddef.h> | 8 #include <stddef.h> |
8 | 9 |
9 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
11 #include "base/trace_event/memory_dump_manager.h" | 12 #include "base/trace_event/memory_dump_manager.h" |
12 #include "base/trace_event/process_memory_dump.h" | 13 #include "base/trace_event/process_memory_dump.h" |
13 #include "gin/public/isolate_holder.h" | 14 #include "gin/public/isolate_holder.h" |
14 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
15 | 16 |
16 namespace gin { | 17 namespace gin { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 "bytecode_and_metadata_size", | 78 "bytecode_and_metadata_size", |
78 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 79 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
79 code_statistics.bytecode_and_metadata_size()); | 80 code_statistics.bytecode_and_metadata_size()); |
80 } | 81 } |
81 | 82 |
82 } // namespace anonymous | 83 } // namespace anonymous |
83 | 84 |
84 void V8IsolateMemoryDumpProvider::DumpHeapStatistics( | 85 void V8IsolateMemoryDumpProvider::DumpHeapStatistics( |
85 const base::trace_event::MemoryDumpArgs& args, | 86 const base::trace_event::MemoryDumpArgs& args, |
86 base::trace_event::ProcessMemoryDump* process_memory_dump) { | 87 base::trace_event::ProcessMemoryDump* process_memory_dump) { |
87 std::string dump_base_name = | 88 std::string dump_base_name = base::StringPrintf( |
88 base::StringPrintf("v8/isolate_%p", isolate_holder_->isolate()); | 89 "v8/isolate_0x%" PRIXPTR, |
| 90 reinterpret_cast<uintptr_t>(isolate_holder_->isolate())); |
89 | 91 |
90 // Dump statistics of the heap's spaces. | 92 // Dump statistics of the heap's spaces. |
91 std::string space_name_prefix = dump_base_name + "/heap_spaces"; | 93 std::string space_name_prefix = dump_base_name + "/heap_spaces"; |
92 v8::HeapStatistics heap_statistics; | 94 v8::HeapStatistics heap_statistics; |
93 isolate_holder_->isolate()->GetHeapStatistics(&heap_statistics); | 95 isolate_holder_->isolate()->GetHeapStatistics(&heap_statistics); |
94 | 96 |
95 size_t known_spaces_used_size = 0; | 97 size_t known_spaces_used_size = 0; |
96 size_t known_spaces_size = 0; | 98 size_t known_spaces_size = 0; |
97 size_t known_spaces_physical_size = 0; | 99 size_t known_spaces_physical_size = 0; |
98 size_t number_of_spaces = isolate_holder_->isolate()->NumberOfHeapSpaces(); | 100 size_t number_of_spaces = isolate_holder_->isolate()->NumberOfHeapSpaces(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 process_memory_dump->AddOwnershipEdge( | 224 process_memory_dump->AddOwnershipEdge( |
223 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), | 225 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), |
224 heap_spaces_dump->guid()); | 226 heap_spaces_dump->guid()); |
225 } | 227 } |
226 | 228 |
227 // Dump statistics related to code and bytecode if requested. | 229 // Dump statistics related to code and bytecode if requested. |
228 DumpCodeStatistics(heap_spaces_dump, isolate_holder_); | 230 DumpCodeStatistics(heap_spaces_dump, isolate_holder_); |
229 } | 231 } |
230 | 232 |
231 } // namespace gin | 233 } // namespace gin |
OLD | NEW |