0

Add metric for the actually used memory for global handles

Adds a metric for how much memory is actually used by live global
handles. This CL also fixes emitting of V8.Main.GlobalHandles. It was
using MetricSize::kSmall which added "Small." to the metric name.

Change-Id: I4a85e5b49a18e7b432a343eeff9aa926fc324645
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2659035
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#851102}
This commit is contained in:
Dominik Inführ
2021-02-05 14:15:46 +00:00
committed by Chromium LUCI CQ
parent 5e863e8fa8
commit af9fe22e5d
5 changed files with 27 additions and 4 deletions

@ -309,9 +309,12 @@ const Metric kAllocatorDumpNamesForMetrics[] = {
{"v8/main", "V8.Main.AllocatedObjects", MetricSize::kLarge,
kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_AllocatedObjects},
{"v8/main/global_handles", "V8.Main.GlobalHandles", MetricSize::kSmall,
{"v8/main/global_handles", "V8.Main.GlobalHandles", MetricSize::kLarge,
kEffectiveSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_GlobalHandles},
{"v8/main/global_handles", "V8.Main.GlobalHandles.AllocatedObjects",
MetricSize::kLarge, kAllocatedObjectsSize, EmitTo::kSizeInUkmAndUma,
&Memory_Experimental::SetV8_Main_GlobalHandles_AllocatedObjects},
{"v8/main/heap", "V8.Main.Heap", MetricSize::kLarge, kEffectiveSize,
EmitTo::kSizeInUkmAndUma, &Memory_Experimental::SetV8_Main_Heap},
{"v8/main/heap", "V8.Main.Heap.AllocatedObjects", MetricSize::kLarge,

@ -214,6 +214,10 @@ void PopulateRendererMetrics(GlobalMemoryDumpPtr& global_dump,
SetAllocatorDumpMetric(
pmd, "v8/main/global_handles", "effective_size",
metrics_mb_or_count["V8.Main.GlobalHandles"] * 1024 * 1024);
SetAllocatorDumpMetric(
pmd, "v8/main/global_handles", "allocated_objects_size",
metrics_mb_or_count["V8.Main.GlobalHandles.AllocatedObjects"] * 1024 *
1024);
SetAllocatorDumpMetric(pmd, "v8/main/heap", "effective_size",
metrics_mb_or_count["V8.Main.Heap"] * 1024 * 1024);
@ -357,8 +361,9 @@ MetricMap GetExpectedRendererMetrics() {
{"PartitionAlloc", 140}, {"BlinkGC", 150}, {"V8", 160},
{"V8.AllocatedObjects", 70}, {"V8.Main", 100},
{"V8.Main.AllocatedObjects", 30}, {"V8.Main.Heap", 98},
{"V8.Main.GlobalHandles", 3}, {"V8.Main.Heap.AllocatedObjects", 28},
{"V8.Main.Heap.CodeSpace", 11},
{"V8.Main.GlobalHandles", 3},
{"V8.Main.GlobalHandles.AllocatedObjects", 2},
{"V8.Main.Heap.AllocatedObjects", 28}, {"V8.Main.Heap.CodeSpace", 11},
{"V8.Main.Heap.CodeSpace.AllocatedObjects", 1},
{"V8.Main.Heap.LargeObjectSpace", 12},
{"V8.Main.Heap.LargeObjectSpace.AllocatedObjects", 2},

@ -264,6 +264,14 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics(
base::trace_event::MemoryAllocatorDump::kNameSize,
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
heap_statistics.total_global_handles_size());
global_handles_dump->AddScalar(
"allocated_objects_size",
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
heap_statistics.used_global_handles_size());
if (system_allocator_name) {
process_memory_dump->AddSuballocation(global_handles_dump->guid(),
system_allocator_name);
}
// Dump object statistics only for detailed dumps.
if (args.level_of_detail !=

@ -14760,7 +14760,9 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<suffix name="V8.AllocatedObjects"
label="Only counting objects allocated by V8 javascript engine."/>
<suffix name="V8.Main.GlobalHandles"
label="Memory used by V8 global handles in the main isolate."/>
label="Total memory used by V8 global handles in the main isolate."/>
<suffix name="V8.Main.GlobalHandles.AllocatedObjects"
label="Allocated memory used by V8 global handles in the main isolate."/>
<suffix name="V8.Main.Heap" label="Only counting memory used by V8 heap"/>
<suffix name="V8.Main.Heap.AllocatedObjects"
label="Only counting objects allocated in V8 heap"/>

@ -8959,6 +8959,11 @@ be describing additional metrics about the same event.
Measure of memory consumed by global handles in V8.
</summary>
</metric>
<metric name="V8.Main.GlobalHandles.AllocatedObjects">
<summary>
Measure of memory consumed by used global handles in V8.
</summary>
</metric>
<metric name="V8.Main.Heap">
<summary>
Measure of memory consumed by the main heap of V8.