Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: gin/v8_isolate_memory_dump_provider.cc

Issue 2156043002: Also report peak malloc memory usage from V8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 165 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
166 heap_statistics.malloced_memory()); 166 heap_statistics.malloced_memory());
167 const char* system_allocator_name = 167 const char* system_allocator_name =
168 base::trace_event::MemoryDumpManager::GetInstance() 168 base::trace_event::MemoryDumpManager::GetInstance()
169 ->system_allocator_pool_name(); 169 ->system_allocator_pool_name();
170 if (system_allocator_name) { 170 if (system_allocator_name) {
171 process_memory_dump->AddSuballocation(malloc_dump->guid(), 171 process_memory_dump->AddSuballocation(malloc_dump->guid(),
172 system_allocator_name); 172 system_allocator_name);
173 } 173 }
174 174
175 std::string peak_malloc_name = dump_base_name + "/malloc_peak";
primiano CORP (USE chromium) 2016/07/18 10:58:00 I think the best approach would be reporting this
176 auto* peak_malloc_dump =
177 process_memory_dump->CreateAllocatorDump(peak_malloc_name);
178 peak_malloc_dump->AddScalar(
179 base::trace_event::MemoryAllocatorDump::kNameSize,
180 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
181 heap_statistics.peak_malloced_memory());
182
175 // Add an empty row for the heap_spaces. This is to keep the shape of the 183 // Add an empty row for the heap_spaces. This is to keep the shape of the
176 // dump stable, whether code stats are enabled or not. 184 // dump stable, whether code stats are enabled or not.
177 auto* heap_spaces_dump = 185 auto* heap_spaces_dump =
178 process_memory_dump->CreateAllocatorDump(space_name_prefix); 186 process_memory_dump->CreateAllocatorDump(space_name_prefix);
179 187
180 // Dump object statistics only for detailed dumps. 188 // Dump object statistics only for detailed dumps.
181 if (args.level_of_detail != 189 if (args.level_of_detail !=
182 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) { 190 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) {
183 return; 191 return;
184 } 192 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 process_memory_dump->AddOwnershipEdge( 234 process_memory_dump->AddOwnershipEdge(
227 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(), 235 process_memory_dump->CreateAllocatorDump(object_name_prefix)->guid(),
228 heap_spaces_dump->guid()); 236 heap_spaces_dump->guid());
229 } 237 }
230 238
231 // Dump statistics related to code and bytecode if requested. 239 // Dump statistics related to code and bytecode if requested.
232 DumpCodeStatistics(heap_spaces_dump, isolate_holder_); 240 DumpCodeStatistics(heap_spaces_dump, isolate_holder_);
233 } 241 }
234 242
235 } // namespace gin 243 } // namespace gin
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698