diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-09-01 11:08:40 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-01 12:16:21 +0000 |
commit | 03c549e0392f92c02536d3f86d5e1d8dfa3435ac (patch) | |
tree | fe49d170a929b34ba82cd10db1a0bd8e3760fa4b /chromium/third_party/catapult/tracing/tracing/metrics | |
parent | 5d013f5804a0d91fcf6c626b2d6fb6eca5c845b0 (diff) | |
download | qtwebengine-chromium-03c549e0392f92c02536d3f86d5e1d8dfa3435ac.tar.gz |
BASELINE: Update Chromium to 91.0.4472.160
Change-Id: I0def1f08a2412aeed79a9ab95dd50eb5c3f65f31
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/metrics')
7 files changed, 192 insertions, 93 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html index 9dd2181dc82..c4bf25e1dfc 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html @@ -9,12 +9,12 @@ found in the LICENSE file. <link rel="import" href="/tracing/metrics/android_systrace_metric.html"> <link rel="import" href="/tracing/metrics/blink/gc_metric.html"> <link rel="import" href="/tracing/metrics/blink/leak_detection_metric.html"> +<link rel="import" href="/tracing/metrics/blink/resource_metric.html"> <link rel="import" href="/tracing/metrics/console_error_metric.html"> <link rel="import" href="/tracing/metrics/count_sum_metric.html"> <link rel="import" href="/tracing/metrics/cpu_process_metric.html"> <link rel="import" href="/tracing/metrics/custom_metric.html"> <link rel="import" href="/tracing/metrics/media_metric.html"> -<link rel="import" href="/tracing/metrics/memory_ablation_metric.html"> <link rel="import" href="/tracing/metrics/partition_alloc/pcscan_metric.html"> <link rel="import" href="/tracing/metrics/rendering/rendering_metric.html"> <link rel="import" href="/tracing/metrics/reported_by_page_metric.html"> diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/blink/resource_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/blink/resource_metric.html new file mode 100644 index 00000000000..c44eda0235e --- /dev/null +++ b/chromium/third_party/catapult/tracing/tracing/metrics/blink/resource_metric.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- +Copyright 2021 The Chromium Authors. All rights reserved. +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<link rel="import" href="/tracing/extras/chrome/event_finder_utils.html"> +<link rel="import" href="/tracing/metrics/metric_registry.html"> + +<script> +'use strict'; + +/** + * This metric is used for for blink network metrics + * - blinkRequestResourceCount: the count of requested resources + */ +tr.exportTo('tr.metrics', function() { + function blinkResourceMetric(histograms, model, opt_options) { + const chromeHelper = model.getOrCreateHelper( + tr.model.helpers.ChromeModelHelper); + if (!chromeHelper) { + // Chrome isn't present. + return; + } + const CATEGORY = 'blink'; + const NAME = 'ResourceFetcher::requestResource'; + let count = 0; + // Collect trace events. + for (const helper of Object.values(chromeHelper.rendererHelpers)) { + if (helper.isChromeTracingUI) continue; + const events = tr.e.chrome.EventFinderUtils.getMainThreadEvents( + helper, NAME, CATEGORY); + for (const event of events) { + count++; + } + } + // Generate histograms. + histograms.createHistogram( + 'blinkRequestResourceCount', tr.b.Unit.byName.count, count); + } + + tr.metrics.MetricRegistry.register(blinkResourceMetric, { + supportsRangeOfInterest: false, + }); + + return { + blinkResourceMetric, + }; +}); +</script> diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/blink/resource_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/blink/resource_metric_test.html new file mode 100644 index 00000000000..9081918bee1 --- /dev/null +++ b/chromium/third_party/catapult/tracing/tracing/metrics/blink/resource_metric_test.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<!-- +Copyright 2021 The Chromium Authors. All rights reserved. +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<link rel="import" href="/tracing/core/test_utils.html"> +<link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html"> +<link rel="import" href="/tracing/metrics/blink/resource_metric.html"> +<link rel="import" href="/tracing/value/histogram_set.html"> + +<script> +'use strict'; + +tr.b.unittest.testSuite(function() { + test('blinkRequestResourceCount_general', function() { + const model = tr.e.chrome.ChromeTestUtils.newChromeModel(function(model) { + const rendererProcess = model.rendererProcess; + const mainThread = model.rendererMain; + const mainFrame = { id: '0xdeadbeef', is_main: true }; + const emitEvent = (time, cat, title, url, duration) => { + mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ + cat, + title, + start: time, + duration, + args: {url}, + })); + }; + emitEvent(1000, 'blink', 'ResourceFetcher::requestResource', 'A.js', 0.1); + emitEvent(2001, 'blink', 'ignore', 'A.js', 0.1); + emitEvent(2002, 'ignore', 'ignore', 'A.js', 0.1); + emitEvent(3200, 'blink', 'ResourceFetcher::requestResource', 'b.js', 0.1); + emitEvent(4201, 'ignore', 'ResourceFetcher::requestResource', 'b.js', 0.1); + }); + + const histograms = new tr.v.HistogramSet(); + tr.metrics.blinkResourceMetric(histograms, model); + const histogram = histograms.getHistogramNamed('blinkRequestResourceCount'); + assert.strictEqual(histogram.sampleValues.length, 1); + assert.strictEqual(histogram.running.count, 1); + assert.strictEqual(histogram.running.mean, 2); + }); +}); diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/memory_ablation_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/memory_ablation_metric.html deleted file mode 100644 index 62ca340c637..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/metrics/memory_ablation_metric.html +++ /dev/null @@ -1,65 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright 2020 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> - -<link rel="import" href="/tracing/base/base.html"> -<link rel="import" href="/tracing/base/unit.html"> -<link rel="import" href="/tracing/metrics/metric_registry.html"> -<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html"> -<link rel="import" href="/tracing/value/histogram.html"> - -<script> -'use strict'; - -tr.exportTo('tr.metrics', function() { - /** - * Parses the trace to find PeakMemoryUsage related traces, building out - * histograms which track the time spent performing the actual memory - * ablation. - * - * These traces are reported under the category "gpu.memory". - * - * @param {HitogramSet} histograms - set of histograms to add results to. - * @param {tr.Model} model - model encompassing all trace events. - */ - function memoryAblationMetric(histograms, model) { - const modelHelper = model.getOrCreateHelper( - tr.model.helpers.ChromeModelHelper); - if (!modelHelper.gpuHelper) return; - const gpuProcess = modelHelper.gpuHelper.process; - const events = [...gpuProcess.findTopmostSlicesNamed( - 'Memory.GPU.PeakMemoryUsage.AblationTimes')]; - const allocHistogram = histograms.createHistogram('Ablation Alloc', - tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, [], { - binBoundaries: - tr.v.HistogramBinBoundaries.createLinear(0, 10000, 20), - description: 'The amount of time spent allocating the ablation ' + - 'memory', - summaryOptions: tr.metrics.rendering.SUMMARY_OPTIONS, - }); - const deallocHistogram = histograms.createHistogram('Ablation Dealloc', - tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, [], { - binBoundaries: - tr.v.HistogramBinBoundaries.createLinear(0, 10000, 20), - description: 'The amount of time spent deallocating the ablation ' + - 'memory', - summaryOptions: tr.metrics.rendering.SUMMARY_OPTIONS, - }); - for (let i = 0; i < events.length; i++) { - allocHistogram.addSample(events[i].args.alloc); - deallocHistogram.addSample(events[i].args.dealloc); - } - } - - tr.metrics.MetricRegistry.register(memoryAblationMetric, { - requiredCategories: ['gpu.memory'], - }); - - return { - memoryAblationMetric, - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric.html index 9e3a28a507f..99e938cf3d6 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric.html @@ -21,18 +21,18 @@ found in the LICENSE file. * are no pointers in memory which point to explicitly freed objects before * actually releasing their memory. * - * pa:pcscan:<process_name> + * pa:pcscan:<process_name>:<scanner|mutator> * ======================== * The overall time spent on scanning the partition alloc heap for a specific - * process (can be either 'browser_process' or 'renderer_processes'). + * process either in the scanner or mutator thread (process_name can be either 'browser_process' or 'renderer_processes'). * - * pa:pcscan:<process_name>:<phase> + * pa:pcscan:<process_name>:<scanner|mutator>:<phase> * ======================== * Time spent on a certain PCScan phase ('clear', 'scan' or 'sweep'). */ tr.exportTo('tr.metrics.pa', function() { function pcscanMetric(histograms, model) { - function createNumericForProcess(name, processName, desc) { + function createNumericForProcess(name, processName, context, desc) { function createNumericForEventTime(name, desc) { const n = new tr.v.Histogram(name, tr.b.Unit.byName.timeDurationInMs_smallerIsBetter); @@ -46,21 +46,27 @@ tr.exportTo('tr.metrics.pa', function() { sum: true}); return n; } - const scheme = ['pa', 'pcscan', processName]; + const scheme = ['pa', 'pcscan', processName, context]; if (name) scheme.push(name); return createNumericForEventTime(scheme.join(':'), desc); } function createHistsForProcess(processName) { return { - scan: createNumericForProcess('scan', processName, - 'Time for scanning heap for quarantine pointers'), - sweep: createNumericForProcess('sweep', processName, + scanner_scan: createNumericForProcess('scan', processName, 'scanner', + 'Time for scanning heap for quarantine pointers on concurrent threads'), + scanner_sweep: createNumericForProcess('sweep', processName, 'scanner', 'Time for sweeping quarantine'), - clear: createNumericForProcess('clear', processName, + scanner_clear: createNumericForProcess('clear', processName, 'scanner', 'Time for clearing quarantine entries'), - total: createNumericForProcess('', processName, - 'Total time for PCScan execution') + scanner_total: createNumericForProcess('', processName, 'scanner', + 'Total time for PCScan execution on concurrent threads'), + mutator_scan: createNumericForProcess('scan', processName, 'mutator', + 'Time for scanning heap for quarantine pointers on mutator threads'), + mutator_clear: createNumericForProcess('clear', processName, 'mutator', + 'Time for clearing heap quarantine entries on mutator threads'), + mutator_total: createNumericForProcess('', processName, 'mutator', + 'Total time for PCScan execution on mutator threads (inside safepoints)'), }; } @@ -68,14 +74,20 @@ tr.exportTo('tr.metrics.pa', function() { if (!(slice instanceof tr.model.ThreadSlice)) return; if (slice.category !== 'partition_alloc') return; - if (slice.title === 'PCScan.Scan') { - hists.scan.addSample(slice.duration); - } else if (slice.title === 'PCScan.Sweep') { - hists.sweep.addSample(slice.duration); - } else if (slice.title === 'PCScan.Clear') { - hists.clear.addSample(slice.duration); - } else if (slice.title === 'PCScan') { - hists.total.addSample(slice.duration); + if (slice.title === 'PCScan.Scanner.Scan') { + hists.scanner_scan.addSample(slice.duration); + } else if (slice.title === 'PCScan.Scanner.Sweep') { + hists.scanner_sweep.addSample(slice.duration); + } else if (slice.title === 'PCScan.Scanner.Clear') { + hists.scanner_clear.addSample(slice.duration); + } else if (slice.title === 'PCScan.Scanner') { + hists.scanner_total.addSample(slice.duration); + } else if (slice.title === 'PCScan.Mutator.Scan') { + hists.mutator_scan.addSample(slice.duration); + } else if (slice.title === 'PCScan.Mutator.Clear') { + hists.mutator_clear.addSample(slice.duration); + } else if (slice.title === 'PCScan.Mutator') { + hists.mutator_total.addSample(slice.duration); } } diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric_test.html index a88d343b5c2..088c14780f3 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric_test.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/partition_alloc/pcscan_metric_test.html @@ -25,7 +25,7 @@ tr.b.unittest.testSuite(function() { const thread = process.getOrCreateThread(2); thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ cat: 'partition_alloc', - title: 'PCScan', + title: 'PCScan.Scanner', start: 200, duration: 100, cpuStart: 200, @@ -33,7 +33,15 @@ tr.b.unittest.testSuite(function() { })); thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ cat: 'partition_alloc', - title: 'PCScan.Clear', + title: 'PCScan.Mutator', + start: 200, + duration: 50, + cpuStart: 200, + cpuDuration: 50 + })); + thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ + cat: 'partition_alloc', + title: 'PCScan.Scanner.Clear', start: 200, duration: 16, cpuStart: 200, @@ -41,7 +49,7 @@ tr.b.unittest.testSuite(function() { })); thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ cat: 'partition_alloc', - title: 'PCScan.Scan', + title: 'PCScan.Scanner.Scan', start: 216, duration: 32, cpuStart: 216, @@ -49,7 +57,23 @@ tr.b.unittest.testSuite(function() { })); thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ cat: 'partition_alloc', - title: 'PCScan.Sweep', + title: 'PCScan.Mutator.Clear', + start: 210, + duration: 8, + cpuStart: 210, + cpuDuration: 8 + })); + thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ + cat: 'partition_alloc', + title: 'PCScan.Mutator.Scan', + start: 232, + duration: 16, + cpuStart: 232, + cpuDuration: 16 + })); + thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ + cat: 'partition_alloc', + title: 'PCScan.Scanner.Sweep', start: 248, duration: 42, cpuStart: 248, @@ -62,13 +86,19 @@ tr.b.unittest.testSuite(function() { const histograms = new tr.v.HistogramSet(); tr.metrics.pa.pcscanMetric(histograms, makeTestModelFor(processName)); assert.closeTo(100, histograms.getHistogramNamed( - 'pa:pcscan:' + processName).average, 1e-2); + 'pa:pcscan:' + processName + ':scanner').average, 1e-2); + assert.closeTo(50, histograms.getHistogramNamed( + 'pa:pcscan:' + processName + ':mutator').average, 1e-2); assert.closeTo(16, histograms.getHistogramNamed( - 'pa:pcscan:' + processName + ':clear').average, 1e-2); + 'pa:pcscan:' + processName + ':scanner:clear').average, 1e-2); assert.closeTo(32, histograms.getHistogramNamed( - 'pa:pcscan:' + processName + ':scan').average, 1e-2); + 'pa:pcscan:' + processName + ':scanner:scan').average, 1e-2); + assert.closeTo(8, histograms.getHistogramNamed( + 'pa:pcscan:' + processName + ':mutator:clear').average, 1e-2); + assert.closeTo(16, histograms.getHistogramNamed( + 'pa:pcscan:' + processName + ':mutator:scan').average, 1e-2); assert.closeTo(42, histograms.getHistogramNamed( - 'pa:pcscan:' + processName + ':sweep').average, 1e-2); + 'pa:pcscan:' + processName + ':scanner:sweep').average, 1e-2); } test('pcscanMetricForBrowser', function() { diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/uma_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/uma_metric.html index ad2c814e628..959006e9749 100644 --- a/chromium/third_party/catapult/tracing/tracing/metrics/uma_metric.html +++ b/chromium/third_party/catapult/tracing/tracing/metrics/uma_metric.html @@ -148,6 +148,32 @@ tr.exportTo('tr.metrics', function() { sumOfMiddles += bin.count * (bin.min + bin.max) / 2; sumOfBinLengths += bin.count * (bin.max - bin.min); } + + if (name.startsWith('CompositorLatency.Type')) { + let histogramBoundaries = tr.v.HistogramBinBoundaries.createLinear(0, 100, 101); + let histogramUnit = getHistogramUnit_(name); + let presentedCount = values.bins[0] ? values.bins[0].count : 0; + let delayedCount = values.bins[1] ? values.bins[1].count : 0; + let droppedCount = values.bins[2] ? values.bins[2].count : 0; + let inTimeCount = presentedCount - delayedCount; + let totalCount = presentedCount + droppedCount; + + const inTimeHistogram = new tr.v.Histogram( + name+'.Percentage_of_in_time_frames', histogramUnit, histogramBoundaries); + inTimeHistogram.addSample(100.0 * inTimeCount / totalCount); + histograms.addHistogram(inTimeHistogram); + + const delayedHistogram = new tr.v.Histogram( + name+'.Percentage_of_delayed_frames', histogramUnit, histogramBoundaries); + delayedHistogram.addSample(100.0 * delayedCount / totalCount); + histograms.addHistogram(delayedHistogram); + + const droppedHistogram = new tr.v.Histogram( + name+'.Percentage_of_dropped_frames', histogramUnit, histogramBoundaries); + droppedHistogram.addSample(100.0 * droppedCount / totalCount); + histograms.addHistogram(droppedHistogram); + } + const shift = (values.sum - sumOfMiddles) / sumOfBinLengths; // Note: for linear bins, if shift is less than -0.5, it means that even // if we put all samples at the lowest value of their bins their sum will |