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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 &object_statistics, type_index)) | 110 &object_statistics, type_index)) |
111 continue; | 111 continue; |
112 | 112 |
113 std::string dump_name = | 113 std::string dump_name = |
114 object_name_prefix + "/" + object_statistics.object_type(); | 114 object_name_prefix + "/" + object_statistics.object_type(); |
115 if (object_statistics.object_sub_type()[0] != '\0') | 115 if (object_statistics.object_sub_type()[0] != '\0') |
116 dump_name += std::string("/") + object_statistics.object_sub_type(); | 116 dump_name += std::string("/") + object_statistics.object_sub_type(); |
117 auto object_dump = process_memory_dump->CreateAllocatorDump(dump_name); | 117 auto object_dump = process_memory_dump->CreateAllocatorDump(dump_name); |
118 | 118 |
119 object_dump->AddScalar( | 119 object_dump->AddScalar( |
120 base::trace_event::MemoryAllocatorDump::kNameObjectsCount, | 120 base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
121 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 121 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
122 object_statistics.object_count()); | 122 object_statistics.object_count()); |
123 object_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 123 object_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
124 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 124 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
125 object_statistics.object_size()); | 125 object_statistics.object_size()); |
126 did_dump_object_stats = true; | 126 did_dump_object_stats = true; |
127 } | 127 } |
128 | 128 |
129 if (process_memory_dump->GetAllocatorDump(object_name_prefix + | 129 if (process_memory_dump->GetAllocatorDump(object_name_prefix + |
130 "/CODE_TYPE")) { | 130 "/CODE_TYPE")) { |
131 auto code_kind_dump = process_memory_dump->CreateAllocatorDump( | 131 auto code_kind_dump = process_memory_dump->CreateAllocatorDump( |
132 object_name_prefix + "/CODE_TYPE/CODE_KIND"); | 132 object_name_prefix + "/CODE_TYPE/CODE_KIND"); |
133 auto code_age_dump = process_memory_dump->CreateAllocatorDump( | 133 auto code_age_dump = process_memory_dump->CreateAllocatorDump( |
134 object_name_prefix + "/CODE_TYPE/CODE_AGE"); | 134 object_name_prefix + "/CODE_TYPE/CODE_AGE"); |
135 process_memory_dump->AddOwnershipEdge(code_kind_dump->guid(), | 135 process_memory_dump->AddOwnershipEdge(code_kind_dump->guid(), |
136 code_age_dump->guid()); | 136 code_age_dump->guid()); |
137 } | 137 } |
138 | 138 |
139 if (did_dump_object_stats) { | 139 if (did_dump_object_stats) { |
140 process_memory_dump->AddOwnershipEdge( | 140 process_memory_dump->AddOwnershipEdge( |
141 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), | 141 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), |
142 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); | 142 process_memory_dump->CreateAllocatorDump(space_name_prefix)->guid()); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 } // namespace gin | 146 } // namespace gin |
OLD | NEW |