summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/tracing/tracing/metrics
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/metrics')
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/__init__.py15
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html21
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/discover.py34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html58
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html37
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html38
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html59
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html78
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html56
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html423
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html235
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html145
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html88
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html107
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html1023
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html2473
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html158
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html33
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html43
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html189
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html172
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html219
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html299
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html252
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html256
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html145
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html29
38 files changed, 0 insertions, 7296 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/__init__.py b/chromium/third_party/catapult/tracing/tracing/metrics/__init__.py
deleted file mode 100644
index cffcee63c42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/__init__.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2016 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.
-
-import os
-import sys
-
-
-_CATAPULT_DIR = os.path.abspath(os.path.join(
- os.path.dirname(os.path.abspath(__file__)), '..', '..', '..'))
-
-_PI_PATH = os.path.join(_CATAPULT_DIR, 'perf_insights')
-
-if _PI_PATH not in sys.path:
- sys.path.insert(1, _PI_PATH)
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html
deleted file mode 100644
index 16a0591b9f4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/sample_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/clock_sync_latency_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/efficiency_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/first_paint_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/hazard_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/memory_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/power_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/responsiveness_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/system_health_metrics.html">
-<link rel="import" href="/tracing/metrics/system_health/webview_startup_metric.html">
-<link rel="import" href="/tracing/metrics/tracing_metric.html">
-<link rel="import" href="/tracing/metrics/v8/execution_metric.html">
-<link rel="import" href="/tracing/metrics/v8/gc_metric.html">
-<link rel="import" href="/tracing/metrics/v8/v8_metrics.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/discover.py b/chromium/third_party/catapult/tracing/tracing/metrics/discover.py
deleted file mode 100644
index ef532c6d0df..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/discover.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2016 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.
-
-import json
-import os
-
-import tracing_project
-import vinn
-
-
-_DISCOVER_CMD_LINE = os.path.join(
- os.path.dirname(__file__), 'discover_cmdline.html')
-
-
-def DiscoverMetrics(modules_to_load):
- """ Returns a list of registered metrics.
-
- Args:
- modules_to_load: a list of modules (string) to be loaded before discovering
- the registered metrics.
- """
- assert isinstance(modules_to_load, list)
- project = tracing_project.TracingProject()
- all_source_paths = list(project.source_paths)
-
- res = vinn.RunFile(
- _DISCOVER_CMD_LINE, source_paths=all_source_paths,
- js_args=modules_to_load)
-
- if res.returncode != 0:
- raise RuntimeError('Error running metrics_discover_cmdline: ' + res.stdout)
- else:
- return [str(m) for m in json.loads(res.stdout)]
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html b/chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html
deleted file mode 100644
index 8cf7f307aee..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/metric_registry.html">
-
-<script>
-'use strict';
-
-function discoverMetrics(args) {
- for (var i = 0; i < args.length; i++) {
- var filename = args[i];
- HTMLImportsLoader.loadHTML(filename);
- }
-
- var metrics = tr.metrics.MetricRegistry.getAllRegisteredTypeInfos();
- var discovered_metric_names = [];
- for (var i = 0; i < metrics.length; i++) {
- discovered_metric_names.push(metrics[i].constructor.name);
- }
- console.log(JSON.stringify(discovered_metric_names));
- return 0;
-}
-
-if (tr.isHeadless)
- quit(discoverMetrics(sys.argv.slice(1)));
-
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py b/chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py
deleted file mode 100644
index f81417df2c8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2016 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.
-
-import unittest
-
-from tracing.metrics import discover
-
-class MetricsDiscoverUnittest(unittest.TestCase):
- def testMetricsDiscoverEmpty(self):
- self.assertFalse(discover.DiscoverMetrics([]))
-
- def testMetricsDiscoverNonEmpty(self):
- self.assertEquals(
- ['sampleMetric'],
- discover.DiscoverMetrics(
- ['/tracing/metrics/sample_metric.html']))
-
- def testMetricsDiscoverMultipleMetrics(self):
- self.assertGreater(
- len(discover.DiscoverMetrics(
- ['/tracing/metrics/all_metrics.html'])), 1)
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html
deleted file mode 100644
index bbfa316d771..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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="/perf_insights/mre/function_handle.html">
-<link rel="import" href="/tracing/metrics/all_metrics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
- /**
- * @param {!pi.mre.MreResult} result
- * @param {!tr.model.Model} model
- * @param {!Object} options
- */
- function metricMapFunction(result, model, options) {
- if (options === undefined)
- throw new Error('Expected an options dict.');
-
- var metricName = options.metric;
- if (metricName === undefined)
- throw new Error('A metric name should be specified.');
-
- var values = new tr.v.ValueSet();
-
- var metric = tr.metrics.MetricRegistry.findTypeInfoWithName(metricName);
- if (metric === undefined)
- throw new Error('"' + metricName + '" is not a registered metric.');
- metric.constructor(values, model);
-
- for (var metadata of model.metadata) {
- if (!metadata.value || !metadata.value['iteration-info'])
- continue;
- var iteration = new tr.v.d.IterationInfo(
- metadata.value['iteration-info']);
- // Values can be separated from their ValueSet and mixed into ValueSets
- // with Values from other iterations, so add IterationInfo to each Value.
- values.map(function(value) {
- value.diagnostics.add(tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, iteration);
- });
- }
-
- result.addPair('values', values.valueDicts);
- }
-
- pi.FunctionRegistry.register(metricMapFunction);
-
- return {
- metricMapFunction: metricMapFunction
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html
deleted file mode 100644
index f66ed23949c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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="/perf_insights/mre/mre_result.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/metric_map_function.html">
-<link rel="import" href="/tracing/metrics/sample_metric.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var test_utils = tr.c.TestUtils;
- var ThreadSlice = tr.model.ThreadSlice;
-
- test('metricMapTest', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
- var m = test_utils.newModelWithEvents(JSON.stringify(events), {
- shiftWorldToZero: false,
- pruneEmptyContainers: false,
- trackDetailedModelStats: true,
- customizeModelCallback: function(m) {
- var p1 = m.getOrCreateProcess(1);
- var t2 = p1.getOrCreateThread(2);
- var t2_s1 = t2.sliceGroup.pushSlice(test_utils.newSliceEx({
- type: ThreadSlice,
- name: 'some_slice',
- start: 0, end: 10
- }));
- var t2_s2 = t2.sliceGroup.pushSlice(test_utils.newSliceEx({
- type: ThreadSlice,
- name: 'some_slice',
- start: 20, end: 30
- }));
- }
- });
-
- assert.throw(function() {
- var result = new pi.mre.MreResult();
- tr.metrics.metricMapFunction(result, m, {});
- }, Error, 'A metric name should be specified.');
-
- assert.throw(function() {
- var result = new pi.mre.MreResult();
- tr.metrics.metricMapFunction(result, m, {'metric': 'wrongMetric'});
- }, Error, '"wrongMetric" is not a registered metric.');
-
- var result = new pi.mre.MreResult();
- tr.metrics.metricMapFunction(result, m, {'metric': 'sampleMetric'});
- assert.property(result.pairs, 'values');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html
deleted file mode 100644
index d0f52ef71fc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/extension_registry.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
-
- function MetricRegistry() {}
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.defaultMetadata = {};
- tr.b.decorateExtensionRegistry(MetricRegistry, options);
-
- MetricRegistry.addEventListener('will-register', function(e) {
- var metric = e.typeInfo.constructor;
- if (!(metric instanceof Function))
- throw new Error('Metrics must be functions');
-
- if (metric.length < 2) {
- throw new Error('Metrics take a ValueSet and a Model and ' +
- 'optionally an options dictionary');
- }
- });
-
- return {
- MetricRegistry: MetricRegistry
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html
deleted file mode 100644
index 21a3584a3ab..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var test_utils = tr.c.TestUtils;
- var ThreadSlice = tr.model.ThreadSlice;
-
- test('FindMetricByName', function() {
- function sampleMetricA(values, model) {
- var unit = tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var n1 = new tr.v.ScalarNumeric(unit, 1);
- values.addValue(new tr.v.NumericValue('foo', n1));
- }
- tr.metrics.MetricRegistry.register(sampleMetricA);
-
- function sampleMetricB(values, model) {
- var unit = tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var n1 = new tr.v.ScalarNumeric(unit, 1);
- var n2 = new tr.v.ScalarNumeric(unit, 2);
- values.addValue(new tr.v.NumericValue('foo', n1));
- values.addValue(new tr.v.NumericValue('bar', n2));
- }
- tr.metrics.MetricRegistry.register(sampleMetricB);
-
- function sampleMetricC(values, model) {
- var unit = tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var n1 = new tr.v.ScalarNumeric(unit, 1);
- var n2 = new tr.v.ScalarNumeric(unit, 2);
- var n3 = new tr.v.ScalarNumeric(unit, 3);
- values.addValue(new tr.v.NumericValue('foo', n1));
- values.addValue(new tr.v.NumericValue('bar', n2));
- values.addValue(new tr.v.NumericValue('baz', n3));
- }
- tr.metrics.MetricRegistry.register(sampleMetricC);
-
- assert.isTrue(tr.metrics.MetricRegistry.findTypeInfoWithName('sampleMetricB').constructor === sampleMetricB); // @suppress longLineCheck
- });
-
- test('registerNonFunctionThrows', function() {
- assert.throws(function() {
- tr.metrics.MetricRegistry.register('not a function');
- });
-
- assert.throws(function() {
- tr.metrics.MetricRegistry.register(function() {});
- });
-
- assert.throws(function() {
- tr.metrics.MetricRegistry.register(function(a) {});
- });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py b/chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py
deleted file mode 100644
index 62ac454ed42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2016 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.
-import os
-
-from perf_insights.mre import function_handle
-from perf_insights.mre import map_runner
-from perf_insights.mre import progress_reporter
-from perf_insights.mre import file_handle
-from perf_insights.mre import job as job_module
-
-_METRIC_MAP_FUNCTION_FILENAME = 'metric_map_function.html'
-
-_METRIC_MAP_FUNCTION_NAME = 'metricMapFunction'
-
-def _GetMetricsDir():
- return os.path.dirname(os.path.abspath(__file__))
-
-def _GetMetricRunnerHandle(metric):
- assert isinstance(metric, basestring)
- metrics_dir = _GetMetricsDir()
- metric_mapper_path = os.path.join(metrics_dir, _METRIC_MAP_FUNCTION_FILENAME)
-
- modules_to_load = [function_handle.ModuleToLoad(filename=metric_mapper_path)]
- options = {'metric': metric}
- map_function_handle = function_handle.FunctionHandle(
- modules_to_load, _METRIC_MAP_FUNCTION_NAME, options)
-
- return job_module.Job(map_function_handle, None)
-
-def RunMetric(filename, metric, extra_import_options=None):
- result = RunMetricOnTraces([filename], metric, extra_import_options)
- return result[filename]
-
-def RunMetricOnTraces(filenames, metric,
- extra_import_options=None):
- trace_handles = [
- file_handle.URLFileHandle(f, 'file://%s' % f) for f in filenames]
- job = _GetMetricRunnerHandle(metric)
- runner = map_runner.MapRunner(
- trace_handles, job,
- extra_import_options=extra_import_options,
- progress_reporter=progress_reporter.ProgressReporter())
- map_results = runner.RunMapper()
- return map_results
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html
deleted file mode 100644
index 43ae5dae567..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
-
- var SIZE_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- sizeInBytes_smallerIsBetter, tr.b.Range.fromExplicitRange(1, 100), 100);
-
- function sampleMetric(values, model) {
- var n1 = new tr.v.ScalarNumeric(sizeInBytes_smallerIsBetter, 1);
- var n2 = new tr.v.ScalarNumeric(sizeInBytes_smallerIsBetter, 2);
- var n3 = SIZE_NUMERIC_BUILDER.build();
- n3.add(1);
- values.addValue(new tr.v.NumericValue('foo', n1));
- values.addValue(new tr.v.NumericValue('bar', n2));
- values.addValue(new tr.v.NumericValue('baz', n3));
- }
-
- tr.metrics.MetricRegistry.register(sampleMetric);
-
- return {
- sampleMetric: sampleMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html
deleted file mode 100644
index c30d0790d8c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
-
- function syncIsComplete(markers) {
- return markers.length === 2;
- }
-
- function syncInvolvesTelemetry(markers) {
- for (var marker of markers)
- if (marker.domainId === tr.model.ClockDomainId.TELEMETRY)
- return true;
-
- return false;
- }
-
- function clockSyncLatencyMetric(values, model) {
- for (var markers of model.clockSyncManager.markersBySyncId.values()) {
- var latency = undefined;
- var targetDomain = undefined;
- if (!syncIsComplete(markers) || !syncInvolvesTelemetry(markers))
- continue;
- for (var marker of markers) {
- var domain = marker.domainId;
- if (domain === tr.model.ClockDomainId.TELEMETRY)
- latency = (marker.endTs - marker.startTs);
- else
- targetDomain = domain;
- }
- values.addValue(new tr.v.NumericValue(
- 'clock_sync_latency_' + targetDomain,
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- latency),
- { description: 'Clock sync latency for domain ' + targetDomain }));
- }
- };
-
- tr.metrics.MetricRegistry.register(clockSyncLatencyMetric);
-
- return {
- clockSyncLatencyMetric: clockSyncLatencyMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html
deleted file mode 100644
index fe6a37d4819..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/system_health/clock_sync_latency_metric.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('clockSyncLatencyMetric', function() {
- var model = new tr.Model();
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.TELEMETRY, 'ID01', 1.0, 4.0);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.TELEMETRY, 'ID02', 2.0, 8.0);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.BATTOR, 'ID01', 2.5);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.WIN_QPC, 'ID02', 5.0);
-
- var battorName = 'clock_sync_latency_' + tr.model.ClockDomainId.BATTOR;
- var winQpcName = 'clock_sync_latency_' + tr.model.ClockDomainId.WIN_QPC;
-
- var valueSet = new tr.v.ValueSet();
- tr.metrics.sh.clockSyncLatencyMetric(valueSet, model);
-
- var battorEntry = tr.b.getOnlyElement(
- valueSet.valueDicts.filter(
- (dict) => dict.name === battorName));
-
- var winQpcEntry = tr.b.getOnlyElement(
- valueSet.valueDicts.filter(
- (dict) => dict.name === winQpcName));
-
- assert.equal(battorEntry.numeric.value, 3.0);
- assert.equal(winQpcEntry.numeric.value, 6.0);
- });
-
- test('clockSyncLatencyMetric_noTelemetry', function() {
- var model = new tr.Model();
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.TELEMETRY, 'ID01', 1.0, 4.0);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.BATTOR, 'ID02', 2.5);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.WIN_QPC, 'ID02', 5.0);
-
- var valueSet = new tr.v.ValueSet();
- tr.metrics.sh.clockSyncLatencyMetric(valueSet, model);
-
- assert.lengthOf(valueSet.valueDicts, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html
deleted file mode 100644
index 6274def9412..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/user_model/animation_expectation.html">
-<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var UNIT = tr.v.Unit.byName.normalizedPercentage_biggerIsBetter;
-
- var DESCRIPTION = 'Normalized CPU budget consumption';
-
- function efficiencyMetric(values, model) {
- var scores = [];
-
- model.userModel.expectations.forEach(function(ue) {
- var options = {};
- options.description = DESCRIPTION;
-
- var score = undefined;
-
- if ((ue.totalCpuMs === undefined) ||
- (ue.totalCpuMs == 0))
- return;
-
- var cpuFractionBudget = tr.b.Range.fromExplicitRange(0.5, 1.5);
-
- if (ue instanceof tr.model.um.IdleExpectation) {
- cpuFractionBudget = tr.b.Range.fromExplicitRange(0.1, 1);
- } else if (ue instanceof tr.model.um.AnimationExpectation) {
- cpuFractionBudget = tr.b.Range.fromExplicitRange(1, 2);
- }
-
- var cpuMsBudget = tr.b.Range.fromExplicitRange(
- ue.duration * cpuFractionBudget.min,
- ue.duration * cpuFractionBudget.max);
- var normalizedCpu = tr.b.normalize(
- ue.totalCpuMs, cpuMsBudget.min, cpuMsBudget.max);
- score = 1 - tr.b.clamp(normalizedCpu, 0, 1);
-
- scores.push(score);
-
- values.addValue(new tr.v.NumericValue(
- 'efficiency', new tr.v.ScalarNumeric(UNIT, score), options));
- });
-
- // Manually reduce scores.
- // https://github.com/catapult-project/catapult/issues/2036
-
- var options = {};
- options.description = DESCRIPTION;
- var overallScore = tr.b.Statistics.weightedMean(
- scores, tr.metrics.sh.perceptualBlend);
- if (overallScore === undefined)
- return;
-
- values.addValue(new tr.v.NumericValue(
- 'efficiency', new tr.v.ScalarNumeric(UNIT, overallScore), options));
- }
-
- tr.metrics.MetricRegistry.register(efficiencyMetric);
-
- return {
- efficiencyMetric: efficiencyMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html
deleted file mode 100644
index 5fe0f1a4561..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import"
- href="/tracing/metrics/system_health/efficiency_metric.html">
-<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createModel() {
- return tr.c.TestUtils.newModel(function(model) {
- model.p1 = model.getOrCreateProcess(1);
- model.t2 = model.p1.getOrCreateThread(2);
-
- var slice = tr.c.TestUtils.newSliceEx({
- title: 'foo',
- start: 0,
- end: 100,
- type: tr.model.ThreadSlice
- });
- slice.isTopLevel = true;
-
- var idle = new tr.model.um.IdleExpectation(model, 0, 100);
- idle.associatedEvents.push(slice);
- model.userModel.expectations.push(idle);
- });
- }
-
- test('optimalEfficiency', function() {
- var model = createModel();
- var exp = model.userModel.expectations[0];
- tr.b.getOnlyElement(exp.associatedEvents).cpuSelfTime = 10;
- var values = new tr.v.ValueSet();
- tr.metrics.sh.efficiencyMetric(values, model);
- assert.equal(1, values.valueDicts[0].numeric.value);
- });
-
- test('pessimalEfficiency', function() {
- var model = createModel();
- var exp = model.userModel.expectations[0];
- tr.b.getOnlyElement(exp.associatedEvents).cpuSelfTime = 100;
- var values = new tr.v.ValueSet();
- tr.metrics.sh.efficiencyMetric(values, model);
- assert.equal(0, values.valueDicts[0].numeric.value);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html
deleted file mode 100644
index bc1aa3828ca..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html
+++ /dev/null
@@ -1,423 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var timeDurationInMs_smallerIsBetter =
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter;
-
- function findTargetRendererHelper(chromeHelper) {
- var largestPid = -1;
- for (var pid in chromeHelper.rendererHelpers) {
- var rendererHelper = chromeHelper.rendererHelpers[pid];
- if (rendererHelper.isChromeTracingUI)
- continue;
- if (pid > largestPid)
- largestPid = pid;
- }
-
- if (largestPid === -1)
- return undefined;
-
- return chromeHelper.rendererHelpers[largestPid];
- }
-
- /**
- * A utility class for finding navigationStart event for given frame and
- * timestamp.
- * @constructor
- */
- function NavigationStartFinder(rendererHelper) {
- this.navigationStartsForFrameId_ = {};
- for (var ev of rendererHelper.mainThread.sliceGroup.childEvents()) {
- if (ev.category !== 'blink.user_timing' ||
- ev.title !== 'navigationStart')
- continue;
- var frameIdRef = ev.args['frame'];
- var list = this.navigationStartsForFrameId_[frameIdRef];
- if (list === undefined)
- this.navigationStartsForFrameId_[frameIdRef] = list = [];
- list.unshift(ev);
- }
- }
-
- NavigationStartFinder.prototype = {
- findNavigationStartEventForFrameBeforeTimestamp: function(frameIdRef, ts) {
- var list = this.navigationStartsForFrameId_[frameIdRef];
- if (list === undefined) {
- console.warn('No navigationStartEvent found for frame id "' +
- frameIdRef + '"');
- return undefined;
- }
- var eventBeforeTimestamp;
- for (var ev of list) {
- if (ev.start > ts)
- continue;
- if (eventBeforeTimestamp === undefined)
- eventBeforeTimestamp = ev;
- }
- if (eventBeforeTimestamp === undefined) {
- console.warn('Failed to find navigationStartEvent.');
- return undefined;
- }
- return eventBeforeTimestamp;
- }
- };
-
- /**
- * A utility class for finding Paint event for given frame and timestamp.
- * @constructor
- */
- function PaintFinder(rendererHelper) {
- this.paintsForFrameId_ = {};
- for (var ev of rendererHelper.mainThread.sliceGroup.childEvents()) {
- if (ev.category !== 'devtools.timeline' || ev.title !== 'Paint')
- continue;
- var frameIdRef = ev.args['data']['frame'];
- var list = this.paintsForFrameId_[frameIdRef];
- if (list === undefined)
- this.paintsForFrameId_[frameIdRef] = list = [];
- list.push(ev);
- }
- }
-
- PaintFinder.prototype = {
- findPaintEventForFrameAfterTimestamp: function(frameIdRef, ts) {
- var list = this.paintsForFrameId_[frameIdRef];
- if (list === undefined)
- return undefined;
-
- var eventAfterTimestamp;
- for (var ev of list) {
- if (ev.start < ts)
- continue;
- if (eventAfterTimestamp === undefined)
- eventAfterTimestamp = ev;
- }
- return eventAfterTimestamp;
- }
- };
-
- var FIRST_PAINT_NUMERIC_BUILDER =
- new tr.v.NumericBuilder(timeDurationInMs_smallerIsBetter, 0)
- .addLinearBins(1000, 20) // 50ms step to 1s
- .addLinearBins(3000, 20) // 100ms step to 3s
- .addExponentialBins(20000, 20);
- function createHistogram() {
- var histogram = FIRST_PAINT_NUMERIC_BUILDER.build();
- histogram.customizeSummaryOptions({
- avg: true,
- count: false,
- max: true,
- min: true,
- std: true,
- sum: false,
- percentile: [0.90, 0.95, 0.99],
- });
- return histogram;
- }
-
- function findFrameLoaderSnapshotAt(rendererHelper, frameIdRef, ts) {
- var snapshot;
-
- var objects = rendererHelper.process.objects;
- var frameLoaderInstances = objects.instancesByTypeName_['FrameLoader'];
- if (frameLoaderInstances === undefined) {
- console.warn('Failed to find FrameLoader for frameId "' + frameIdRef +
- '" at ts ' + ts + ', the trace maybe incomplete or from an old' +
- 'Chrome.');
- return undefined;
- }
-
- var snapshot;
- for (var instance of frameLoaderInstances) {
- if (!instance.isAliveAt(ts))
- continue;
- var maybeSnapshot = instance.getSnapshotAt(ts);
- if (frameIdRef !== maybeSnapshot.args['frame']['id_ref'])
- continue;
- snapshot = maybeSnapshot;
- }
-
- return snapshot;
- }
-
- function findAllUserTimingEvents(rendererHelper, title) {
- var targetEvents = [];
-
- for (var ev of rendererHelper.process.getDescendantEvents()) {
- if (ev.category !== 'blink.user_timing' || ev.title !== title)
- continue;
- targetEvents.push(ev);
- }
-
- return targetEvents;
- }
-
- function findAllLayoutEvents(rendererHelper) {
- var isTelemetryInternalEvent =
- prepareTelemetryInternalEventPredicate(rendererHelper);
- var layoutsForFrameId = {};
- for (var ev of rendererHelper.process.getDescendantEvents()) {
- if (ev.category !==
- 'blink,benchmark,disabled-by-default-blink.debug.layout' ||
- ev.title !== 'FrameView::performLayout')
- continue;
- if (isTelemetryInternalEvent(ev))
- continue;
- if (ev.args.counters === undefined) {
- console.warn('Ignoring FrameView::performLayout event with no ' +
- 'counters arg (END event is missing).');
- continue;
- }
- var frameIdRef = ev.args.counters['frame'];
- if (frameIdRef === undefined)
- continue;
- var list = layoutsForFrameId[frameIdRef];
- if (list === undefined)
- layoutsForFrameId[frameIdRef] = list = [];
- list.push(ev);
- }
- return layoutsForFrameId;
- }
-
- function prepareTelemetryInternalEventPredicate(rendererHelper) {
- var ignoreRegions = [];
-
- var internalRegionStart;
- for (var slice of
- rendererHelper.mainThread.asyncSliceGroup.getDescendantEvents()) {
- if (!!slice.title.match(/^telemetry\.internal\.[^.]*\.start$/))
- internalRegionStart = slice.start;
- if (!!slice.title.match(/^telemetry\.internal\.[^.]*\.end$/)) {
- var timedEvent = new tr.model.TimedEvent(internalRegionStart);
- timedEvent.duration = slice.end - internalRegionStart;
- ignoreRegions.push(timedEvent);
- }
- }
-
- return function isTelemetryInternalEvent(slice) {
- for (var region of ignoreRegions)
- if (region.bounds(slice))
- return true;
- return false;
- }
- }
-
- var URL_BLACKLIST = [
- 'about:blank',
- // Chrome on Android creates main frames with the below URL for plugins.
- 'data:text/html,pluginplaceholderdata'
- ];
- function shouldIgnoreURL(url) {
- return URL_BLACKLIST.indexOf(url) >= 0;
- }
-
- var METRICS = [
- {
- valueName: 'firstContentfulPaint',
- title: 'firstContentfulPaint',
- description: 'time to first contentful paint'
- },
- {
- valueName: 'timeToOnload',
- title: 'loadEventStart',
- description: 'time to onload. ' +
- 'This is temporary metric used for PCv1/v2 sanity checking'
- }];
-
- function firstContentfulPaintMetric(values, model) {
- var chromeHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- var rendererHelper = findTargetRendererHelper(chromeHelper);
- var isTelemetryInternalEvent =
- prepareTelemetryInternalEventPredicate(rendererHelper);
- var navigationStartFinder = new NavigationStartFinder(rendererHelper);
-
- for (var metric of METRICS) {
- var histogram = createHistogram();
- var targetEvents = findAllUserTimingEvents(rendererHelper, metric.title);
- for (var ev of targetEvents) {
- if (isTelemetryInternalEvent(ev))
- continue;
- var frameIdRef = ev.args['frame'];
- var snapshot =
- findFrameLoaderSnapshotAt(rendererHelper, frameIdRef, ev.start);
- if (snapshot === undefined || !snapshot.args.isLoadingMainFrame)
- continue;
- var url = snapshot.args.documentLoaderURL;
- if (shouldIgnoreURL(url))
- continue;
- var navigationStartEvent = navigationStartFinder.
- findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start);
- // Ignore layout w/o preceding navigationStart, as they are not
- // attributed to any time-to-X metric.
- if (navigationStartEvent === undefined)
- continue;
-
- var timeToEvent = ev.start - navigationStartEvent.start;
- histogram.add(timeToEvent, {url: url});
- }
- values.addValue(new tr.v.NumericValue(
- metric.valueName, histogram,
- { description: metric.description }));
- }
- }
-
- /**
- * Compute significance of given layout event.
- *
- * Significance of a layout is the number of layout objects newly added to the
- * layout tree, weighted by page height (before and after the layout).
- */
- function layoutSignificance(event) {
- var newObjects = event.args.counters['LayoutObjectsThatHadNeverHadLayout'];
- var visibleHeight = event.args['counters']['visibleHeight'];
- if (!newObjects || !visibleHeight)
- return 0;
-
- var heightBefore = event.args['contentsHeightBeforeLayout'];
- var heightAfter = event.args['counters']['contentsHeightAfterLayout'];
- var ratioBefore = Math.max(1, heightBefore / visibleHeight);
- var ratioAfter = Math.max(1, heightAfter / visibleHeight);
- return newObjects / ((ratioBefore + ratioAfter) / 2);
- }
-
- /**
- * If there are loading fonts when layout happened, the layout change
- * accounting is postponed until the font is displayed. However, icon fonts
- * shouldn't block first meaningful paint. We use a threshold that only web
- * fonts that laid out more than 200 characters should block first meaningful
- * paint.
- */
- function hasTooManyBlankCharactersToBeMeaningful(event) {
- var BLOCK_FIRST_MEANINGFUL_PAINT_IF_BLANK_CHARACTERS_MORE_THAN = 200;
- return event.args['counters']['approximateBlankCharacterCount'] >
- BLOCK_FIRST_MEANINGFUL_PAINT_IF_BLANK_CHARACTERS_MORE_THAN;
- }
-
- /**
- * Computes Time to first meaningful paint (TTFMP) from |model| and add it to
- * |value|.
- *
- * TTFMP is computed from three types of events: NavigationStart, Layout, and
- * Paint. Each Layout event has associated "significance" value, indicating
- * how the layout was visually significant.
- *
- * TTFMP is the time between NavigationStart and Paint that follows the Layout
- * with biggest significance value.
- *
- * Design doc: https://goo.gl/vpaxv6
- */
- function firstMeaningfulPaintMetric(values, model) {
- var chromeHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- var rendererHelper = findTargetRendererHelper(chromeHelper);
- var navigationStartFinder = new NavigationStartFinder(rendererHelper);
- var paintFinder = new PaintFinder(rendererHelper);
- var firstMeaningfulPaintHistogram = createHistogram();
-
- function addFirstMeaningfulPaintSampleToHistogram(
- frameIdRef, navigationStart, mostSignificantLayout) {
- var snapshot = findFrameLoaderSnapshotAt(
- rendererHelper, frameIdRef, mostSignificantLayout.start);
- if (snapshot === undefined || !snapshot.args.isLoadingMainFrame)
- return;
- var url = snapshot.args.documentLoaderURL;
- if (shouldIgnoreURL(url))
- return;
- var paintEvent = paintFinder.findPaintEventForFrameAfterTimestamp(
- frameIdRef, mostSignificantLayout.start);
- if (paintEvent === undefined) {
- console.warn('Failed to find paint event after the most significant ' +
- 'layout for frameId "' + frameIdRef + '".');
- return;
- }
- var timeToFirstMeaningfulPaint = paintEvent.start - navigationStart.start;
- firstMeaningfulPaintHistogram.add(timeToFirstMeaningfulPaint, {url: url});
- }
-
- var layoutsForFrameId = findAllLayoutEvents(rendererHelper);
-
- for (var frameIdRef in layoutsForFrameId) {
- var navigationStart;
- var mostSignificantLayout;
- var maxSignificanceSoFar = 0;
- var accumulatedSignificanceWhileHavingBlankText = 0;
-
- // Iterate over the layout events, remembering one with largest
- // significance.
- for (var ev of layoutsForFrameId[frameIdRef]) {
- var navigationStartForThisLayout = navigationStartFinder.
- findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start);
- // Ignore layout w/o preceding navigationStart, as they are not
- // attributed to any TTFMP.
- if (navigationStartForThisLayout === undefined)
- continue;
-
- if (navigationStart !== navigationStartForThisLayout) {
- // New navigation is found. Compute TTFMP for current navigation, and
- // reset the state variables.
- if (navigationStart !== undefined &&
- mostSignificantLayout !== undefined)
- addFirstMeaningfulPaintSampleToHistogram(
- frameIdRef, navigationStart, mostSignificantLayout);
- navigationStart = navigationStartForThisLayout;
- mostSignificantLayout = undefined;
- maxSignificanceSoFar = 0;
- accumulatedSignificanceWhileHavingBlankText = 0;
- }
-
- // Check if |ev| has the largest significance. If the page has many
- // blank characters, the significance value is accumulated until
- // the text become visible.
- var significance = layoutSignificance(ev);
- if (hasTooManyBlankCharactersToBeMeaningful(ev)) {
- accumulatedSignificanceWhileHavingBlankText += significance;
- } else {
- significance += accumulatedSignificanceWhileHavingBlankText;
- accumulatedSignificanceWhileHavingBlankText = 0;
- if (significance > maxSignificanceSoFar) {
- maxSignificanceSoFar = significance;
- mostSignificantLayout = ev;
- }
- }
- }
-
- // Emit TTFMP for the last navigation.
- if (mostSignificantLayout !== undefined)
- addFirstMeaningfulPaintSampleToHistogram(
- frameIdRef, navigationStart, mostSignificantLayout);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'firstMeaningfulPaint', firstMeaningfulPaintHistogram,
- { description: 'time to first meaningful paint' }));
- }
-
- function firstPaintMetric(values, model) {
- firstContentfulPaintMetric(values, model);
- firstMeaningfulPaintMetric(values, model);
- }
-
- tr.metrics.MetricRegistry.register(firstPaintMetric);
-
- return {
- firstPaintMetric: firstPaintMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html
deleted file mode 100644
index be318aa3600..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html
+++ /dev/null
@@ -1,235 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 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/metrics/system_health/first_paint_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('firstContentfulPaint', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'firstContentfulPaint',
- start: 1000,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var numeric = values.valueDicts[0].numeric;
- assert.equal(1, numeric.running.count);
- assert.equal(800, numeric.running.mean);
- });
-
- test('firstContentfulPaintIgnoringWarmCache', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
-
- // warm cache navigation
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- mainThread.asyncSliceGroup.push(tr.c.TestUtils.newAsyncSliceEx({
- cat: 'blink.console',
- title: 'telemetry.internal.warmCache.start',
- start: 250,
- duration: 0.0
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'firstContentfulPaint',
- start: 1000,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- mainThread.asyncSliceGroup.push(tr.c.TestUtils.newAsyncSliceEx({
- cat: 'blink.console',
- title: 'telemetry.internal.warmCache.end',
- start: 1250,
- duration: 0.0
- }));
-
- // measurement navigation
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 2000,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 2100,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'firstContentfulPaint',
- start: 2400,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var numeric = values.valueDicts[0].numeric;
- assert.equal(1, numeric.running.count);
- assert.equal(400, numeric.running.mean);
- });
-
- test('firstMeaningfulPaint', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 500,
- duration: 10.0,
- args: {
- counters: {
- frame: '0xdeadbeef',
- LayoutObjectsThatHadNeverHadLayout: 10,
- contentsHeightAfterLayout: 800,
- visibleHeight: 1000,
- },
- contentsHeightBeforeLayout: 0
- }
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'devtools.timeline',
- title: 'Paint',
- start: 600,
- duration: 1.0,
- args: {data: {frame: '0xdeadbeef'}}
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 800,
- duration: 10.0,
- args: {
- counters: {
- frame: '0xdeadbeef',
- LayoutObjectsThatHadNeverHadLayout: 100,
- contentsHeightAfterLayout: 800,
- visibleHeight: 1000
- },
- contentsHeightBeforeLayout: 800
- }
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'devtools.timeline',
- title: 'Paint',
- start: 1000,
- duration: 1.0,
- args: {data: {frame: '0xdeadbeef'}}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var fmpEntries = values.valueDicts.filter(
- (dict) => dict.name === 'firstMeaningfulPaint');
- var numeric = fmpEntries[0].numeric;
- assert.equal(1, numeric.running.count);
- assert.equal(800, numeric.running.mean);
- });
-
- test('firstMeaningfulPaintWithInvalidLayoutCounters', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
-
- // FrameView::performLayout trace event does not have frame ID
- // if blink.debug.layout category is not enabled.
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 500,
- duration: 10.0,
- args: {
- counters: {},
- contentsHeightBeforeLayout: 0
- }
- }));
-
- // Incomplete slice: counters argument is missing.
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 550,
- duration: 10.0,
- args: {
- contentsHeightBeforeLayout: 0
- }
- }));
-
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'devtools.timeline',
- title: 'Paint',
- start: 600,
- duration: 1.0,
- args: {data: {frame: '0xdeadbeef'}}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var fmpEntries = values.valueDicts.filter(
- (dict) => dict.name === 'firstMeaningfulPaint');
- var numeric = fmpEntries[0].numeric;
- assert.equal(0, numeric.running.count);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html
deleted file mode 100644
index 96961779782..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html
+++ /dev/null
@@ -1,145 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/long_tasks_metric.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var normalizedPercentage_smallerIsBetter =
- tr.v.Unit.byName.normalizedPercentage_smallerIsBetter;
-
- // The following math is easier if the units are seconds rather than ms,
- // so durations will be converted from ms to s.
- var MS_PER_S = 1000;
-
- // https://www.desmos.com/calculator/ysabhcc42g
- var RESPONSE_RISK =
- tr.b.Statistics.LogNormalDistribution.fromMedianAndDiminishingReturns(
- 100 / MS_PER_S, 50 / MS_PER_S);
-
- /**
- * This helper function computes the risk that a task of the given duration
- * would impact the responsiveness of a speculative input.
- *
- * @param {number} durationMs
- * @return {number} task hazard
- */
- function computeResponsivenessRisk(durationMs) {
- // Returns 0 when the risk of impacting responsiveness is minimal.
- // Returns 1 when it is maximal.
- // durationMs is the duration of a long task.
- // It is at least LONG_TASK_MS.
- // The FAST_RESPONSE_HISTOGRAM was designed to permit both a 50ms task
- // when a Scroll Response begins, plus 16ms latency between the task
- // and the first frame of the scroll, without impacting the responsiveness
- // score.
- // Add 16ms to durationMs to simulate the standard (maximum ideal) scroll
- // response latency, and use the FAST_RESPONSE_HISTOGRAM to punish every ms
- // that the long task exceeds LONG_TASK_MS.
-
- durationMs += 16;
-
- // This returns a normalized percentage that
- // represents the fraction of users that would be satisfied with a
- // Scroll Response that takes durationMs to respond.
- // The risk of impacting responsiveness is approximated as the long task's
- // impact on a hypothetical Scroll Response that starts when the long task
- // starts, and then takes the standard 16ms to respond after the long task
- // finishes.
- // We imagine a Scroll Response instead of a Load or another type of
- // Response because the Scroll Response carries the strictest expectation.
- // The risk of impacting responsiveness is framed as the fraction of users
- // that would be *un*satisifed with the responsiveness of that hypothetical
- // Scroll Response. The fraction of users who are unsatisfied with something
- // is equal to 1 - the fraction of users who are satisfied with it.
- return RESPONSE_RISK.computePercentile(durationMs / MS_PER_S);
- }
-
- /**
- * This weighting function is similar to tr.metrics.sh.perceptualBlend,
- * but this version is appropriate for SmallerIsBetter metrics, whereas
- * that version is for BiggerIsBetter metrics.
- * (This would not be necessary if hazard were reframed as a BiggerIsBetter
- * metric such as "input readiness".)
- * Also, that version assumes that the 'ary' will be UserExpectations, whereas
- * this version assumes that the 'ary' will be scores.
- *
- * @param {number} hazardScore
- * @return {number} weight
- */
- function perceptualBlendSmallerIsBetter(hazardScore) {
- return Math.exp(hazardScore);
- }
-
- /**
- * Compute and return the normalized score for the risk that a speculative
- * input's responsiveness would have been impacted by long tasks on the given
- * thread in the given range.
- *
- * @param {tr.model.Thread} thread
- * @param {tr.b.Range=} opt_range
- * @return {number} hazard
- */
- function computeHazardForLongTasksInRangeOnThread(thread, opt_range) {
- var taskHazardScores = [];
- tr.metrics.sh.iterateLongTopLevelTasksOnThreadInRange(
- thread, opt_range, function(task) {
- taskHazardScores.push(computeResponsivenessRisk(task.duration));
- });
- return tr.b.Statistics.weightedMean(
- taskHazardScores, perceptualBlendSmallerIsBetter);
- }
-
- /**
- * Compute and return the normalized score for the risk that a speculative
- * input's responsiveness would have been impacted by long tasks.
- *
- * @param {tr.model.Model} model The model.
- * @return {number} hazard
- */
- function computeHazardForLongTasks(model) {
- var threadHazardScores = [];
- tr.metrics.sh.iterateRendererMainThreads(model, function(thread) {
- threadHazardScores.push(computeHazardForLongTasksInRangeOnThread(
- thread));
- });
- return tr.b.Statistics.weightedMean(
- threadHazardScores, perceptualBlendSmallerIsBetter);
- }
-
- /**
- * This EXPERIMENTAL metric computes a scalar normalized score that
- * represents the risk that a speculative input's responsiveness would have
- * been impacted by long tasks.
- * This metric requires only the 'toplevel' tracing category.
- */
- function hazardMetric(values, model) {
- var overallHazard = computeHazardForLongTasks(model);
- if (overallHazard === undefined)
- overallHazard = 0;
-
- values.addValue(new tr.v.NumericValue(
- 'hazard', new tr.v.ScalarNumeric(
- normalizedPercentage_smallerIsBetter, overallHazard)));
- }
-
- tr.metrics.MetricRegistry.register(hazardMetric);
-
- return {
- hazardMetric: hazardMetric,
- computeHazardForLongTasksInRangeOnThread:
- computeHazardForLongTasksInRangeOnThread,
- computeHazardForLongTasks: computeHazardForLongTasks,
- computeResponsivenessRisk: computeResponsivenessRisk
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html
deleted file mode 100644
index 629f608e942..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/metrics/system_health/hazard_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function computeHazardValue(customizeModelCallback) {
- var model = tr.c.TestUtils.newModel(function(model) {
- model.rendererProcess = model.getOrCreateProcess(2);
- model.rendererMain = model.rendererProcess.getOrCreateThread(3);
- model.rendererMain.name = 'CrRendererMain';
-
- customizeModelCallback(model);
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.hazardMetric(values, model);
- var valueDicts = values.valueDicts;
- assert.equal(1, valueDicts.length);
- return valueDicts[0];
- }
-
- test('minimalHazard', function() {
- var duration = 50 + 1e-4;
- var value = computeHazardValue(function(model) {
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: duration
- }));
- });
- assert.notEqual(0, value.numeric.value);
- assert.closeTo(value.numeric.value, 0.1611, 1e-5);
- });
-
- test('maximalHazard', function() {
- var value = computeHazardValue(function(model) {
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 2200
- }));
- });
- assert.closeTo(value.numeric.value, 1, 1e-5);
- });
-
- test('blendedHazards', function() {
- var value = computeHazardValue(function(model) {
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 100
- }));
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 200
- }));
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 300
- }));
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 400
- }));
- });
- assert.closeTo(0.92144, value.numeric.value, 1e-4);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html
deleted file mode 100644
index 1e2fea97a19..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/metric_registry.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var LONG_TASK_MS = 50;
-
- // Anything longer than this should be so rare that its length beyond this is
- // uninteresting.
- var LONGEST_TASK_MS = 1000;
-
- var timeDurationInMs_smallerIsBetter =
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter;
-
- /**
- * This helper function calls |cb| for each of the top-level tasks on the
- * given thread in the given range whose duration is longer than LONG_TASK_MS.
- *
- * @param {tr.model.Thread} thread
- * @param {tr.b.Range=} opt_range
- * @param {function()} cb
- * @param {Object=} opt_this
- */
- function iterateLongTopLevelTasksOnThreadInRange(
- thread, opt_range, cb, opt_this) {
- thread.sliceGroup.topLevelSlices.forEach(function(slice) {
- if (opt_range &&
- !opt_range.intersectsExplicitRangeExclusive(slice.start, slice.end))
- return;
-
- if (slice.duration < LONG_TASK_MS)
- return;
-
- cb.call(opt_this, slice);
- });
- }
-
- /**
- * This helper function calls |cb| for each of the main renderer threads in
- * the model.
- *
- * @param {tr.model.Model} model The model.
- * @param {function()} cb Callback.
- * @param {Object=} opt_this Context object.
- */
- function iterateRendererMainThreads(model, cb, opt_this) {
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- tr.b.dictionaryValues(modelHelper.rendererHelpers).forEach(
- function(rendererHelper) {
- if (!rendererHelper.mainThread)
- return;
- cb.call(opt_this, rendererHelper.mainThread);
- });
- }
-
- var LONG_TASK_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(LONG_TASK_MS, LONGEST_TASK_MS), 50);
-
- /**
- * This metric directly measures long tasks on renderer main threads.
- * This metric requires only the 'toplevel' tracing category.
- *
- * @param {!tr.v.ValueSet} values
- * @param {!tr.model.Model} model
- * @param {!Object=} opt_options
- */
- function longTasksMetric(values, model, opt_options) {
- var rangeOfInterest = opt_options ? opt_options.rangeOfInterest : undefined;
- var longTaskNumeric = LONG_TASK_NUMERIC_BUILDER.build();
- iterateRendererMainThreads(model, function(thread) {
- iterateLongTopLevelTasksOnThreadInRange(
- thread, rangeOfInterest, function(task) {
- longTaskNumeric.add(task.duration, task.stableId);
- });
- });
- var options = {description: 'durations of long tasks'};
- values.addValue(new tr.v.NumericValue(
- 'long tasks', longTaskNumeric, options));
- }
-
- tr.metrics.MetricRegistry.register(longTasksMetric, {
- supportsRangeOfInterest: true
- });
-
- return {
- longTasksMetric: longTasksMetric,
- iterateLongTopLevelTasksOnThreadInRange:
- iterateLongTopLevelTasksOnThreadInRange,
- iterateRendererMainThreads: iterateRendererMainThreads,
- LONG_TASK_MS: LONG_TASK_MS,
- LONGEST_TASK_MS: LONGEST_TASK_MS
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html
deleted file mode 100644
index 1aa81e05b2b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html
+++ /dev/null
@@ -1,1023 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/iteration_helpers.html">
-<link rel="import" href="/tracing/base/multi_dimensional_view.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var DISPLAYED_SIZE_NUMERIC_NAME =
- tr.model.MemoryAllocatorDump.DISPLAYED_SIZE_NUMERIC_NAME;
-
- var LEVEL_OF_DETAIL_NAMES = new Map();
- LEVEL_OF_DETAIL_NAMES.set(LIGHT, 'light');
- LEVEL_OF_DETAIL_NAMES.set(DETAILED, 'detailed');
-
- var MEMORY_NUMERIC_BUILDER_MAP = new WeakMap();
- // For unitless numerics (process counts), we use 20 linearly scaled bins
- // from 0 to 20.
- MEMORY_NUMERIC_BUILDER_MAP.set(unitlessNumber_smallerIsBetter,
- tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 20), 20));
- // For size numerics (subsystem and vm stats), we use 1 bin from 0 B to
- // 1 KiB and 4*24 exponentially scaled bins from 1 KiB to 16 GiB (=2^24 KiB).
- MEMORY_NUMERIC_BUILDER_MAP.set(sizeInBytes_smallerIsBetter,
- new tr.v.NumericBuilder(sizeInBytes_smallerIsBetter, 0)
- .addBinBoundary(1024 /* 1 KiB */)
- .addExponentialBins(16 * 1024 * 1024 * 1024 /* 16 GiB */, 4 * 24));
-
- function memoryMetric(values, model) {
- var browserNameToGlobalDumps = splitGlobalDumpsByBrowserName(model);
- addGeneralMemoryDumpValues(browserNameToGlobalDumps, values);
- addDetailedMemoryDumpValues(browserNameToGlobalDumps, values);
- addMemoryDumpCountValues(browserNameToGlobalDumps, values);
- }
-
- /**
- * Splits the global memory dumps in |model| by browser name.
- *
- * @param {!tr.Model} model The trace model from which the global dumps
- * should be extracted.
- * @return {!Map<string, !Array<!tr.model.GlobalMemoryDump>} A map from
- * browser names to the associated global memory dumps.
- */
- function splitGlobalDumpsByBrowserName(model) {
- var chromeModelHelper =
- model.getOrCreateHelper(tr.model.helpers.ChromeModelHelper);
- var browserNameToGlobalDumps = new Map();
- var globalDumpToBrowserHelper = new WeakMap();
-
- // 1. For each browser process in the model, add its global memory dumps to
- // |browserNameToGlobalDumps|. |chromeModelHelper| can be undefined if
- // it fails to find any browser, renderer or GPU process (see
- // tr.model.helpers.ChromeModelHelper.supportsModel).
- if (chromeModelHelper) {
- chromeModelHelper.browserHelpers.forEach(function(helper) {
- // Retrieve the associated global memory dumps and check that they
- // haven't been classified as belonging to another browser process.
- var globalDumps = helper.process.memoryDumps.map(
- d => d.globalMemoryDump);
- globalDumps.forEach(function(globalDump) {
- var existingHelper = globalDumpToBrowserHelper.get(globalDump);
- if (existingHelper !== undefined) {
- throw new Error('Memory dump ID clash across multiple browsers ' +
- 'with PIDs: ' + existingHelper.pid + ' and ' + helper.pid);
- }
- globalDumpToBrowserHelper.set(globalDump, helper);
- });
-
- makeKeyUniqueAndSet(browserNameToGlobalDumps,
- canonicalizeName(helper.browserName), globalDumps);
- });
- }
-
- // 2. If any global memory dump does not have any associated browser
- // process for some reason, associate it with an 'unknown_browser' browser
- // so that we don't lose the data.
- var unclassifiedGlobalDumps =
- model.globalMemoryDumps.filter(g => !globalDumpToBrowserHelper.has(g));
- if (unclassifiedGlobalDumps.length > 0) {
- makeKeyUniqueAndSet(
- browserNameToGlobalDumps, 'unknown_browser', unclassifiedGlobalDumps);
- }
-
- return browserNameToGlobalDumps;
- }
-
- function canonicalizeName(name) {
- return name.toLowerCase().replace(' ', '_');
- };
-
- var USER_FRIENDLY_BROWSER_NAMES = {
- 'chrome': 'Chrome',
- 'webview': 'WebView',
- 'unknown_browser': 'an unknown browser'
- };
-
- /**
- * Convert a canonical browser name used in value names to a user-friendly
- * name used in value descriptions.
- *
- * Examples:
- *
- * CANONICAL BROWSER NAME -> USER-FRIENDLY NAME
- * chrome -> Chrome
- * unknown_browser -> an unknown browser
- * webview2 -> WebView(2)
- * unexpected -> 'unexpected' browser
- */
- function convertBrowserNameToUserFriendlyName(browserName) {
- for (var baseName in USER_FRIENDLY_BROWSER_NAMES) {
- if (!browserName.startsWith(baseName))
- continue;
- var userFriendlyBaseName = USER_FRIENDLY_BROWSER_NAMES[baseName];
- var suffix = browserName.substring(baseName.length);
- if (suffix.length === 0)
- return userFriendlyBaseName;
- else if (/^\d+$/.test(suffix))
- return userFriendlyBaseName + '(' + suffix + ')';
- }
- return '\'' + browserName + '\' browser';
- }
-
- function canonicalizeProcessName(rawProcessName) {
- if (!rawProcessName)
- return 'unknown_processes';
- var baseCanonicalName = canonicalizeName(rawProcessName);
- switch (baseCanonicalName) {
- case 'renderer':
- return 'renderer_processes'; // Intentionally plural.
- case 'browser':
- return 'browser_process';
- default:
- return baseCanonicalName;
- }
- }
-
- /**
- * Convert a canonical process name used in value names to a user-friendly
- * name used in value descriptions.
- */
- function convertProcessNameToUserFriendlyName(processName,
- opt_requirePlural) {
- switch (processName) {
- case 'browser_process':
- return opt_requirePlural ? 'browser processes' : 'the browser process';
- case 'renderer_processes':
- return 'renderer processes';
- case 'gpu_process':
- return opt_requirePlural ? 'GPU processes' : 'the GPU process';
- case 'ppapi_process':
- return opt_requirePlural ? 'PPAPI processes' : 'the PPAPI process';
- case 'all_processes':
- return 'all processes';
- case 'unknown_processes':
- return 'unknown processes';
- default:
- return '\'' + processName + '\' processes';
- }
- }
-
- /**
- * Function for adding entries with duplicate keys to a map without
- * overriding existing entries.
- *
- * This is achieved by appending numeric indices (2, 3, 4, ...) to duplicate
- * keys. Example:
- *
- * var map = new Map();
- * // map = Map {}.
- *
- * makeKeyUniqueAndSet(map, 'key', 'a');
- * // map = Map {"key" => "a"}.
- *
- * makeKeyUniqueAndSet(map, 'key', 'b');
- * // map = Map {"key" => "a", "key2" => "b"}.
- * ^^^^
- * makeKeyUniqueAndSet(map, 'key', 'c');
- * // map = Map {"key" => "a", "key2" => "b", "key3" => "c"}.
- * ^^^^ ^^^^
- */
- function makeKeyUniqueAndSet(map, key, value) {
- var uniqueKey = key;
- var nextIndex = 2;
- while (map.has(uniqueKey)) {
- uniqueKey = key + nextIndex;
- nextIndex++;
- }
- map.set(uniqueKey, value);
- }
-
- /**
- * Add general memory dump values calculated from all global memory dumps to
- * |values|. In particular, this function adds the following values:
- *
- * * PROCESS COUNTS
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * process_count
- * type: tr.v.Numeric (histogram over all matching global memory dumps)
- * unit: unitlessNumber_smallerIsBetter
- *
- * * MEMORY USAGE REPORTED BY CHROME
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_chrome[:{v8, malloc, ...}]:
- * {effective_size, allocated_objects_size, locked_size}
- * type: tr.v.Numeric (histogram over all matching global memory dumps)
- * unit: sizeInBytes_smallerIsBetter
- */
- function addGeneralMemoryDumpValues(browserNameToGlobalDumps, values) {
- addMemoryDumpValues(browserNameToGlobalDumps,
- gmd => true /* process all global memory dumps */,
- function(processDump, addProcessScalar) {
- // Increment memory:<browser-name>:<process-name>:process_count value.
- addProcessScalar({
- source: 'process_count',
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- descriptionPrefixBuilder: buildProcessCountDescriptionPrefix
- });
-
- // Add memory:<browser-name>:<process-name>:reported_by_chrome:...
- // values.
- if (processDump.memoryAllocatorDumps === undefined)
- return;
- processDump.memoryAllocatorDumps.forEach(function(rootAllocatorDump) {
- CHROME_VALUE_PROPERTIES.forEach(function(spec) {
- addProcessScalar({
- source: 'reported_by_chrome',
- component: [rootAllocatorDump.name],
- property: spec.propertyName,
- value: rootAllocatorDump.numerics[spec.propertyName],
- descriptionPrefixBuilder: spec.descriptionPrefixBuilder
- });
- });
- });
- },
- function(componentTree) {
- // Subtract memory:<browser-name>:<process-name>:reported_by_chrome:
- // tracing:<size-property> from memory:<browser-name>:<process-name>:
- // reported_by_chrome:<size-property> if applicable.
- var tracingNode = componentTree.children[1].get('tracing');
- if (tracingNode === undefined)
- return;
- for (var i = 0; i < componentTree.values.length; i++)
- componentTree.values[i].total -= tracingNode.values[i].total;
- }, values);
- }
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * process_count value.
- *
- * @param {!Array<string>} componentPath The underlying component path (must
- * be empty).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (always
- * 'total number of renderer processes').
- */
- function buildProcessCountDescriptionPrefix(componentPath, processName) {
- if (componentPath.length > 0) {
- throw new Error('Unexpected process count non-empty component path: ' +
- componentPath.join(':'));
- }
- return 'total number of ' + convertProcessNameToUserFriendlyName(
- processName, true /* opt_requirePlural */);
- }
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * reported_by_chrome:... value.
- *
- * @param {{
- * userFriendlyPropertyName: string,
- * userFriendlyPropertyNamePrefix: (string|undefined),
- * totalUserFriendlyPropertyName: (string|undefined),
- * componentPreposition: (string|undefined) }}
- * formatSpec Specification of how the property should be formatted.
- * @param {!Array<string>} componentPath The underlying component path (e.g.
- * ['malloc']).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (e.g.
- * 'effective size of malloc in the browser process').
- */
- function buildChromeValueDescriptionPrefix(
- formatSpec, componentPath, processName) {
- var nameParts = [];
- if (componentPath.length === 0) {
- nameParts.push('total');
- if (formatSpec.totalUserFriendlyPropertyName) {
- nameParts.push(formatSpec.totalUserFriendlyPropertyName);
- } else {
- if (formatSpec.userFriendlyPropertyNamePrefix)
- nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
- nameParts.push(formatSpec.userFriendlyPropertyName);
- }
- nameParts.push('reported by Chrome for');
- } else {
- if (formatSpec.componentPreposition === undefined) {
- // Use component name as an adjective
- // (e.g. 'size of V8 code and metadata').
- if (formatSpec.userFriendlyPropertyNamePrefix)
- nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
- nameParts.push(componentPath.join(':'));
- nameParts.push(formatSpec.userFriendlyPropertyName);
- } else {
- // Use component name as a noun with a preposition
- // (e.g. 'size of all objects allocated BY MALLOC').
- if (formatSpec.userFriendlyPropertyNamePrefix)
- nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
- nameParts.push(formatSpec.userFriendlyPropertyName);
- nameParts.push(formatSpec.componentPreposition);
- nameParts.push(componentPath.join(':'));
- }
- nameParts.push('in');
- }
- nameParts.push(convertProcessNameToUserFriendlyName(processName));
- return nameParts.join(' ');
- }
-
- // Specifications of properties reported by Chrome.
- var CHROME_VALUE_PROPERTIES = [
- {
- propertyName: 'effective_size',
- descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind(
- undefined, {
- userFriendlyPropertyName: 'effective size',
- componentPreposition: 'of'
- })
- },
- {
- propertyName: 'allocated_objects_size',
- descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind(
- undefined, {
- userFriendlyPropertyName: 'size of all objects allocated',
- totalUserFriendlyPropertyName: 'size of all allocated objects',
- componentPreposition: 'by'
- })
- },
- {
- propertyName: 'locked_size',
- descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind(
- undefined, {
- userFriendlyPropertyName: 'locked (pinned) size',
- componentPreposition: 'of'
- })
- }
- ];
-
- /**
- * Add heavy memory dump values calculated from heavy global memory dumps to
- * |values|. In particular, this function adds the following values:
- *
- * * MEMORY USAGE REPORTED BY THE OS
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_os:system_memory:[{ashmem, native_heap, java_heap}:]
- * {proportional_resident_size, private_dirty_size}
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_os:gpu_memory:[{gl, graphics, ...}:]
- * proportional_resident_size
- * type: tr.v.Numeric (histogram over matching heavy global memory dumps)
- * unit: sizeInBytes_smallerIsBetter
- *
- * * MEMORY USAGE REPORTED BY CHROME
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_chrome:v8:code_and_metadata_size
- * type: tr.v.Numeric (histogram over matching heavy global memory dumps)
- * unit: sizeInBytes_smallerIsBetter
- */
- function addDetailedMemoryDumpValues(browserNameToGlobalDumps, values) {
- addMemoryDumpValues(browserNameToGlobalDumps,
- g => g.levelOfDetail === DETAILED,
- function(processDump, addProcessScalar) {
- // Add memory:<browser-name>:<process-name>:reported_by_os:
- // system_memory:... values.
- tr.b.iterItems(
- SYSTEM_VALUE_COMPONENTS,
- function(componentName, componentSpec) {
- tr.b.iterItems(
- SYSTEM_VALUE_PROPERTIES,
- function(propertyName, propertySpec) {
- var node = getDescendantVmRegionClassificationNode(
- processDump.vmRegions,
- componentSpec.classificationPath);
- var componentPath = ['system_memory'];
- if (componentName)
- componentPath.push(componentName);
- addProcessScalar({
- source: 'reported_by_os',
- component: componentPath,
- property: propertyName,
- value: node === undefined ?
- 0 : (node.byteStats[propertySpec.byteStat] || 0),
- unit: sizeInBytes_smallerIsBetter,
- descriptionPrefixBuilder:
- propertySpec.descriptionPrefixBuilder
- });
- });
- });
-
- // Add memory:<browser-name>:<process-name>:reported_by_os:
- // gpu_memory:... values.
- var memtrackDump = processDump.getMemoryAllocatorDumpByFullName(
- 'gpu/android_memtrack');
- if (memtrackDump !== undefined) {
- var descriptionPrefixBuilder = SYSTEM_VALUE_PROPERTIES[
- 'proportional_resident_size'].descriptionPrefixBuilder;
- memtrackDump.children.forEach(function(memtrackChildDump) {
- var childName = memtrackChildDump.name;
- addProcessScalar({
- source: 'reported_by_os',
- component: ['gpu_memory', childName],
- property: 'proportional_resident_size',
- value: memtrackChildDump.numerics['memtrack_pss'],
- descriptionPrefixBuilder: descriptionPrefixBuilder
- });
- });
- }
-
- // Add memory:<browser-name>:<process-name>:reported_by_chrome:v8:
- // code_and_metadata_size when available.
- var v8Dump = processDump.getMemoryAllocatorDumpByFullName('v8');
- if (v8Dump !== undefined) {
- // V8 generates bytecode when interpreting and code objects when
- // compiling the javascript. Total code size includes the size
- // of code and bytecode objects.
- addProcessScalar({
- source: 'reported_by_chrome',
- component: ['v8'],
- property: 'code_and_metadata_size',
- value: v8Dump.numerics['code_and_metadata_size'],
- descriptionPrefixBuilder:
- buildCodeAndMetadataSizeValueDescriptionPrefix
- });
- addProcessScalar({
- source: 'reported_by_chrome',
- component: ['v8'],
- property: 'code_and_metadata_size',
- value: v8Dump.numerics['bytecode_and_metadata_size'],
- descriptionPrefixBuilder:
- buildCodeAndMetadataSizeValueDescriptionPrefix
- });
- }
- }, function(componentTree) {}, values);
- }
-
- // Specifications of components reported by the system.
- var SYSTEM_VALUE_COMPONENTS = {
- '': {
- classificationPath: [],
- },
- 'java_heap': {
- classificationPath: ['Android', 'Java runtime', 'Spaces'],
- userFriendlyName: 'the Java heap'
- },
- 'ashmem': {
- classificationPath: ['Android', 'Ashmem'],
- userFriendlyName: 'ashmem'
- },
- 'native_heap': {
- classificationPath: ['Native heap'],
- userFriendlyName: 'the native heap'
- }
- };
-
- // Specifications of properties reported by the system.
- var SYSTEM_VALUE_PROPERTIES = {
- 'proportional_resident_size': {
- byteStat: 'proportionalResident',
- descriptionPrefixBuilder: buildOsValueDescriptionPrefix.bind(
- undefined, 'proportional resident size (PSS)')
- },
- 'private_dirty_size': {
- byteStat: 'privateDirtyResident',
- descriptionPrefixBuilder: buildOsValueDescriptionPrefix.bind(
- undefined, 'private dirty size')
- }
- };
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * reported_by_os:... value.
- *
- * @param {string} userFriendlyPropertyName User-friendly name of the
- * underlying property (e.g. 'private dirty size').
- * @param {!Array<string>} componentPath The underlying component path (e.g.
- * ['system', 'java_heap']).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (e.g.
- * 'total private dirty size of the Java heal in the GPU process').
- */
- function buildOsValueDescriptionPrefix(
- userFriendlyPropertyName, componentPath, processName) {
- if (componentPath.length > 2) {
- throw new Error('OS value component path for \'' +
- userFriendlyPropertyName + '\' too long: ' + componentPath.join(':'));
- }
-
- var nameParts = [];
- if (componentPath.length < 2)
- nameParts.push('total');
-
- nameParts.push(userFriendlyPropertyName);
-
- if (componentPath.length > 0) {
- switch (componentPath[0]) {
- case 'system_memory':
- if (componentPath.length > 1) {
- var userFriendlyComponentName =
- SYSTEM_VALUE_COMPONENTS[componentPath[1]].userFriendlyName;
- if (userFriendlyComponentName === undefined) {
- throw new Error('System value sub-component for \'' +
- userFriendlyPropertyName + '\' unknown: ' +
- componentPath.join(':'));
- }
- nameParts.push('of', userFriendlyComponentName, 'in');
- } else {
- nameParts.push('of system memory (RAM) used by');
- }
- break;
-
- case 'gpu_memory':
- if (componentPath.length > 1) {
- nameParts.push('of the', componentPath[1]);
- nameParts.push('Android memtrack component in');
- } else {
- nameParts.push('of GPU memory (Android memtrack) used by');
- }
- break;
-
- default:
- throw new Error('OS value component for \'' +
- userFriendlyPropertyName + '\' unknown: ' +
- componentPath.join(':'));
- }
- } else {
- nameParts.push('reported by the OS for');
- }
-
- nameParts.push(convertProcessNameToUserFriendlyName(processName));
- return nameParts.join(' ');
- }
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * reported_by_chrome:...:code_and_metadata_size value.
- *
- * @param {!Array<string>} componentPath The underlying component path (e.g.
- * ['v8']).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (e.g.
- * 'size of v8 code and metadata in').
- */
- function buildCodeAndMetadataSizeValueDescriptionPrefix(
- componentPath, processName) {
- return buildChromeValueDescriptionPrefix({
- userFriendlyPropertyNamePrefix: 'size of',
- userFriendlyPropertyName: 'code and metadata'
- }, componentPath, processName);
- }
-
- /**
- * Get the descendant of a VM region classification |node| specified by the
- * given |path| of child node titles. If |node| is undefined or such a
- * descendant does not exist, this function returns undefined.
- */
- function getDescendantVmRegionClassificationNode(node, path) {
- for (var i = 0; i < path.length; i++) {
- if (node === undefined)
- break;
- node = tr.b.findFirstInArray(node.children, c => c.title === path[i]);
- }
- return node;
- }
-
- /**
- * Add global memory dump counts to |values|. In particular, this function
- * adds the following values:
- *
- * * DUMP COUNTS
- * memory:{chrome, webview}:all_processes:dump_count[:{light, detailed}]
- * type: tr.v.ScalarNumeric (scalar over the whole trace)
- * unit: unitlessNumber_smallerIsBetter
- *
- * Note that unlike all other values generated by the memory metric, the
- * global memory dump counts are NOT instances of tr.v.Numeric (histogram)
- * because it doesn't make sense to aggregate them (they are already counts
- * over all global dumps associated with the relevant browser).
- */
- function addMemoryDumpCountValues(browserNameToGlobalDumps, values) {
- browserNameToGlobalDumps.forEach(function(globalDumps, browserName) {
- var totalDumpCount = 0;
- var levelOfDetailNameToDumpCount = {};
- LEVEL_OF_DETAIL_NAMES.forEach(function(levelOfDetailName) {
- levelOfDetailNameToDumpCount[levelOfDetailName] = 0;
- });
-
- globalDumps.forEach(function(globalDump) {
- totalDumpCount++;
-
- // Increment the level-of-detail-specific dump count (if possible).
- var levelOfDetailName =
- LEVEL_OF_DETAIL_NAMES.get(globalDump.levelOfDetail);
- if (!(levelOfDetailName in levelOfDetailNameToDumpCount))
- return; // Unknown level of detail.
- levelOfDetailNameToDumpCount[levelOfDetailName]++;
- });
-
- // Add memory:<browser-name>:all_processes:dump_count[:<level>] values.
- reportMemoryDumpCountAsValue(browserName, undefined /* total */,
- totalDumpCount, values);
- tr.b.iterItems(levelOfDetailNameToDumpCount,
- function(levelOfDetailName, levelOfDetailDumpCount) {
- reportMemoryDumpCountAsValue(browserName, levelOfDetailName,
- levelOfDetailDumpCount, values);
- });
- });
- }
-
- /**
- * Add a tr.v.ScalarNumeric value to |values| reporting that the number of
- * |levelOfDetailName| memory dumps added by |browserName| was
- * |levelOfDetailCount|.
- */
- function reportMemoryDumpCountAsValue(
- browserName, levelOfDetailName, levelOfDetailDumpCount, values) {
- // Construct the name of the memory value.
- var nameParts = ['memory', browserName, 'all_processes', 'dump_count'];
- if (levelOfDetailName !== undefined)
- nameParts.push(levelOfDetailName);
- var name = nameParts.join(':');
-
- // Build the underlying numeric for the memory value.
- var numeric = new ScalarNumeric(
- unitlessNumber_smallerIsBetter, levelOfDetailDumpCount);
-
- // Build the options for the memory value.
- var description = [
- 'total number of',
- levelOfDetailName || 'all',
- 'memory dumps added by',
- convertBrowserNameToUserFriendlyName(browserName),
- 'to the trace'
- ].join(' ');
- var options = { description: description };
-
- // Report the memory value.
- values.addValue(new tr.v.NumericValue(name, numeric, options));
- }
-
- /**
- * Add generic values extracted from process memory dumps and aggregated by
- * process name and component path into |values|.
- *
- * For each browser and set of global dumps in |browserNameToGlobalDumps|,
- * |customProcessDumpValueExtractor| is applied to every process memory dump
- * associated with the global memory dump. The second argument provided to the
- * callback is a function for adding extracted values:
- *
- * function sampleProcessDumpCallback(processDump, addProcessValue) {
- * ...
- * addProcessScalar({
- * source: 'reported_by_chrome',
- * component: ['system', 'native_heap'],
- * property: 'proportional_resident_size',
- * value: pssExtractedFromProcessDump2,
- * descriptionPrefixBuilder: function(componentPath) {
- * return 'PSS of ' + componentPath.join('/') + ' in';
- * }
- * });
- * ...
- * }
- *
- * For each global memory dump, the extracted values are summed by process
- * name (browser_process, renderer_processes, ..., all_processes) and
- * component path (e.g. gpu is a sum of gpu:gl, gpu:graphics, ...). The sums
- * are then aggregated over all global memory dumps associated with the given
- * browser. For example, assuming that |customProcessDumpValueExtractor|
- * extracts 'proportional_resident_size' values for component paths
- * ['X', 'A'], ['X', 'B'] and ['Y'] under the same 'source' from each process
- * memory dump, the following values will be reported (for Chrome):
- *
- * memory:chrome:browser_process:source:X:A:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:A in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:X:B:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:B in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:B in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:X:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:A+X:B in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:Y:proportional_resident_size :
- * Numeric aggregated over [
- * sum of Y in all 'browser' process dumps in global dump 1,
- * ...
- * sum of Y in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B+Y in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:A+X:B+Y in all 'browser' process dumps in global dump N
- * ]
- *
- * ...
- *
- * memory:chrome:all_processes:source:X:A:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A in all process dumps in global dump 1,
- * ...
- * sum of X:A in all process dumps in global dump N,
- * ]
- *
- * memory:chrome:all_processes:source:X:B:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:B in all process dumps in global dump 1,
- * ...
- * sum of X:B in all process dumps in global dump N,
- * ]
- *
- * memory:chrome:all_processes:source:X:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B in all process dumps in global dump 1,
- * ...
- * sum of X:A+X:B in all process dumps in global dump N,
- * ]
- *
- * memory:chrome:all_processes:source:Y:proportional_resident_size :
- * Numeric aggregated over [
- * sum of Y in all process dumps in global dump 1,
- * ...
- * sum of Y in all process dumps in global dump N
- * ]
- *
- * memory:chrome:all_processes:source:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B+Y in all process dumps in global dump 1,
- * ...
- * sum of X:A+X:B+Y in all process dumps in global dump N
- * ]
- *
- * where global dumps 1 to N are the global dumps associated with the given
- * browser.
- *
- * @param {!Map<string, !Array<!tr.model.GlobalMemoryDump>}
- * browserNameToGlobalDumps Map from browser names to arrays of global
- * memory dumps. The generic values will be extracted from the associated
- * process memory dumps.
- * @param {!function(!tr.model.GlobalMemoryDump): boolean}
- * customGlobalDumpFilter Predicate for filtering global memory dumps.
- * @param {!function(
- * !tr.model.ProcessMemoryDump,
- * !function(!{
- * source: string,
- * componentPath: (!Array<string>|undefined),
- * propertyName: (string|undefined),
- * value: (!tr.v.ScalarNumeric|number|undefined),
- * unit: (!tr.v.Unit|undefined),
- * descriptionPrefixBuilder: (!function(!Array<string>): string)
- * }))}
- * customProcessDumpValueExtractor Callback for extracting values from a
- * process memory dump.
- * @param {!function(!tr.b.MultiDimensionalViewNode)}
- * customComponentTreeModifier Callback applied to every component tree
- * wrt each process name.
- * @param {!tr.v.ValueSet} values List of values to which the
- * resulting aggregated values are added.
- */
- function addMemoryDumpValues(browserNameToGlobalDumps, customGlobalDumpFilter,
- customProcessDumpValueExtractor, customComponentTreeModifier,
- values) {
- browserNameToGlobalDumps.forEach(function(globalDumps, browserName) {
- var filteredGlobalDumps = globalDumps.filter(customGlobalDumpFilter);
- var sourceToPropertyToData = extractDataFromGlobalDumps(
- filteredGlobalDumps, customProcessDumpValueExtractor);
- reportDataAsValues(sourceToPropertyToData, browserName,
- customComponentTreeModifier, values);
- });
- }
-
- /**
- * For each global memory dump in |globalDumps|, calculate per-process-name
- * sums of values extracted by |customProcessDumpValueExtractor| from the
- * associated process memory dumps.
- *
- * This function returns the following nested map structure:
- *
- * Source name (Map key, e.g. 'reported_by_os')
- * -> Property name (Map key, e.g. 'proportional_resident_size')
- * -> {unit, descriptionPrefixBuilder, processAndComponentTreeBuilder}
- *
- * where |processAndComponentTreeBuilder| is a
- * tr.b.MultiDimensionalViewBuilder:
- *
- * Browser name (0th dimension key, e.g. 'webview') x
- * -> Component path (1st dimension keys, e.g. ['system', 'native_heap'])
- * -> Sum of value over the processes (number).
- *
- * See addMemoryDumpValues for more details.
- */
- function extractDataFromGlobalDumps(
- globalDumps, customProcessDumpValueExtractor) {
- var sourceToPropertyToData = new Map();
- var dumpCount = globalDumps.length;
- globalDumps.forEach(function(globalDump, dumpIndex) {
- tr.b.iterItems(globalDump.processMemoryDumps, function(_, processDump) {
- extractDataFromProcessDump(
- processDump, sourceToPropertyToData, dumpIndex, dumpCount,
- customProcessDumpValueExtractor);
- });
- });
- return sourceToPropertyToData;
- }
-
- function extractDataFromProcessDump(processDump, sourceToPropertyToData,
- dumpIndex, dumpCount, customProcessDumpValueExtractor) {
- // Process name is typically 'browser', 'renderer', etc.
- var rawProcessName = processDump.process.name;
- var processNamePath = [canonicalizeProcessName(rawProcessName)];
-
- customProcessDumpValueExtractor(
- processDump,
- function addProcessScalar(spec) {
- if (spec.value === undefined)
- return;
-
- var component = spec.component || [];
- function createDetailsForErrorMessage() {
- var propertyUserFriendlyName =
- spec.property === undefined ? '(undefined)' : spec.property;
- var componentUserFriendlyName =
- component.length === 0 ? '(empty)' : component.join(':');
- return ['source=', spec.source, ', property=',
- propertyUserFriendlyName, ', component=',
- componentUserFriendlyName, ' in ',
- processDump.process.userFriendlyName].join('');
- }
-
- var value, unit;
- if (spec.value instanceof ScalarNumeric) {
- value = spec.value.value;
- unit = spec.value.unit;
- if (spec.unit !== undefined) {
- throw new Error('ScalarNumeric value for ' +
- createDetailsForErrorMessage() + ' already specifies a unit');
- }
- } else {
- value = spec.value;
- unit = spec.unit;
- }
-
- var propertyToData = sourceToPropertyToData.get(spec.source);
- if (propertyToData === undefined) {
- propertyToData = new Map();
- sourceToPropertyToData.set(spec.source, propertyToData);
- }
-
- var data = propertyToData.get(spec.property);
- if (data === undefined) {
- data = {
- processAndComponentTreeBuilder:
- new tr.b.MultiDimensionalViewBuilder(
- 2 /* dimensions (process name and component path) */,
- dumpCount /* valueCount */),
- unit: unit,
- descriptionPrefixBuilder: spec.descriptionPrefixBuilder
- };
- propertyToData.set(spec.property, data);
- } else if (data.unit !== unit) {
- throw new Error('Multiple units provided for ' +
- createDetailsForErrorMessage() + ':' +
- data.unit.unitName + ' and ' + unit.unitName);
- } else if (data.descriptionPrefixBuilder !==
- spec.descriptionPrefixBuilder) {
- throw new Error(
- 'Multiple description prefix builders provided for' +
- createDetailsForErrorMessage());
- }
-
- var values = new Array(dumpCount);
- values[dumpIndex] = value;
-
- data.processAndComponentTreeBuilder.addPath(
- [processNamePath, component] /* path */, values,
- tr.b.MultiDimensionalViewBuilder.ValueKind.TOTAL /* valueKind */);
- });
- }
-
- function reportDataAsValues(sourceToPropertyToData, browserName,
- customComponentTreeModifier, values) {
- // For each source name (e.g. 'reported_by_os')...
- sourceToPropertyToData.forEach(function(propertyToData, sourceName) {
- // For each property name (e.g. 'effective_size')...
- propertyToData.forEach(function(data, propertyName) {
- var tree = data.processAndComponentTreeBuilder.buildTopDownTreeView();
- var unit = data.unit;
- var descriptionPrefixBuilder = data.descriptionPrefixBuilder;
-
- // Total over 'all' processes...
- customComponentTreeModifier(tree);
- reportComponentDataAsValues(browserName, sourceName,
- propertyName, 'all_processes', [] /* componentPath */, tree,
- unit, descriptionPrefixBuilder, values);
-
- // For each process name (e.g. 'renderer')...
- tree.children[0].forEach(function(processTree, processName) {
- if (processTree.children[0].size > 0) {
- throw new Error('Multi-dimensional view node for source=' +
- sourceName + ', property=' +
- (propertyName === undefined ? '(undefined)' : propertyName) +
- ', process=' + processName +
- ' has children wrt the process name dimension');
- }
- customComponentTreeModifier(processTree);
- reportComponentDataAsValues(browserName, sourceName,
- propertyName, processName, [] /* componentPath */, processTree,
- unit, descriptionPrefixBuilder, values);
- });
- });
- });
- }
-
- /**
- * For the given |browserName| (e.g. 'chrome'), |processName|
- * (e.g. 'gpu_process'), |propertyName| (e.g. 'effective_size'),
- * |componentPath| (e.g. ['v8']), add a tr.v.Numeric with |unit| aggregating
- * the total values of the associated |componentNode| across all timestamps
- * (corresponding to global memory dumps associated with the given browser)
- * to |values|.
- *
- * See addMemoryDumpValues for more details.
- */
- function reportComponentDataAsValues(
- browserName, sourceName, propertyName, processName, componentPath,
- componentNode, unit, descriptionPrefixBuilder, values) {
- // Construct the name of the memory value.
- var nameParts = ['memory', browserName, processName, sourceName].concat(
- componentPath);
- if (propertyName !== undefined)
- nameParts.push(propertyName);
- var name = nameParts.join(':');
-
- // Build the underlying numeric for the memory value.
- var numeric = buildMemoryNumericFromNode(componentNode, unit);
-
- // Build the options for the memory value.
- var description = [
- descriptionPrefixBuilder(componentPath, processName),
- 'in',
- convertBrowserNameToUserFriendlyName(browserName)
- ].join(' ');
- var options = { description: description };
-
- // Report the memory value.
- values.addValue(new tr.v.NumericValue(name, numeric, options));
-
- // Recursively report memory values for sub-components.
- var depth = componentPath.length;
- componentPath.push(undefined);
- componentNode.children[1].forEach(function(childNode, childName) {
- componentPath[depth] = childName;
- reportComponentDataAsValues(
- browserName, sourceName, propertyName, processName, componentPath,
- childNode, unit, descriptionPrefixBuilder, values);
- });
- componentPath.pop();
- }
-
- /**
- * Create a memory tr.v.Numeric (histogram) with |unit| and add all total
- * values in |node| to it.
- */
- function buildMemoryNumericFromNode(node, unit) {
- var numeric = MEMORY_NUMERIC_BUILDER_MAP.get(unit).build();
- node.values.forEach(v => numeric.add(v.total));
- return numeric;
- }
-
- tr.metrics.MetricRegistry.register(memoryMetric);
-
- return {
- memoryMetric: memoryMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html
deleted file mode 100644
index 500333d61f9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html
+++ /dev/null
@@ -1,2473 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/system_health/memory_metric.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/value.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
- var SIZE_DELTA = tr.model.MemoryDumpTestUtils.SIZE_DELTA;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addChildDump = tr.model.MemoryDumpTestUtils.addChildDump;
- var addOwnershipLink = tr.model.MemoryDumpTestUtils.addOwnershipLink;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
-
- function memoryMetricTest(name, modelCallback, expectedNumerics) {
- test(name, function() {
- // Create a model and a fake value list.
- var model = tr.c.TestUtils.newModel(modelCallback);
- var valueNameToValues = {};
- var fakeValueList = {
- addValue: function(value) {
- var values = valueNameToValues[value.name];
- if (values === undefined)
- valueNameToValues[value.name] = values = [];
- values.push(value);
- }
- };
-
- // Run the memory metric on the model.
- tr.metrics.sh.memoryMetric(fakeValueList, model);
-
- // Check that the names of the added values match expectations.
- var actualValueNames = Object.keys(valueNameToValues).sort();
- var expectedValueNames = Object.keys(expectedNumerics).sort();
- assert.deepEqual(actualValueNames, expectedValueNames, {
- // Build the long error message lazily.
- toString: function() {
- var errorMessageParts = [];
- function addValueNamesToError(type, valueNames, otherValueNames) {
- var otherValueNamesSet = new Set(otherValueNames);
- errorMessageParts.push(type, ' value names:');
- if (valueNames.length === 0) {
- errorMessageParts.push('\n(empty)');
- } else {
- valueNames.forEach(function(valueName) {
- errorMessageParts.push('\n');
- if (!otherValueNamesSet.has(valueName))
- errorMessageParts.push('+++');
- errorMessageParts.push(valueName);
- });
- }
- }
- addValueNamesToError('Expected', expectedValueNames,
- actualValueNames);
- errorMessageParts.push('\n');
- addValueNamesToError('Actual', actualValueNames, expectedValueNames);
- return errorMessageParts.join('');
- }
- });
-
- // Check that the numeric values of the added values match expectations.
- tr.b.iterItems(valueNameToValues, function(valueName, actualValues) {
- assert.lengthOf(actualValues, 1,
- 'Multiple \'' + valueName + '\' values');
- var actualValue = actualValues[0];
- assert.instanceOf(actualValue, tr.v.NumericValue);
-
- var actualNumeric = actualValue.numeric;
- var expectedNumeric = expectedNumerics[valueName];
- assert.strictEqual(actualNumeric.unit, expectedNumeric.unit,
- 'Invalid \'' + valueName + '\' unit (expected: ' +
- expectedNumeric.unit.unitName, + ', actual: ' +
- actualNumeric.unit.unitName + ')');
-
- if (typeof expectedNumeric.value === 'number') {
- // Scalar.
- assert.instanceOf(actualNumeric, tr.v.ScalarNumeric,
- 'Invalid \'' + valueName + '\' class');
- assert.closeTo(actualNumeric.value, expectedNumeric.value,
- SIZE_DELTA, 'Invalid \'' + valueName + '\' numeric value');
- } else if (expectedNumeric.value instanceof Array) {
- // Histogram.
- assert.instanceOf(actualNumeric, tr.v.Numeric,
- 'Invalid \'' + valueName + '\' class');
- assert.strictEqual(actualNumeric.numValues,
- expectedNumeric.value.length,
- 'Invalid \'' + valueName + '\' Numeric numValues');
- assert.closeTo(actualNumeric.sum,
- expectedNumeric.value.reduce((a, b) => a + b, 0), SIZE_DELTA,
- 'Invalid \'' + valueName + '\' Numeric sum');
-
- // Check that the bin counts match.
- var binToCount = new Map();
- expectedNumeric.value.forEach(function(value) {
- var bin = actualNumeric.getBinForValue(value);
- binToCount.set(bin, (binToCount.get(bin) || 0) + 1);
- });
- actualNumeric.allBins.forEach(function(bin) {
- binToCount.set(bin, (binToCount.get(bin) || 0) - bin.count);
- });
- binToCount.forEach(function(count, bin) {
- assert.strictEqual(count, 0, 'Invalid \'' + valueName +
- '\' bin count for range ' + bin.min + '-' + bin.max);
- });
- } else {
- assert.fail(
- 'Test sanity check: expected value must be a number or an array');
- }
-
- // Check that the description matches expectations.
- //if (expectedNumeric.description !== '')
- assert.strictEqual(
- actualValue.description, expectedNumeric.description,
- 'Invalid \'' + valueName + '\' description');
- });
- });
- }
-
- function createProcessWithName(model, name) {
- var uniquePid =
- Math.max.apply(null, Object.keys(model.processes).concat([0])) + 1;
- var process = model.getOrCreateProcess(uniquePid);
- process.name = name;
- return process;
- }
-
- function createChromeBrowserProcess(model) {
- var process = createProcessWithName(model, 'Browser');
- process.getOrCreateThread(1).name = 'CrBrowserMain';
- return process;
- }
-
- function createWebViewProcess(model) {
- var process = createChromeBrowserProcess(model);
- process.getOrCreateThread(2).name = 'Chrome_InProcRendererThread';
- return process;
- }
-
- memoryMetricTest('noDumps_noBrowser', function(model) {
- createProcessWithName(model, 'Non-browser');
- }, {
- /* no values */
- });
-
- memoryMetricTest('noDumps_chrome', function(model) {
- createChromeBrowserProcess(model);
- }, {
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- }
- });
-
- memoryMetricTest('noDumps_multipleBrowsers', function(model) {
- createChromeBrowserProcess(model);
- createWebViewProcess(model);
- createProcessWithName(model, 'Non-browser');
- createChromeBrowserProcess(model);
- }, {
- 'memory:chrome2:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome(2) ' +
- 'to the trace'
- },
- 'memory:chrome2:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome2:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:webview:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by WebView ' +
- 'to the trace'
- },
- 'memory:webview:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by WebView to ' +
- 'the trace'
- },
- 'memory:webview:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by WebView to the ' +
- 'trace'
- }
- });
-
- memoryMetricTest('dumpCountsOnly_unknownBrowser', function(model) {
- addGlobalMemoryDump(model, 45, DETAILED);
- addGlobalMemoryDump(model, 68, LIGHT);
- addGlobalMemoryDump(model, 89, DETAILED);
- }, {
- 'memory:unknown_browser:all_processes:dump_count:detailed': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by an ' +
- 'unknown browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count': {
- value: 3,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by an unknown ' +
- 'browser to the trace'
- }
- });
-
- memoryMetricTest('dumpCountsOnly_webview', function(model) {
- var p = createWebViewProcess(model);
- addProcessMemoryDump(addGlobalMemoryDump(model, 45, LIGHT), p, 45);
- addProcessMemoryDump(addGlobalMemoryDump(model, 68, LIGHT), p, 68);
- }, {
- 'memory:webview:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by WebView ' +
- 'to the trace'
- },
- 'memory:webview:all_processes:dump_count:light': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by WebView to ' +
- 'the trace'
- },
- 'memory:webview:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by WebView to the ' +
- 'trace'
- },
- 'memory:webview:all_processes:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in WebView'
- },
- 'memory:webview:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in WebView'
- }
- });
-
- memoryMetricTest('generalValues_chrome', function(model) {
- var pBrowser = createChromeBrowserProcess(model);
- var pRendererA = createProcessWithName(model, 'Renderer');
- var pRendererB = createProcessWithName(model, 'Renderer');
- var pPpapi = createProcessWithName(model, 'PPAPI Process');
- var pUnknown = createProcessWithName(model, undefined);
-
- // Timestamp 1.
- var gmd1 = addGlobalMemoryDump(model, 20);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pBrowser, 19);
- pmdBrowser1.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser1, 'malloc', {
- 'size': 8,
- 'allocated_objects_size': 4
- })
- ];
- var pmdRendererA1 = addProcessMemoryDump(gmd1, pRendererA, 20);
- pmdRendererA1.memoryAllocatorDumps = (function() {
- var mallocDump =
- newAllocatorDump(pmdRendererA1, 'malloc', { 'size': 16 });
- var partitionAllocDump =
- newAllocatorDump(pmdRendererA1, 'partition_alloc');
- addOwnershipLink(
- addChildDump(partitionAllocDump, 'allocated_objects', { 'size': 32 }),
- addChildDump(partitionAllocDump, 'partitions', { 'size': 24 }));
- return [mallocDump, partitionAllocDump];
- })();
- var pmdGpu1 = addProcessMemoryDump(gmd1, pPpapi, 21);
- pmdGpu1.memoryAllocatorDumps = [
- newAllocatorDump(pmdGpu1, 'gpu', {
- 'size': 30,
- 'allocated_objects_size': 25
- })
- ];
-
- // Timestamp 2.
- var gmd2 = addGlobalMemoryDump(model, 40);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pBrowser, 41);
- pmdBrowser2.memoryAllocatorDumps = (function() {
- var mallocDump = newAllocatorDump(pmdBrowser2, 'malloc', { 'size': 120 });
- var tracingDump =
- newAllocatorDump(pmdBrowser2, 'tracing', { 'size': 40 });
- return [mallocDump, tracingDump];
- })();
- var pmdRendererA2 = addProcessMemoryDump(gmd2, pRendererA, 39);
- pmdRendererA2.memoryAllocatorDumps = (function() {
- var partitionAllocDump =
- newAllocatorDump(pmdRendererA2, 'partition_alloc');
- addOwnershipLink(
- addChildDump(partitionAllocDump, 'allocated_objects',
- { 'size': 320 }),
- addChildDump(partitionAllocDump, 'partitions', { 'size': 240 }));
- var v8Dump = newAllocatorDump(pmdRendererA2, 'v8', { 'size': 650 });
- return [partitionAllocDump, v8Dump];
- })();
- var pmdRendererB2 = addProcessMemoryDump(gmd2, pRendererB, 40);
- pmdRendererB2.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererB2, 'v8', {
- 'size': 970,
- 'allocated_objects_size': 860
- }),
- newAllocatorDump(pmdRendererB2, 'malloc', {
- 'allocated_objects_size': 750
- })
- ];
- var pmdUnknown = addProcessMemoryDump(gmd2, pUnknown, 42);
- pmdUnknown.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererB2, 'v8', {
- 'size': 111
- })
- ];
-
- // Timestamp 3.
- var gmd3 = addGlobalMemoryDump(model, 60);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pBrowser, 60);
- pmdBrowser3.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser3, 'malloc', {
- 'size': 8000,
- 'allocated_objects_size': 4000
- })
- ];
- var pmdRendererB3 = addProcessMemoryDump(gmd3, pRendererB, 61);
- // Intentionally pmdRendererB3.memoryAllocatorDumps undefined.
- var pmdGpu3 = addProcessMemoryDump(gmd3, pPpapi, 59);
- pmdGpu3.memoryAllocatorDumps = [
- newAllocatorDump(pmdGpu3, 'gpu', { 'size': 300 })
- ];
-
- // Timestamp 4.
- var gmd4 = addGlobalMemoryDump(model, 80);
- var pmdBrowser4 = addProcessMemoryDump(gmd4, pBrowser, 81);
- pmdBrowser4.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser4, 'malloc', { 'size': 80000 })
- ];
- var pmdRendererB4 = addProcessMemoryDump(gmd4, pRendererB, 79);
- pmdRendererB4.memoryAllocatorDumps = (function() {
- var v8Dump = newAllocatorDump(pmdRendererB4, 'v8', { 'size': 9e5 });
- var partitionAllocDump = newAllocatorDump(pmdRendererB4,
- 'partition_alloc', { 'size': 5e5 });
- addOwnershipLink(partitionAllocDump, v8Dump);
- return [v8Dump, partitionAllocDump];
- })();
- var pmdGpu4 = addProcessMemoryDump(gmd4, pPpapi, 80);
- pmdGpu4.memoryAllocatorDumps = [
- newAllocatorDump(pmdGpu4, 'gpu', { 'memtrack_pss': 666 /* ignored */ })
- ];
- }, {
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 4,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 4,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:chrome:all_processes:process_count': {
- value: [3, 4, 3, 3],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:effective_size': {
- value: [30 + (8 + 16) + 32, (120 - 40) + 320 + (650 + 970) + 111,
- 300 + 8000, 80000 + 5e5 + 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:allocated_objects_size': {
- value: [25 + 4, 750 + 860, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:gpu:effective_size': {
- value: [30, 0, 300, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:gpu:allocated_objects_size':
- {
- value: [25, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by gpu in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [8 + 16, 120 - 40, 8000, 80000],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:allocated_objects_size':
- {
- value: [4, 750, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by malloc in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:partition_alloc:effective_size':
- {
- value: [32, 320, 0, 5e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of partition_alloc in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:tracing:effective_size': {
- value: [0, 40, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of tracing in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 650 + 970 + 111, 0, 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 860, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:browser_process:process_count': {
- value: [1, 1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:effective_size': {
- value: [8, (120 - 40), 8000, 80000],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:allocated_objects_size': {
- value: [4, 0, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [8, 120 - 40, 8000, 80000],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:allocated_objects_size':
- {
- value: [4, 0, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by malloc in the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:tracing:effective_size': {
- value: [0, 40, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of tracing in the browser process in Chrome'
- },
- 'memory:chrome:ppapi_process:process_count': {
- value: [1, 0, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of PPAPI processes in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:effective_size': {
- value: [30, 0, 300, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the PPAPI ' +
- 'process in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:allocated_objects_size': {
- value: [25, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for the PPAPI process in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:gpu:effective_size': {
- value: [30, 0, 300, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in the PPAPI process in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:gpu:allocated_objects_size':
- {
- value: [25, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by gpu in the PPAPI ' +
- 'process in Chrome'
- },
- 'memory:chrome:renderer_processes:process_count': {
- value: [1, 2, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:effective_size': {
- value: [16 + 32, 320 + 650 + 970, 0, 5e5 + 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:allocated_objects_size':
- {
- value: [0, 750 + 860, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by ' +
- 'Chrome for renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [16, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in renderer processes in ' +
- 'Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:malloc:allocated_objects_size':
- {
- value: [0, 750, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by malloc in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:partition_alloc:effective_size':
- {
- value: [32, 320, 0, 5e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of partition_alloc in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 650 + 970, 0, 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 860, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:unknown_processes:process_count': {
- value: [0, 1, 0, 0],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of unknown processes in Chrome'
- },
- 'memory:chrome:unknown_processes:reported_by_chrome:effective_size': {
- value: [0, 111, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for unknown ' +
- 'processes in Chrome'
- },
- 'memory:chrome:unknown_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 111, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in unknown processes in Chrome'
- },
- });
-
- memoryMetricTest('detailedValues_unknownBrowser', function(model) {
- var pBrowser = createProcessWithName(model, 'Browser');
- var pRendererA = createProcessWithName(model, 'Renderer');
- var pRendererB = createProcessWithName(model, 'Renderer');
- var pRendererC = createProcessWithName(model, 'Renderer');
- var pGpu = createProcessWithName(model, 'GPU Process');
-
- // Timestamp 1.
- var gmd1 = addGlobalMemoryDump(model, 10, DETAILED);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pBrowser, 9);
- pmdBrowser1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 128, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 8 })
- ]);
- var pmdRendererA1 = addProcessMemoryDump(gmd1, pRendererA, 10);
- pmdRendererA1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xEF01, 256, 0, '[anon:libc_malloc]',
- { 'privateDirtyResident': 17 })
- ]);
- var pmdRendererB1 = addProcessMemoryDump(gmd1, pRendererB, 11);
- pmdRendererB1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0x2345, 512, 0, '[heap]',
- { 'proportionalResident': 67, 'privateDirtyResident': 34 })
- ]);
- pmdRendererB1.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererA4, 'v8', { 'code_and_metadata_size': 16 })
- ];
- var pmdGpu1 = addProcessMemoryDump(gmd1, pGpu, 10);
- pmdGpu1.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu1, 'gpu');
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack');
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 100 });
- addChildDump(memtrackDump, 'graphics', { 'memtrack_pss': 200 });
- return [gpuDump];
- })();
-
- // Timestamp 2 (light global memory dump, so it should be skipped for
- // mmaps_* values).
- var gmd2 = addGlobalMemoryDump(model, 20, LIGHT);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pBrowser, 18);
- pmdBrowser2.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0x999, 999, 999, '/dev/ashmem/dalvik-main space',
- { 'proportionalResident': 999 })
- ]);
- var pmdRendererA2 = addProcessMemoryDump(gmd2, pRendererA, 19);
- pmdRendererA2.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererA4, 'v8', {
- 'bytecode_and_metadata_size': 678
- })
- ];
- var pmdRendererB2 = addProcessMemoryDump(gmd2, pRendererB, 21);
- var pmdRendererC2 = addProcessMemoryDump(gmd2, pRendererC, 22);
- var pmdGpu2 = addProcessMemoryDump(gmd2, pGpu, 20);
- pmdGpu2.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu2, 'gpu');
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack');
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 12345 });
- return [gpuDump];
- })();
-
- // Timestamp 3.
- var gmd3 = addGlobalMemoryDump(model, 30, DETAILED);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pBrowser, 30);
- pmdBrowser3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 1024, 0, '/dev/ashmem/dalvik-non moving space',
- { 'proportionalResident': 3, 'privateDirtyResident': 80 })
- ]);
- var pmdRendererA3 = addProcessMemoryDump(gmd3, pRendererA, 29);
- // Intentionally pmdRendererA3.vmRegions undefined.
- var pmdRendererC3 = addProcessMemoryDump(gmd3, pRendererC, 31);
- pmdRendererC3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0x2345, 2048, 0, '/no/matching/category',
- { 'proportionalResident': 200 }),
- new VMRegion(0x2345, 2048, 0, '/dev/ashmem',
- { 'proportionalResident': 500 }),
- ]);
- var pmdGpu3 = addProcessMemoryDump(gmd3, pGpu, 30);
- pmdGpu3.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu3, 'gpu',
- { 'memtrack_pss': 6000 /* ignored */ });
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack',
- { 'memtrack_pss': 5000 /* ignored */ });
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 3000 });
- addChildDump(memtrackDump, 'graphics', { 'ignored': 2000 });
- addChildDump(memtrackDump, 'gfx', { 'memtrack_pss': 1000 });
- return [gpuDump];
- })();
- pmdGpu3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xCDCD, 4096, 0, '/dev/ashmem/dalvik-zygote space',
- { 'proportionalResident': 150, 'privateDirtyResident': 90 })
- ]);
-
- // Timestamp 4.
- var gmd4 = addGlobalMemoryDump(model, 40, DETAILED);
- var pmdBrowser4 = addProcessMemoryDump(gmd4, pBrowser, 40);
- var pmdRendererA4 = addProcessMemoryDump(gmd4, pRendererA, 40);
- pmdRendererA4.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererA4, 'v8', {
- 'code_and_metadata_size': 21,
- 'bytecode_and_metadata_size': 35
- })
- ];
- }, {
- 'memory:unknown_browser:all_processes:dump_count:detailed': {
- value: 3,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by an ' +
- 'unknown browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count': {
- value: 4,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:process_count': {
- value: [4, 5, 4, 2],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome ' +
- 'for all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [100 + 200, 3000 + 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:gfx:proportional_resident_size':
- {
- value: [0, 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gfx Android ' +
- 'memtrack component in all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [100, 3000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:graphics:proportional_resident_size':
- {
- value: [200, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the graphics ' +
- 'Android memtrack component in all processes in an unknown ' +
- 'browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:private_dirty_size': {
- value: [17 + 34 + 8, 80 + 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:proportional_resident_size':
- {
- value: [67 + 100 + 200, 700 + 3 + 1000 + 150 + 3000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [17 + 34 + 8, 80 + 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [67, 700 + 3 + 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 500, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8, 80 + 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 3 + 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [67, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:process_count': {
- value: [1, 1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:private_dirty_size':
- {
- value: [8, 80, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:proportional_resident_size':
- {
- value: [0, 3, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [8, 80, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 3, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8, 80, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 3, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:process_count': {
- value: [1, 1, 1, 0],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of GPU processes in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:proportional_resident_size':
- {
- value: [100 + 200, 3000 + 1000 + 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:private_dirty_size': {
- value: [0, 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the GPU ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [100 + 200, 3000 + 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:gfx:proportional_resident_size':
- {
- value: [0, 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gfx Android ' +
- 'memtrack component in the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [100, 3000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:graphics:proportional_resident_size':
- {
- value: [200, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the graphics ' +
- 'Android memtrack component in the GPU process in an unknown ' +
- 'browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [0, 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the GPU process in ' +
- 'an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [0, 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the GPU ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the GPU ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:process_count': {
- value: [2, 3, 2, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_chrome:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome ' +
- 'for renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in renderer processes ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for ' +
- 'renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:proportional_resident_size':
- {
- value: [67, 700, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [67, 700, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in renderer processes ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 500, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in ' +
- 'renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in renderer ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in renderer ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [67, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in renderer processes in an unknown browser'
- }
- });
-
- memoryMetricTest('combined_chrome', function(model) {
- var pBrowser = createChromeBrowserProcess(model);
-
- // Timestamp 1.
- var gmd1 = addGlobalMemoryDump(model, 10, DETAILED);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pBrowser, 10);
- pmdBrowser1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 128, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 100 })
- ]);
-
- // Timestamp 2 (light global memory dump, so it should be skipped for
- // mmaps_* values).
- var gmd2 = addGlobalMemoryDump(model, 20, LIGHT);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pBrowser, 20);
- pmdBrowser2.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser2, 'malloc', { size: 32 })
- ];
-
- // Timestamp 3.
- var gmd3 = addGlobalMemoryDump(model, 30, DETAILED);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pBrowser, 30);
- pmdBrowser3.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser3, 'malloc', { size: 48 })
- ];
- pmdBrowser3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 1024, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 150 })
- ]);
- }, {
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 3,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:chrome:all_processes:process_count': {
- value: [1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:private_dirty_size': {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:proportional_resident_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in Chrome'
- },
- 'memory:chrome:browser_process:process_count': {
- value: [1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:private_dirty_size': {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:proportional_resident_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in Chrome'
- }
- });
-
- memoryMetricTest('combined_multipleBrowsers', function(model) {
- var pWebView = createWebViewProcess(model);
- var pChrome1 = createChromeBrowserProcess(model);
- var pRenderer1 = createProcessWithName(model, 'Renderer');
- var pGpu1 = createProcessWithName(model, 'GPU Process');
- var pUnknownBrowser = createProcessWithName(model, 'Browser');
- var pChrome2 = createChromeBrowserProcess(model);
- var pRenderer2 = createProcessWithName(model, 'Renderer');
-
- // Timestamp 1 (WebView).
- var gmd1 = addGlobalMemoryDump(model, 0, LIGHT);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pWebView, 0);
- pmdBrowser1.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser1, 'malloc', { size: 2 }),
- newAllocatorDump(pmdBrowser1, 'v8', { size: 4 })
- ];
-
- // Timestamp 2 (Chrome 1 + Renderer + GPU Process).
- var gmd2 = addGlobalMemoryDump(model, 10, DETAILED);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pChrome1, 12);
- pmdBrowser2.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 9999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 8 })
- ]);
- var pmdGpu2 = addProcessMemoryDump(gmd2, pGpu1, 8);
- pmdGpu2.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 9999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 16 })
- ]);
- var pmdRenderer2 = addProcessMemoryDump(gmd2, pRenderer1, 8);
- pmdRenderer2.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser2, 'malloc', { size: 32 })
- ];
-
- // Timestamp 3 (Chrome 2).
- var gmd3 = addGlobalMemoryDump(model, 20, DETAILED);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pChrome2, 20);
- pmdBrowser3.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser3, 'malloc', { size: 64 }),
- newAllocatorDump(pmdBrowser3, 'sqlite', { size: 128 }),
- newAllocatorDump(pmdBrowser3, 'discardable', {
- size: 8388608,
- locked_size: 4194304
- })
- ];
- pmdBrowser3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 99, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 256 })
- ]);
-
- // Timestamp 4 (Chrome 2 + Renderer).
- var gmd4 = addGlobalMemoryDump(model, 30, LIGHT);
- var pmdBrowser4 = addProcessMemoryDump(gmd4, pChrome2, 28);
- pmdBrowser4.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser4, 'malloc', { size: 512 }),
- newAllocatorDump(pmdBrowser3, 'discardable', { size: 16777216 })
- ];
- var pmdRenderer4 = addProcessMemoryDump(gmd4, pRenderer2, 32);
- pmdRenderer4.memoryAllocatorDumps = [
- newAllocatorDump(pmdRenderer4, 'malloc', { size: 1024 }),
- newAllocatorDump(pmdRenderer4, 'v8', { size: 2048 })
- ];
-
- // Timestamp 5 (Unknown browser).
- var gmd5 = addGlobalMemoryDump(model, 40, LIGHT);
- var pmdBrowser5 = addProcessMemoryDump(gmd5, pUnknownBrowser, 40);
- pmdBrowser5.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser5, 'malloc', { size: 4096 }),
- newAllocatorDump(pmdBrowser5, 'sqlite', { size: 8192 }),
- ];
-
- // Timestamp 6 (WebView).
- var gmd6 = addGlobalMemoryDump(model, 50, DETAILED);
- var pmdBrowser6 = addProcessMemoryDump(gmd6, pWebView, 50);
- pmdBrowser6.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser6, 'malloc', { size: 16384 }),
- newAllocatorDump(pmdBrowser6, 'v8', {
- 'allocated_objects_size': 32768,
- 'code_and_metadata_size': 33554432,
- 'size': 67108864
- })
- ];
- pmdBrowser6.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 99999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 65536 })
- ]);
-
- // Timestamp 7 (Chrome 1 + GPU Process).
- var gmd7 = addGlobalMemoryDump(model, 60, DETAILED);
- var pmdBrowser7 = addProcessMemoryDump(gmd7, pChrome1, 63);
- pmdBrowser7.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser4, 'malloc', { size: 131072 }),
- newAllocatorDump(pmdBrowser4, 'sqlite', { size: 262144 })
- ];
- pmdBrowser7.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 999999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 524288 })
- ]);
- var pmdGpu7 = addProcessMemoryDump(gmd7, pGpu1, 57);
- pmdGpu7.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu7, 'gpu', { 'size': 1048576 });
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack');
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 2097152 });
- return [gpuDump];
- })();
- }, {
- // WebView (GMD1, GMD6).
- 'memory:webview:all_processes:dump_count:detailed': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by WebView ' +
- 'to the trace'
- },
- 'memory:webview:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by WebView to ' +
- 'the trace'
- },
- 'memory:webview:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by WebView to the ' +
- 'trace'
- },
- 'memory:webview:all_processes:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:effective_size': {
- value: [4 + 2, 16384 + 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:code_and_metadata_size': {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome for ' +
- 'all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:allocated_objects_size': {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [2, 16384],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:v8:effective_size': {
- value: [4, 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in all processes in ' +
- 'WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in all processes ' +
- 'in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:private_dirty_size': {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:proportional_resident_size': {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in ' +
- 'WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in WebView'
- },
- 'memory:webview:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:effective_size': {
- value: [4 + 2, 16384 + 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:allocated_objects_size':
- {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by ' +
- 'Chrome for the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:code_and_metadata_size':
- {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome ' +
- 'for the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [2, 16384],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:v8:effective_size': {
- value: [4, 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in the browser process ' +
- 'in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:private_dirty_size': {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in WebView'
- },
-
- // Chrome 1 (GMD3, GMD4).
- 'memory:chrome:all_processes:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in all processes in Chrome'
- },
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:chrome:all_processes:process_count': {
- value: [3, 2],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:effective_size': {
- value: [32, 1048576 + 131072 + 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:gpu:effective_size': {
- value: [0, 1048576],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [32, 131072],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:sqlite:effective_size': {
- value: [0, 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:private_dirty_size': {
- value: [8 + 16, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:proportional_resident_size': {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8 + 16, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [8 + 16, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in Chrome'
- },
- 'memory:chrome:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:effective_size': {
- value: [0, 131072 + 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [0, 131072],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:sqlite:effective_size': {
- value: [0, 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:private_dirty_size': {
- value: [8, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:proportional_resident_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [8, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_chrome:effective_size': {
- value: [0, 1048576],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of GPU processes in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_chrome:gpu:effective_size': {
- value: [0, 1048576],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:private_dirty_size': {
- value: [16, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:proportional_resident_size': {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the GPU process in ' +
- 'Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [16, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [16, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the GPU process in Chrome'
- },
- 'memory:chrome:renderer_processes:process_count': {
- value: [1, 0],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:effective_size': {
- value: [32, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [32, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in renderer processes in ' +
- 'Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:private_dirty_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in renderer processes ' +
- 'in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in ' +
- 'renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by renderer processes in Chrome'
- },
-
- // Chrome 2 (GMD2, GMD7).
- 'memory:chrome2:all_processes:dump_count:detailed': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome(2) ' +
- 'to the trace'
- },
- 'memory:chrome2:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome2:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome2:all_processes:process_count': {
- value: [1, 2],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:discardable:effective_size':
- {
- value: [8388608, 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of discardable in all processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:locked_size': {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total locked (pinned) size reported by Chrome for all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:discardable:locked_size': {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'locked (pinned) size of discardable in all processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:effective_size': {
- value: [64 + 8388608 + 128, 512 + 1024 + 2048 + 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [64, 512 + 1024],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:sqlite:effective_size': {
- value: [128, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 2048],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:private_dirty_size': {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:proportional_resident_size': {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in Chrome(2)'
- },
- 'memory:chrome2:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:effective_size': {
- value: [64 + 8388608 + 128, 512 + 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:locked_size': {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total locked (pinned) size reported by Chrome for the ' +
- 'browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [64, 512],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:discardable:effective_size':
- {
- value: [8388608, 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of discardable in the browser process ' +
- 'in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:discardable:locked_size':
- {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'locked (pinned) size of discardable in the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:sqlite:effective_size': {
- value: [128, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in the browser process in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:private_dirty_size': {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:process_count': {
- value: [0, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:reported_by_chrome:effective_size': {
- value: [0, 1024 + 2048],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for renderer ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [0, 1024],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in renderer processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 2048],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in renderer processes in Chrome(2)'
- },
-
- // Unknown browser (GMD5).
- 'memory:unknown_browser:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by an ' +
- 'unknown browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:process_count': {
- value: [1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:effective_size': {
- value: [4096 + 8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [4096],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:sqlite:effective_size':
- {
- value: [8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:browser_process:process_count': {
- value: [1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_chrome:effective_size':
- {
- value: [4096 + 8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the ' +
- 'browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_chrome:malloc:effective_size':
- {
- value: [4096],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in ' +
- 'an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_chrome:sqlite:effective_size':
- {
- value: [8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in the browser process in ' +
- 'an unknown browser'
- }
- });
-
- test('dumpIdBrowserClashThrows', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var pWebView = createWebViewProcess(model);
- var pChrome = createChromeBrowserProcess(model);
-
- var gmd = addGlobalMemoryDump(model, 10);
- addProcessMemoryDump(gmd, pWebView, 9);
- addProcessMemoryDump(gmd, pChrome, 11);
- });
- var values = new tr.v.ValueSet();
-
- assert.throws(function() {
- tr.metrics.sh.memoryMetric(values, model);
- }, 'Memory dump ID clash across multiple browsers with PIDs: 1 and 2');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html
deleted file mode 100644
index eec9635a5a5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/clock_sync_latency_metric.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
-
- var IDEAL_FRAME_RATE = 60;
- var IDEAL_FRAME_DURATION = 1000 / IDEAL_FRAME_RATE;
-
- function energyConsumedPerFrame(valueList, model) {
- var frameEnergyConsumed = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.energyInJoules_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, .5), 20).build();
- var frameStartTs = parseFloat(model.device.powerSeries.samples[0].start);
- while (model.device.powerSeries.getSamplesWithinRange(
- frameStartTs, frameStartTs + IDEAL_FRAME_DURATION).length) {
- var currentFrameEnergy = model.device.powerSeries.getEnergyConsumed(
- frameStartTs, frameStartTs + IDEAL_FRAME_DURATION);
- frameStartTs += IDEAL_FRAME_DURATION;
- frameEnergyConsumed.add(currentFrameEnergy);
- }
-
- valueList.addValue(new tr.v.NumericValue(
- 'energy_consumed_per_frame', frameEnergyConsumed,
- {description: 'Energy consumption per frame in joules'}));
- }
-
- function powerMetric(valueList, model) {
- // TODO(alexandermont): Once it's possible to specify multiple metrics
- // in a Telemetry benchmark, separate out this metric from the power
- // metric and have the benchmark use both.
- // (See: https://github.com/catapult-project/catapult/issues/2430.)
- tr.metrics.sh.clockSyncLatencyMetric(valueList, model);
- if (!model.device.powerSeries)
- return;
- energyConsumedPerFrame(valueList, model);
- }
-
- tr.metrics.MetricRegistry.register(powerMetric);
-
- return {
- powerMetric: powerMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html
deleted file mode 100644
index bdc034e63a7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/system_health/power_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('powerMetric_multipleFrames', function() {
- var model = new tr.Model();
- var valueSet = new tr.v.ValueSet();
- model.device.powerSeries = new tr.model.PowerSeries(model.device);
- // We want values in different frames, so they must go up by more than 16.66
- // milliseconds.
- model.device.powerSeries.addPowerSample('1', '.1');
- model.device.powerSeries.addPowerSample('2', '.1');
- model.device.powerSeries.addPowerSample('18', '.2');
- model.device.powerSeries.addPowerSample('36', '.3');
- model.device.powerSeries.addPowerSample('53', '.4');
- model.device.powerSeries.addPowerSample('70', '.5');
- tr.metrics.sh.powerMetric(valueSet, model);
- var powerEntries = valueSet.valueDicts.filter(
- (dict) => dict.name === 'energy_consumed_per_frame');
- var powerEntry = tr.b.getOnlyElement(powerEntries);
- assert.equal(powerEntry.numeric.centralBins[0].count, 5);
- assert.closeTo(powerEntry.numeric.running.sum, 0.0172, 1e-4);
- });
-
- test('powerMetric_oneFrame', function() {
- var model = new tr.Model();
- var valueSet = new tr.v.ValueSet();
- model.device.powerSeries = new tr.model.PowerSeries(model.device);
- // We want values in the same frame, so they must go up by less than 16.66
- // milliseconds.
- model.device.powerSeries.addPowerSample('1', '.1');
- model.device.powerSeries.addPowerSample('2', '.1');
- model.device.powerSeries.addPowerSample('3', '.2');
- model.device.powerSeries.addPowerSample('4', '.3');
- model.device.powerSeries.addPowerSample('5', '.4');
- model.device.powerSeries.addPowerSample('6', '.5');
- tr.metrics.sh.powerMetric(valueSet, model);
- var powerEntries = valueSet.valueDicts.filter(
- (dict) => dict.name === 'energy_consumed_per_frame');
- var powerEntry = tr.b.getOnlyElement(powerEntries);
- assert.equal(powerEntry.numeric.centralBins[0].count, 1);
- assert.closeTo(powerEntry.numeric.running.sum, 0.0011, 1e-4);
- });
-
- test('powerMetric_noPowerSeries', function() {
- var model = new tr.Model();
- var valueSet = new tr.v.ValueSet();
- tr.metrics.sh.powerMetric(valueSet, model);
- var powerEntries = valueSet.valueDicts.filter(
- (dict) => dict.name === 'energy_consumed_per_frame');
- assert.lengthOf(powerEntries, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html
deleted file mode 100644
index 5098c535277..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/user_model/animation_expectation.html">
-<link rel="import" href="/tracing/model/user_model/load_expectation.html">
-<link rel="import" href="/tracing/model/user_model/response_expectation.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- // In the case of Response, Load, and DiscreteAnimation IRs, Responsiveness is
- // derived from the time between when the user thinks they begin an interation
- // (expectedStart) and the time when the screen first changes to reflect the
- // interaction (actualEnd). There may be a delay between expectedStart and
- // when chrome first starts processing the interaction (actualStart) if the
- // main thread is busy. The user doesn't know when actualStart is, they only
- // know when expectedStart is. User responsiveness, by definition, considers
- // only what the user experiences, so "duration" is defined as actualEnd -
- // expectedStart.
-
- function computeAnimationThroughput(animationExpectation) {
- if (animationExpectation.frameEvents === undefined ||
- animationExpectation.frameEvents.length === 0)
- throw new Error('Animation missing frameEvents ' +
- animationExpectation.stableId);
-
- var durationSeconds = animationExpectation.duration / 1000;
- return animationExpectation.frameEvents.length / durationSeconds;
- }
-
- function computeAnimationframeTimeDiscrepancy(animationExpectation) {
- if (animationExpectation.frameEvents === undefined ||
- animationExpectation.frameEvents.length === 0)
- throw new Error('Animation missing frameEvents ' +
- animationExpectation.stableId);
-
- var frameTimestamps = animationExpectation.frameEvents;
- frameTimestamps = frameTimestamps.toArray().map(function(event) {
- return event.start;
- });
-
- var absolute = false;
- return tr.b.Statistics.timestampsDiscrepancy(frameTimestamps, absolute);
- }
-
- var RESPONSE_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(100, 1000), 90);
-
- var THROUGHPUT_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_biggerIsBetter,
- tr.b.Range.fromExplicitRange(10, 60), 10);
-
- var DISCREPANCY_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 1), 50);
-
- var LATENCY_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 300), 60);
-
- /**
- * @param {!tr.v.ValueSet} values
- * @param {!tr.model.Model} model
- * @param {!Object=} opt_options
- */
- function responsivenessMetric(values, model, opt_options) {
- // TODO(benjhayden): Add categories to benchmark to support:
- // tr.metrics.sh.firstPaintMetric(values, model);
-
- var responseNumeric = RESPONSE_NUMERIC_BUILDER.build();
- var throughputNumeric = THROUGHPUT_NUMERIC_BUILDER.build();
- var frameTimeDiscrepancyNumeric = DISCREPANCY_NUMERIC_BUILDER.build();
- var latencyNumeric = LATENCY_NUMERIC_BUILDER.build();
-
- model.userModel.expectations.forEach(function(ue) {
- if (opt_options && opt_options.rangeOfInterest &&
- !opt_options.rangeOfInterest.intersectsExplicitRangeExclusive(
- ue.start, ue.end))
- return;
-
- var sourceInfo = {userExpectationId: ue.stableId};
-
- // Responsiveness is not defined for Idle.
- if (ue instanceof tr.model.um.IdleExpectation) {
- return;
- } else if (ue instanceof tr.model.um.LoadExpectation) {
- // This is already covered by firstPaintMetric.
- } else if (ue instanceof tr.model.um.ResponseExpectation) {
- responseNumeric.add(ue.duration, sourceInfo);
- } else if (ue instanceof tr.model.um.AnimationExpectation) {
- var throughput = computeAnimationThroughput(ue);
- if (throughput === undefined)
- throw new Error('Missing throughput for ' +
- ue.stableId);
-
- throughputNumeric.add(throughput, sourceInfo);
-
- var frameTimeDiscrepancy = computeAnimationframeTimeDiscrepancy(ue);
- if (frameTimeDiscrepancy === undefined)
- throw new Error('Missing frameTimeDiscrepancy for ' +
- ue.stableId);
-
- frameTimeDiscrepancyNumeric.add(frameTimeDiscrepancy, sourceInfo);
-
- ue.associatedEvents.forEach(function(event) {
- if (!(event instanceof tr.e.cc.InputLatencyAsyncSlice))
- return;
-
- latencyNumeric.add(event.duration, sourceInfo);
- });
- } else {
- throw new Error('Unrecognized stage for ' + ue.stableId);
- }
- });
-
- [
- responseNumeric, throughputNumeric, frameTimeDiscrepancyNumeric,
- latencyNumeric
- ].forEach(function(numeric) {
- numeric.customizeSummaryOptions({
- avg: true,
- max: true,
- min: true,
- std: true
- });
- });
-
- values.addValue(new tr.v.NumericValue(
- 'response latency', responseNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation throughput', throughputNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation frameTimeDiscrepancy',
- frameTimeDiscrepancyNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation latency', latencyNumeric));
- }
-
- tr.metrics.MetricRegistry.register(responsivenessMetric, {
- supportsRangeOfInterest: true
- });
-
- return {
- responsivenessMetric: responsivenessMetric,
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html
deleted file mode 100644
index 723e526b554..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 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/metrics/system_health/efficiency_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/hazard_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/long_tasks_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/power_metric.html"
-<link rel="import"
- href="/tracing/metrics/system_health/responsiveness_metric.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- function systemHealthMetrics(values, model) {
- tr.metrics.sh.responsivenessMetric(values, model);
- tr.metrics.sh.efficiencyMetric(values, model);
- tr.metrics.sh.longTasksMetric(values, model);
- tr.metrics.sh.hazardMetric(values, model);
- tr.metrics.sh.powerMetric(values, model);
- }
-
- tr.metrics.MetricRegistry.register(systemHealthMetrics);
-
- return {
- systemHealthMetrics: systemHealthMetrics
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html
deleted file mode 100644
index 9e0d09bd32f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 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/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- // Returns a weight for this score.
- // score should be a number between 0 and 1 inclusive.
- // This function is expected to be passed to tr.b.Statistics.weightedMean as
- // its weightCallback.
- function perceptualBlend(ir, index, score) {
- // Lower scores are exponentially more important than higher scores
- // due to the Peak-end rule.
- // Other than that general rule, there is no specific reasoning behind this
- // specific formula -- it is fairly arbitrary.
- return Math.exp(1 - score);
- }
-
- function filterExpectationsByRange(irs, opt_range) {
- var filteredExpectations = [];
- irs.forEach(function(ir) {
- if (!(ir instanceof tr.model.um.UserExpectation))
- return;
-
- if (!opt_range ||
- opt_range.intersectsExplicitRangeExclusive(ir.start, ir.end))
- filteredExpectations.push(ir);
- });
- return filteredExpectations;
- }
-
- return {
- perceptualBlend: perceptualBlend,
- filterExpectationsByRange: filterExpectationsByRange
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html
deleted file mode 100644
index 10e873b97f5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- function webviewStartupMetric(values, model) {
- for (var slice of model.getDescendantEvents()) {
- // WebViewStartupInterval is the title of the section of code that is
- // entered (via android.os.Trace.beginSection) when WebView is started
- // up. This value is defined in TelemetryActivity.java.
- if (!(slice instanceof tr.model.Slice))
- return;
- if (slice.title === 'WebViewStartupInterval') {
- values.addValue(new tr.v.NumericValue(
- 'webview_startup_wall_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.duration),
- { description: 'WebView startup wall time' }));
- values.addValue(new tr.v.NumericValue(
- 'webview_startup_cpu_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.cpuDuration),
- { description: 'WebView startup CPU time' }));
- }
- // WebViewBlankUrlLoadInterval is the title of the section of code
- // that is entered (via android.os.Trace.beginSection) when WebView
- // is started up. This value is defined in TelemetryActivity.java.
- if (slice.title === 'WebViewBlankUrlLoadInterval') {
- values.addValue(new tr.v.NumericValue(
- 'webview_url_load_wall_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.duration),
- { description: 'WebView blank URL load wall time' }));
- values.addValue(new tr.v.NumericValue(
- 'webview_url_load_cpu_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.cpuDuration),
- { description: 'WebView blank URL load CPU time' }));
- }
- }
- };
-
- tr.metrics.MetricRegistry.register(webviewStartupMetric);
-
- return {
- webviewStartupMetric: webviewStartupMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html
deleted file mode 100644
index fa4da093afc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/system_health/webview_startup_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-function makeTestModel() {
- return tr.c.TestUtils.newModel(function(model) {
- var mainThread = model.getOrCreateProcess(1).getOrCreateThread(2);
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'webview',
- title: 'WebViewStartupInterval',
- start: 200,
- duration: 42.0,
- cpuStart: 150,
- cpuDuration: 32.0
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'webview',
- title: 'WebViewBlankUrlLoadInterval',
- start: 250,
- duration: 27.0,
- cpuStart: 190,
- cpuDuration: 17.0
- }));
- });
-}
-
-tr.b.unittest.testSuite(function() {
- test('webviewStartupMetric_allIntervals', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.lengthOf(values.valueDicts, 4);
- });
-
- test('webviewStartupMetric_startupWallInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[0].numeric.value, 42);
- });
-
- test('webviewStartupMetric_startupCpuInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[1].numeric.value, 32);
- });
-
- test('webviewStartupMetric_urlLoadWallInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[2].numeric.value, 27);
- });
-
- test('webviewStartupMetric_urlLoadCpuInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[3].numeric.value, 17);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html
deleted file mode 100644
index f47020e25b7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html
+++ /dev/null
@@ -1,189 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/iteration_helpers.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
- var MEMORY_INFRA_TRACING_CATEGORY = 'disabled-by-default-memory-infra';
-
- function addTimeDurationValue(valueName, duration, allValues) {
- var scalarNumericValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, duration);
- var numericValue = new tr.v.NumericValue(valueName, scalarNumericValue);
- allValues.addValue(numericValue);
- }
-
- // Adds values specific to memory-infra dumps.
- function addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes) {
- var memoryDumpCount = model.globalMemoryDumps.length;
- if (memoryDumpCount === 0)
- return;
-
- var totalOverhead = 0;
- var nonMemoryInfraThreadOverhead = 0;
- var overheadByProvider = {};
- tr.b.iterItems(model.processes, function(pid, process) {
- tr.b.iterItems(process.threads, function(tid, thread) {
- tr.b.iterItems(thread.sliceGroup.slices, function(slice_id, slice) {
- if (slice.category !== MEMORY_INFRA_TRACING_CATEGORY)
- return;
- totalOverhead += slice.duration;
- if (thread.name !== 'MemoryInfra')
- nonMemoryInfraThreadOverhead += slice.duration;
- if (slice.args && slice.args['dump_provider.name']) {
- var providerName = slice.args['dump_provider.name'];
- overheadByProvider[providerName] =
- (overheadByProvider[providerName] || 0) + slice.duration;
- }
- });
- });
- });
-
- addTimeDurationValue(
- 'Average CPU overhead on all threads per memory-infra dump',
- totalOverhead / memoryDumpCount, values);
- addTimeDurationValue(
- 'Average CPU overhead on non-memory-infra threads per memory-infra ' +
- 'dump',
- nonMemoryInfraThreadOverhead / memoryDumpCount, values);
- tr.b.iterItems(overheadByProvider, function(providerName, overhead) {
- addTimeDurationValue(
- 'Average CPU overhead of ' + providerName + ' per memory-infra dump',
- overhead / memoryDumpCount, values);
- });
-
- var memoryInfraEventsSize =
- categoryNamesToTotalEventSizes.get(MEMORY_INFRA_TRACING_CATEGORY);
- var memoryInfraTraceBytesValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, memoryInfraEventsSize);
- values.addValue(new tr.v.NumericValue(
- 'Total trace size of memory-infra dumps in bytes',
- memoryInfraTraceBytesValue));
-
- var traceBytesPerDumpValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter,
- memoryInfraEventsSize / memoryDumpCount);
- values.addValue(new tr.v.NumericValue(
- 'Average trace size of memory-infra dumps in bytes',
- traceBytesPerDumpValue));
- }
-
- function tracingMetric(values, model) {
- if (!model.stats.hasEventSizesinBytes) {
- throw new Error('Model stats does not have event size information. ' +
- 'Please enable ImportOptions.trackDetailedModelStats.');
- }
-
- var eventStats = model.stats.allTraceEventStatsInTimeIntervals;
- eventStats.sort(function(a, b) {
- return a.timeInterval - b.timeInterval;
- });
-
- var totalTraceBytes = eventStats.reduce((a, b) =>
- (a + b.totalEventSizeinBytes), 0);
-
- // We maintain a sliding window of records [start ... end-1] where end
- // increments each time through the loop, and we move start just far enough
- // to keep the window less than 1 second wide. Note that we need to compute
- // the number of time intervals (i.e. units that timeInterval is given in)
- // in one second to know how wide the sliding window should be.
- var maxEventCountPerSec = 0;
- var maxEventBytesPerSec = 0;
- var INTERVALS_PER_SEC = Math.floor(
- 1000 / model.stats.TIME_INTERVAL_SIZE_IN_MS);
-
- var runningEventNumPerSec = 0;
- var runningEventBytesPerSec = 0;
- var start = 0;
- var end = 0;
-
- while (end < eventStats.length) {
- // Slide the end marker forward. Moving the end marker from N
- // to N+1 adds eventStats[N] to the sliding window.
- runningEventNumPerSec += eventStats[end].numEvents;
- runningEventBytesPerSec += eventStats[end].totalEventSizeinBytes;
- end++;
-
- // Slide the start marker forward so that the time interval covered
- // by the window is less than 1 second wide.
- while ((eventStats[end - 1].timeInterval -
- eventStats[start].timeInterval) >= INTERVALS_PER_SEC) {
- runningEventNumPerSec -= eventStats[start].numEvents;
- runningEventBytesPerSec -= eventStats[start].totalEventSizeinBytes;
- start++;
- }
-
- // Update maximum values.
- maxEventCountPerSec = Math.max(maxEventCountPerSec,
- runningEventNumPerSec);
- maxEventBytesPerSec = Math.max(maxEventBytesPerSec,
- runningEventBytesPerSec);
-
- }
-
- var stats = model.stats.allTraceEventStats;
- var categoryNamesToTotalEventSizes = (
- stats.reduce((map, stat) => (
- map.set(stat.category,
- ((map.get(stat.category) || 0) +
- stat.totalEventSizeinBytes))), new Map()));
-
- // Determine the category with the highest total event size.
- var maxCatNameAndBytes = Array.from(
- categoryNamesToTotalEventSizes.entries()).reduce(
- (a, b) => (b[1] >= a[1]) ? b : a);
- var maxEventBytesPerCategory = maxCatNameAndBytes[1];
- var categoryWithMaxEventBytes = maxCatNameAndBytes[0];
-
- var maxEventCountPerSecValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter, maxEventCountPerSec);
- var maxEventBytesPerSecValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, maxEventBytesPerSec);
- var totalTraceBytesValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, totalTraceBytes);
-
- var biggestCategory = {
- name: categoryWithMaxEventBytes,
- size_in_bytes: maxEventBytesPerCategory
- };
-
- var totalBytes = new tr.v.NumericValue(
- 'Total trace size in bytes', totalTraceBytesValue);
- totalBytes.diagnostics.add(
- 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
- values.addValue(totalBytes);
-
- var peakEvents = new tr.v.NumericValue(
- 'Max number of events per second', maxEventCountPerSecValue);
- peakEvents.diagnostics.add(
- 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
- values.addValue(peakEvents);
-
- var peakBytes = new tr.v.NumericValue(
- 'Max event size in bytes per second', maxEventBytesPerSecValue);
- peakBytes.diagnostics.add(
- 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
- values.addValue(peakBytes);
-
- addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes);
- }
-
- tr.metrics.MetricRegistry.register(tracingMetric);
-
- return {
- tracingMetric: tracingMetric,
- // For testing only:
- MEMORY_INFRA_TRACING_CATEGORY: MEMORY_INFRA_TRACING_CATEGORY
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html
deleted file mode 100644
index 97a158f384a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html
+++ /dev/null
@@ -1,172 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/tracing_metric.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function makeModel(events, opt_track) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- trackDetailedModelStats: opt_track
- });
- }
-
- function getEventStringSize(events, indices) {
- return indices.reduce(function(sum, index) {
- return sum + JSON.stringify(events[index]).length;
- }, 0);
- }
-
- function checkDurationValue(allValues, metricName, expected) {
- var values = allValues.getValuesWithName(metricName);
- assert.lengthOf(values, 1);
- assert.closeTo(1000 * values[0].numeric.value, expected, 0.1);
- }
-
- test('hasEventSizesInBytes', function() {
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'}
- ];
-
- var model = makeModel(JSON.stringify(events), false);
- assert.isFalse(model.importOptions.trackDetailedModelStats);
- assert.throws(function() {
- tr.metrics.tracingMetric(allValues, model);
- }, 'Please enable ImportOptions.trackDetailedModelStats.');
-
- model = makeModel(JSON.stringify(events), true);
- assert.isTrue(model.importOptions.trackDetailedModelStats);
- tr.metrics.tracingMetric(allValues, model);
- });
-
- test('totalTraceSize', function() {
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'}
- ];
- var model = makeModel(JSON.stringify(events), true);
- tr.metrics.tracingMetric(allValues, model);
-
- var eventStringSize = getEventStringSize(events, [0, 1]);
- var values = allValues.getValuesWithName('Total trace size in bytes');
- assert.strictEqual(values.length, 1);
- assert.strictEqual(values[0].numeric.value, eventStringSize);
- });
-
- test('maxValuePerSec', function() {
- var ONE_SEC_IN_US = 1000000;
- var events = [
- {name: 'a', pid: 52, ts: 1, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: ONE_SEC_IN_US + 1, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: 2 * ONE_SEC_IN_US + 1, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: 2 * ONE_SEC_IN_US + 3, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: ONE_SEC_IN_US + 2, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: 2 * ONE_SEC_IN_US + 2, cat: 'foo', ph: 'B'}
- ];
- var model = makeModel(JSON.stringify(events), true);
- var allValues = new tr.v.ValueSet();
- tr.metrics.tracingMetric(allValues, model);
-
- var maxEventCountPerSec = 3;
- var values = allValues.getValuesWithName('Max number of events per second');
- assert.strictEqual(values.length, 1);
- assert.strictEqual(values[0].numeric.value, maxEventCountPerSec);
-
- var maxEventBytesPerSec = getEventStringSize(events, [2, 3, 5]);
- var values = allValues.getValuesWithName(
- 'Max event size in bytes per second');
- assert.strictEqual(values.length, 1);
- assert.strictEqual(values[0].numeric.value, maxEventBytesPerSec);
- });
-
- test('diagnostics', function() {
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 535, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'bb', args: {}, pid: 52, ts: 546, cat: 'bar', tid: 53, ph: 'E'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'bb', args: {}, pid: 52, ts: 578, cat: 'bar', tid: 53, ph: 'E'}
- ];
- var model = makeModel(JSON.stringify(events), true);
- tr.metrics.tracingMetric(allValues, model);
-
- for (var i = 0; i < allValues.length; i++) {
- assert.strictEqual(
- values[i].diagnostics.category_with_max_event_size.name,
- 'foo');
- assert.strictEqual(
- values[i].diagnostics.category_with_max_event_size.size_in_bytes,
- getEventStringSize(events, [0, 1, 3]));
- }
- });
-
- test('testMemoryInfraTracingMetrics', function() {
- var MEMORY_INFRA_TRACING_CATEGORY =
- tr.metrics.MEMORY_INFRA_TRACING_CATEGORY;
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'OnMemoryDump', pid: 1, ts: 510, tid: 1, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp1'}, dur: 4}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 1, ts: 520, tid: 7, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp2'}, dur: 15}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 1, ts: 530, tid: 7, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp3'}, dur: 5}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 510, tid: 2, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp1'}, dur: 9}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 520, tid: 8, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp2'}, dur: 17}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 530, tid: 8, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp3'}, dur: 7}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 540, tid: 3, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp4'}, dur: 8}, // @suppress longLineCheck
- {name: 'ProcessDumps', pid: 1, ts: 550, tid: 1, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {guid: 4}, dur: 8}, // @suppress longLineCheck
- {name: 'ProcessDumps', pid: 2, ts: 540, tid: 2, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {guid: 4}, dur: 18}, // @suppress longLineCheck
- {name: 'thread_name', pid: 1, ts: 0, tid: 1, ph: 'M', cat: '__metadata', args: {name: 'CrBrowsermain'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 1, ts: 0, tid: 7, ph: 'M', cat: '__metadata', args: {name: 'MemoryInfra'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 2, ts: 0, tid: 2, ph: 'M', cat: '__metadata', args: {name: 'CrRendererMain'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 2, ts: 0, tid: 8, ph: 'M', cat: '__metadata', args: {name: 'MemoryInfra'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 2, ts: 0, tid: 3, ph: 'M', cat: '__metadata', args: {name: 'Compositor'}} // @suppress longLineCheck
- ];
-
- var model = makeModel(JSON.stringify(events), true);
- tr.model.MemoryDumpTestUtils.addGlobalMemoryDump(model, 550);
- tr.metrics.tracingMetric(allValues, model);
-
- var memoryCategorySize = events.filter(
- slice => slice['cat'] === MEMORY_INFRA_TRACING_CATEGORY).reduce(
- (acc, slice) => acc + JSON.stringify(slice).length, 0);
- var totalSizeValue = allValues.getValuesWithName(
- 'Total trace size of memory-infra dumps in bytes');
- assert.lengthOf(totalSizeValue, 1);
- assert.strictEqual(totalSizeValue[0].numeric.value, memoryCategorySize);
- var sizePerDumpValue = allValues.getValuesWithName(
- 'Average trace size of memory-infra dumps in bytes');
- assert.lengthOf(sizePerDumpValue, 1);
- assert.strictEqual(sizePerDumpValue[0].numeric.value, memoryCategorySize);
-
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp1 per memory-infra dump', 13);
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp2 per memory-infra dump', 32);
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp3 per memory-infra dump', 12);
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp4 per memory-infra dump', 8);
- checkDurationValue(allValues,
- 'Average CPU overhead on non-memory-infra threads per memory-infra ' +
- 'dump',
- 47);
- checkDurationValue(allValues,
- 'Average CPU overhead on all threads per memory-infra dump', 91);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html
deleted file mode 100644
index 3c5565b9c46..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html
+++ /dev/null
@@ -1,219 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8', function() {
- var DURATION_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(4, 200), 100);
-
- function computeExecuteMetrics(values, model) {
- var cpuTotalExecution = DURATION_NUMERIC_BUILDER.build();
- var wallTotalExecution = DURATION_NUMERIC_BUILDER.build();
- var cpuSelfExecution = DURATION_NUMERIC_BUILDER.build();
- var wallSelfExecution = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.Execute')) {
- cpuTotalExecution.add(e.cpuDuration);
- wallTotalExecution.add(e.duration);
- cpuSelfExecution.add(e.cpuSelfTime);
- wallSelfExecution.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_cpu_total', cpuTotalExecution,
- { description: 'cpu total time spent in script execution' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_wall_total', wallTotalExecution,
- { description: 'wall total time spent in script execution' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_cpu_self', cpuSelfExecution,
- { description: 'cpu self time spent in script execution' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_wall_self', wallSelfExecution,
- { description: 'wall self time spent in script execution' }));
- }
-
- function computeParseLazyMetrics(values, model) {
- var cpuSelfParseLazy = DURATION_NUMERIC_BUILDER.build();
- var wallSelfParseLazy = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.ParseLazyMicroSeconds')) {
- cpuSelfParseLazy.add(e.cpuSelfTime);
- wallSelfParseLazy.add(e.selfTime);
- }
- for (var e of model.findTopmostSlicesNamed('V8.ParseLazy')) {
- cpuSelfParseLazy.add(e.cpuSelfTime);
- wallSelfParseLazy.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_parse_lazy_cpu_self', cpuSelfParseLazy,
- { description: 'cpu self time spent performing lazy parsing' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_parse_lazy_wall_self', wallSelfParseLazy,
- { description: 'wall self time spent performing lazy parsing' }));
- }
-
- function computeCompileFullCodeMetrics(values, model) {
- var cpuSelfCompileFullCode = DURATION_NUMERIC_BUILDER.build();
- var wallSelfCompileFullCode = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.CompileFullCode')) {
- cpuSelfCompileFullCode.add(e.cpuSelfTime);
- wallSelfCompileFullCode.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_full_code_cpu_self',
- cpuSelfCompileFullCode,
- { description: 'cpu self time spent performing compiling full code' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_full_code_wall_self',
- wallSelfCompileFullCode, {
- description: 'wall self time spent performing compiling full code'
- }));
- }
-
- function computeCompileIgnitionMetrics(values, model) {
- var cpuSelfCompileIgnition = DURATION_NUMERIC_BUILDER.build();
- var wallSelfCompileIgnition = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.CompileIgnition')) {
- cpuSelfCompileIgnition.add(e.cpuSelfTime);
- wallSelfCompileIgnition.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_ignition_cpu_self',
- cpuSelfCompileIgnition,
- { description: 'cpu self time spent in compile ignition' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_ignition_wall_self',
- wallSelfCompileIgnition, {
- description: 'wall self time spent in compile ignition'
- }));
- }
-
- function computeRecompileMetrics(values, model) {
- var cpuTotalRecompileSynchronous = DURATION_NUMERIC_BUILDER.build();
- var wallTotalRecompileSynchronous = DURATION_NUMERIC_BUILDER.build();
- var cpuTotalRecompileConcurrent = DURATION_NUMERIC_BUILDER.build();
- var wallTotalRecompileConcurrent = DURATION_NUMERIC_BUILDER.build();
- // TODO(eakuefner): Stop computing overall values once dash v2 is ready.
- // https://github.com/catapult-project/catapult/issues/2180
- var cpuTotalRecompileOverall = DURATION_NUMERIC_BUILDER.build();
- var wallTotalRecompileOverall = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.RecompileSynchronous')) {
- cpuTotalRecompileSynchronous.add(e.cpuDuration);
- wallTotalRecompileSynchronous.add(e.duration);
- cpuTotalRecompileOverall.add(e.cpuDuration);
- wallTotalRecompileOverall.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_synchronous_cpu_total',
- cpuTotalRecompileSynchronous,
- { description: 'cpu total time spent in synchronous recompilation' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_synchronous_wall_total',
- wallTotalRecompileSynchronous,
- { description: 'wall total time spent in synchronous recompilation' }));
-
-
- for (var e of model.findTopmostSlicesNamed('V8.RecompileConcurrent')) {
- cpuTotalRecompileConcurrent.add(e.cpuDuration);
- wallTotalRecompileConcurrent.add(e.duration);
- cpuTotalRecompileOverall.add(e.cpuDuration);
- wallTotalRecompileOverall.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_concurrent_cpu_total',
- cpuTotalRecompileConcurrent,
- { description: 'cpu total time spent in concurrent recompilation' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_concurrent_wall_total',
- wallTotalRecompileConcurrent,
- { description: 'wall total time spent in concurrent recompilation' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_overall_cpu_total',
- cpuTotalRecompileOverall, {
- description:
- 'cpu total time spent in synchronous or concurrent recompilation'
- }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_overall_wall_total',
- wallTotalRecompileOverall, {
- description:
- 'wall total time spent in synchronous or concurrent recompilation'
- }));
- }
-
- function computeOptimizeCodeMetrics(values, model) {
- var cpuTotalOptimizeCode = DURATION_NUMERIC_BUILDER.build();
- var wallTotalOptimizeCode = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.OptimizeCode')) {
- cpuTotalOptimizeCode.add(e.cpuDuration);
- wallTotalOptimizeCode.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_optimize_code_cpu_total',
- cpuTotalOptimizeCode,
- { description: 'cpu total time spent in code optimization' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_optimize_code_wall_total',
- wallTotalOptimizeCode,
- { description: 'wall total time spent in code optimization' }));
- }
-
- function computeDeoptimizeCodeMetrics(values, model) {
- var cpuTotalDeoptimizeCode = DURATION_NUMERIC_BUILDER.build();
- var wallTotalDeoptimizeCode = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.DeoptimizeCode')) {
- cpuTotalDeoptimizeCode.add(e.cpuDuration);
- wallTotalDeoptimizeCode.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_deoptimize_code_cpu_total',
- cpuTotalDeoptimizeCode,
- { description: 'cpu total time spent in code deoptimization' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_deoptimize_code_wall_total',
- wallTotalDeoptimizeCode,
- { description: 'wall total time spent in code deoptimization' }));
- }
-
- function executionMetric(values, model) {
- computeExecuteMetrics(values, model);
- computeParseLazyMetrics(values, model);
- computeCompileIgnitionMetrics(values, model);
- computeCompileFullCodeMetrics(values, model);
- computeRecompileMetrics(values, model);
- computeOptimizeCodeMetrics(values, model);
- computeDeoptimizeCodeMetrics(values, model);
- }
-
- tr.metrics.MetricRegistry.register(executionMetric);
-
- return {
- executionMetric: executionMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html
deleted file mode 100644
index 9cb7099796c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/v8/execution_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('executionMetricBasic', function() {
- var model = tr.c.TestUtils.newModel();
- var values = new tr.v.ValueSet();
-
- tr.metrics.v8.executionMetric(values, model);
-
- [
- 'v8_execution_cpu_total',
- 'v8_execution_wall_total',
- 'v8_execution_cpu_self',
- 'v8_execution_wall_self',
- 'v8_parse_lazy_cpu_self',
- 'v8_parse_lazy_wall_self',
- 'v8_compile_full_code_cpu_self',
- 'v8_compile_full_code_wall_self',
- 'v8_compile_ignition_cpu_self',
- 'v8_compile_ignition_wall_self',
- 'v8_recompile_synchronous_cpu_total',
- 'v8_recompile_synchronous_wall_total',
- 'v8_recompile_concurrent_cpu_total',
- 'v8_recompile_concurrent_wall_total',
- 'v8_recompile_overall_cpu_total',
- 'v8_recompile_overall_wall_total',
- 'v8_optimize_code_cpu_total',
- 'v8_optimize_code_wall_total',
- 'v8_deoptimize_code_cpu_total',
- 'v8_deoptimize_code_wall_total',
- ].forEach(function(name) {
- assert.isAbove(values.getValuesWithName(name).length, 0);
- });
- });
-
- test('noDoubleCounting', function() {
- var events = [
- {name: 'V8.Execute', args: {}, pid: 52, ts: 0, cat: 'foo', tid: 53,
- ph: 'B'},
- {name: 'V8.Execute', args: {}, pid: 52, ts: 100, cat: 'foo', tid: 53,
- ph: 'E'},
- {name: 'V8.Execute', args: {}, pid: 52, ts: 20, cat: 'foo', tid: 53,
- ph: 'B'},
- {name: 'V8.Execute', args: {}, pid: 52, ts: 40, cat: 'foo', tid: 53,
- ph: 'E'}
- ];
-
- var model = tr.c.TestUtils.newModelWithEvents(JSON.stringify(events), {
- shiftWorldToZero: false
- });
- var values = new tr.v.ValueSet();
-
- tr.metrics.v8.executionMetric(values, model);
-
- var value = values.getValuesWithName('v8_execution_wall_total_sum')[0];
-
- assert.closeTo(value.numeric.value, 0.1, 1e-5);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html
deleted file mode 100644
index d842445ab16..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html
+++ /dev/null
@@ -1,299 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/v8/utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8', function() {
- // The time window size for mutator utilization computation.
- // It is equal to the duration of one frame corresponding to 60 FPS rendering.
- var TARGET_FPS = 60;
- var MS_PER_SECOND = 1000;
- var WINDOW_SIZE_MS = MS_PER_SECOND / TARGET_FPS;
-
- function gcMetric(values, model) {
- addDurationOfTopEvents(values, model);
- addTotalDurationOfTopEvents(values, model);
- addDurationOfSubEvents(values, model);
- addIdleTimesOfTopEvents(values, model);
- addTotalIdleTimesOfTopEvents(values, model);
- addV8ExecuteMutatorUtilization(values, model);
- }
-
- tr.metrics.MetricRegistry.register(gcMetric);
-
- var timeDurationInMs_smallerIsBetter =
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter;
- var percentage_biggerIsBetter =
- tr.v.Unit.byName.normalizedPercentage_biggerIsBetter;
-
- var numericBuilder = new tr.v.NumericBuilder(
- timeDurationInMs_smallerIsBetter, 0);
- // 0.1 steps from 0 to 20 since it is the most common range.
- numericBuilder.addLinearBins(20, 200);
- // Exponentially increasing steps from 20 to 200.
- numericBuilder.addExponentialBins(200, 100);
-
- function createNumericForTopEventTime() {
- var n = numericBuilder.build();
- n.customizeSummaryOptions({
- avg: true,
- count: true,
- max: true,
- min: false,
- std: true,
- sum: true,
- percentile: [0.90]});
- return n;
- }
-
- function createNumericForSubEventTime() {
- var n = numericBuilder.build();
- n.customizeSummaryOptions({
- avg: true,
- count: false,
- max: true,
- min: false,
- std: false,
- sum: false,
- percentile: [0.90]
- });
- return n;
- }
-
- function createNumericForIdleTime() {
- var n = numericBuilder.build();
- n.customizeSummaryOptions({
- avg: true,
- count: false,
- max: true,
- min: false,
- std: false,
- sum: true,
- percentile: []
- });
- return n;
- }
-
- function createPercentage(numerator, denominator) {
- var percentage = denominator === 0 ? 0 : numerator / denominator * 100;
- return new tr.v.ScalarNumeric(percentage_biggerIsBetter, percentage);
- }
-
- /**
- * Example output:
- * - Animation-v8_gc_full_mark_compactor.
- */
- function addDurationOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- tr.metrics.v8.utils.topGarbageCollectionEventName,
- function(stageTitle, name, events) {
- var cpuDuration = createNumericForTopEventTime();
- events.forEach(function(event) {
- cpuDuration.add(event.cpuDuration);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name, cpuDuration));
- }
- );
- }
-
- /**
- * Example output:
- * - Animation:v8_gc_total
- */
- function addTotalDurationOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- event => 'v8-gc-total',
- function(stageTitle, name, events) {
- var cpuDuration = createNumericForTopEventTime();
- events.forEach(function(event) {
- cpuDuration.add(event.cpuDuration);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name, cpuDuration));
- }
- );
- }
-
- /**
- * Example output:
- * - Animation-v8-gc-full-mark-compactor-evacuate.
- */
- function addDurationOfSubEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isSubGarbageCollectionEvent,
- tr.metrics.v8.utils.subGarbageCollectionEventName,
- function(stageTitle, name, events) {
- var cpuDuration = createNumericForSubEventTime();
- events.forEach(function(event) {
- cpuDuration.add(event.cpuDuration);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name, cpuDuration));
- }
- );
- }
-
- /**
- * Example output:
- * - Animation-v8-gc-full-mark-compactor_idle_deadline_overrun,
- * - Animation-v8-gc-full-mark-compactor_outside_idle,
- * - Animation-v8-gc-full-mark-compactor_percentage_idle.
- */
- function addIdleTimesOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- tr.metrics.v8.utils.topGarbageCollectionEventName,
- function(stageTitle, name, events) {
- addIdleTimes(values, model, stageTitle, name, events);
- }
- );
- }
-
- /**
- * Example output:
- * - Animation-v8-gc-total_idle_deadline_overrun,
- * - Animation-v8-gc-total_outside_idle,
- * - Animation-v8-gc-total_percentage_idle.
- */
- function addTotalIdleTimesOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- event => 'v8-gc-total',
- function(stageTitle, name, events) {
- addIdleTimes(values, model, stageTitle, name, events);
- }
- );
- }
-
- function addIdleTimes(values, model, stageTitle, name, events) {
- var cpuDuration = createNumericForIdleTime();
- var insideIdle = createNumericForIdleTime();
- var outsideIdle = createNumericForIdleTime();
- var idleDeadlineOverrun = createNumericForIdleTime();
- events.forEach(function(event) {
- var idleTask = tr.metrics.v8.utils.findParent(
- event, tr.metrics.v8.utils.isIdleTask);
- var inside = 0;
- var overrun = 0;
- if (idleTask) {
- var allottedTime = idleTask['args']['allotted_time_ms'];
- if (event.duration > allottedTime) {
- overrun = event.duration - allottedTime;
- // Don't count time over the deadline as being inside idle time.
- // Since the deadline should be relative to wall clock we
- // compare allotted_time_ms with wall duration instead of thread
- // duration, and then assume the thread duration was inside idle
- // for the same percentage of time.
- inside = event.cpuDuration * allottedTime / event.duration;
- } else {
- inside = event.cpuDuration;
- }
- }
- cpuDuration.add(event.cpuDuration);
- insideIdle.add(inside);
- outsideIdle.add(event.cpuDuration - inside);
- idleDeadlineOverrun.add(overrun);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name + '_idle_deadline_overrun',
- idleDeadlineOverrun));
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name + '_outside_idle', outsideIdle));
- var percentage = createPercentage(insideIdle.sum,
- cpuDuration.sum);
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name + '_percentage_idle', percentage));
- }
-
- function addV8ExecuteMutatorUtilization(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopV8ExecuteEvent,
- event => 'v8-execute',
- function(stageTitle, name, events) {
- events.sort((a, b) => a.start - b.start);
- var time = 0;
- var pauses = [];
- // Glue together the v8.execute events and adjust the GC pause
- // times accordingly.
- events.forEach(function(topEvent) {
- topEvent.iterateAllDescendents(function(e) {
- if (tr.metrics.v8.utils.isTopGarbageCollectionEvent(e)) {
- pauses.push({ start: e.start - topEvent.start + time,
- end: e.end - topEvent.start + time });
- }
- });
- time += topEvent.duration;
- });
- // Now we have one big v8.execute interval from 0 to |time| and
- // a list of GC pauses.
- var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization(
- 0, time, WINDOW_SIZE_MS, pauses);
- [0.90, 0.95, 0.99].forEach(function(percent) {
- var value = new tr.v.ScalarNumeric(percentage_biggerIsBetter,
- mutatorUtilization.percentile(1.0 - percent) * 100);
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-v8-execute-mutator-utilization_pct_0' +
- percent * 100,
- value));
- });
- var value = new tr.v.ScalarNumeric(percentage_biggerIsBetter,
- mutatorUtilization.min);
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-v8-execute-mutator-utilization_min', value));
- }
- );
- }
-
- /**
- * Filters events using the |filterCallback|, then groups events by the user
- * expectation stage title and the name computed using the |nameCallback|,
- * and then invokes the |processCallback| with the grouped events.
- * @param {Function} filterCallback Takes an event and returns a boolean.
- * @param {Function} nameCallback Takes event and returns a string.
- * @param {Function} processCallback Takes a stage title, a name, and
- * an array of events.
- */
- function groupAndProcessEvents(model, filterCallback,
- nameCallback, processCallback) {
- // Two level map: stageTitle -> name -> [events].
- var stageTitleToNameToEvents = {};
- model.userModel.expectations.forEach(function(ue) {
- stageTitleToNameToEvents[ue.stageTitle] =
- stageTitleToNameToEvents[ue.stageTitle] || {};
- var nameToEvents = stageTitleToNameToEvents[ue.stageTitle];
- ue.associatedEvents.forEach(function(event) {
- if (!filterCallback(event)) return;
- var name = nameCallback(event);
- nameToEvents[name] = nameToEvents[name] || [];
- nameToEvents[name].push(event);
- });
- });
- tr.b.iterItems(stageTitleToNameToEvents,
- function(stageTitle, nameToEvents) {
- tr.b.iterItems(nameToEvents, function(name, events) {
- processCallback(stageTitle, name, events);
- });
- }
- );
- }
-
- return {
- gcMetric: gcMetric,
- WINDOW_SIZE_MS: WINDOW_SIZE_MS // For testing purposes only.
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html
deleted file mode 100644
index a0e32cfdbb5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html
+++ /dev/null
@@ -1,252 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/v8/gc_metric.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function createModel(start, end, slices) {
- var opts = {
- customizeModelCallback: function(model) {
- var group = new tr.model.SliceGroup(tr.c.TestUtils.newFakeThread());
- var ue = new tr.model.um.AnimationExpectation(
- model, 'test', start, end);
- slices.forEach(function(slice) {
- group.pushSlice(tr.c.TestUtils.newSliceEx(slice));
- });
- group.createSubSlices();
- group.slices.forEach(function(slice) {
- ue.associatedEvents.push(slice);
- });
- model.userModel.expectations.push(ue);
- }
- };
- var model = tr.c.TestUtils.newModelWithEvents([], opts);
- return model;
- }
-
- function constructName(name, suffix) {
- return 'Animation-' + name + '_' + suffix;
- }
-
- function run(slices) {
- var values = new tr.v.ValueSet();
- var startTime = slices.reduce((acc, slice) => (Math.min(acc, slice.start)));
- var endTime = slices.reduce((acc, slice) => (Math.max(acc, slice.end)));
- var model = createModel(startTime - 1, endTime + 1, slices);
- tr.metrics.v8.gcMetric(values, model);
- var result = {};
- values.valueDicts.forEach(function(value) {
- result[value.name] = value.numeric.value;
- });
- return result;
- }
-
- test('topEvents', function() {
- var events = {
- 'V8.GCCompactor': 'v8-gc-full-mark-compactor',
- 'V8.GCFinalizeMC': 'v8-gc-latency-mark-compactor',
- 'V8.GCFinalizeMCReduceMemory': 'v8-gc-memory-mark-compactor',
- 'V8.GCIncrementalMarking': 'v8-gc-incremental-step',
- 'V8.GCIncrementalMarkingFinalize': 'v8-gc-incremental-finalize',
- 'V8.GCIncrementalMarkingStart': 'v8-gc-incremental-start',
- 'V8.GCPhantomHandleProcessingCallback' : 'v8-gc-phantom-handle-callback',
- 'V8.GCScavenger': 'v8-gc-scavenger'
- };
- tr.b.iterItems(events, function(timelineName, telemetryName) {
- var slices = [
- {
- title: timelineName, args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 100,
- count: 1,
- avg: 100,
- max: 100,
- idle_deadline_overrun_sum: 0,
- idle_deadline_overrun_avg: 0,
- idle_deadline_overrun_max: 0,
- outside_idle_sum: 100,
- outside_idle_avg: 100,
- outside_idle_max: 100,
- percentage_idle: 0
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName(telemetryName, key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- assert.closeTo(actual[constructName(telemetryName, 'pct_090')], 100, 1);
- });
- });
-
- test('idleTimes', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'SingleThreadIdleTaskRunner::RunTask',
- args: {'allotted_time_ms' : 100}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 110, end: 190,
- cpuStart: 110, cpuEnd: 190
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 80,
- count: 1,
- avg: 80,
- max: 80,
- idle_deadline_overrun_sum: 0,
- idle_deadline_overrun_avg: 0,
- idle_deadline_overrun_max: 0,
- outside_idle_sum: 0,
- outside_idle_avg: 0,
- outside_idle_max: 0,
- percentage_idle: 100
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName('v8-gc-latency-mark-compactor', key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- });
-
- test('idleTimeOverrun', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'SingleThreadIdleTaskRunner::RunTask',
- args: {'allotted_time_ms' : 10}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 110, end: 190,
- cpuStart: 110, cpuEnd: 190
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 80,
- count: 1,
- avg: 80,
- max: 80,
- idle_deadline_overrun_sum: 70,
- idle_deadline_overrun_avg: 70,
- idle_deadline_overrun_max: 70,
- outside_idle_sum: 70,
- outside_idle_avg: 70,
- outside_idle_max: 70,
- percentage_idle: 100 / 8
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName('v8-gc-latency-mark-compactor', key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- });
-
- test('subEvents', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GC_MC_MARK', args: {}, start: 110, end: 190,
- cpuStart: 110, cpuEnd: 190
- },
- ];
- var actual = run(slices);
- var expected = {
- avg: 80,
- max: 80,
- };
- var telemetryName = 'v8-gc-latency-mark-compactor-mark';
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName(telemetryName, key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- assert.closeTo(actual[constructName(telemetryName, 'pct_090')], 80, 1);
- });
-
- test('total', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCIncrementalMarking', args: {}, start: 210, end: 290,
- cpuStart: 210, cpuEnd: 290
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 180,
- count: 2,
- avg: 90,
- max: 100,
- idle_deadline_overrun_sum: 0,
- idle_deadline_overrun_avg: 0,
- idle_deadline_overrun_max: 0,
- outside_idle_sum: 180,
- outside_idle_avg: 90,
- outside_idle_max: 100,
- percentage_idle: 0
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName('v8-gc-total', key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- });
-
- test('mutatorUtilization', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'V8.Execute', args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 150, end: 160,
- cpuStart: 150, cpuEnd: 160
- },
- {
- title: 'V8.Execute', args: {}, start: 1000, end: 1200,
- cpuStart: 1000, cpuEnd: 1200
- },
- {
- title: 'V8.GCIncrementalMarking', args: {}, start: 1010, end: 1020,
- cpuStart: 1010, cpuEnd: 1020
- }
- ];
- var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization(
- 0, 300, tr.metrics.v8.WINDOW_SIZE_MS,
- [{start: 50, end: 60}, {start: 110, end: 120}]);
- var actual = run(slices);
- assert.strictEqual(
- actual['Animation-v8-execute-mutator-utilization_pct_095'],
- mutatorUtilization.percentile(1 - 0.95) * 100);
- assert.strictEqual(
- actual['Animation-v8-execute-mutator-utilization_pct_099'],
- mutatorUtilization.percentile(1 - 0.99) * 100);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html
deleted file mode 100644
index 1d561d0811f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html
+++ /dev/null
@@ -1,256 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/piecewise_linear_function.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8.utils', function() {
- // The title of the idle task event.
- var IDLE_TASK_EVENT = 'SingleThreadIdleTaskRunner::RunTask';
-
- // V8 execution event.
- var V8_EXECUTE = 'V8.Execute';
-
- // GC events start with this prefix.
- var GC_EVENT_PREFIX = 'V8.GC';
-
- // Special handling is required for full GCs inside low memory notification.
- var FULL_GC_EVENT = 'V8.GCCompactor';
-
- var LOW_MEMORY_EVENT = 'V8.GCLowMemoryNotification';
-
- // Maps the top-level GC events in timeline to telemetry friendly names.
- var TOP_GC_EVENTS = {
- 'V8.GCCompactor': 'v8-gc-full-mark-compactor',
- 'V8.GCFinalizeMC': 'v8-gc-latency-mark-compactor',
- 'V8.GCFinalizeMCReduceMemory': 'v8-gc-memory-mark-compactor',
- 'V8.GCIncrementalMarking': 'v8-gc-incremental-step',
- 'V8.GCIncrementalMarkingFinalize': 'v8-gc-incremental-finalize',
- 'V8.GCIncrementalMarkingStart': 'v8-gc-incremental-start',
- 'V8.GCLowMemoryNotification': 'v8-gc-low-memory-mark-compactor',
- 'V8.GCPhantomHandleProcessingCallback' : 'v8-gc-phantom-handle-callback',
- 'V8.GCScavenger': 'v8-gc-scavenger'
- };
-
- /**
- * Finds the first parent of the |event| for which the |predicate| holds.
- */
- function findParent(event, predicate) {
- var parent = event.parentSlice;
- while (parent) {
- if (predicate(parent)) {
- return parent;
- }
- parent = parent.parentSlice;
- }
- return null;
- }
-
- function isIdleTask(event) {
- return event.title === IDLE_TASK_EVENT;
- }
-
- function isLowMemoryEvent(event) {
- return event.title === LOW_MEMORY_EVENT;
- }
-
- function isV8ExecuteEvent(event) {
- return event.title === V8_EXECUTE;
- }
-
- function isTopV8ExecuteEvent(event) {
- return isV8ExecuteEvent(event) && findParent(isV8ExecuteEvent) === null;
- }
-
- function isGarbageCollectionEvent(event) {
- // Low memory notification is handled specially because it contains
- // several full mark compact events.
- return event.title && event.title.startsWith(GC_EVENT_PREFIX) &&
- event.title != LOW_MEMORY_EVENT;
- }
-
- function isTopGarbageCollectionEvent(event) {
- return event.title in TOP_GC_EVENTS;
- }
-
- function isSubGarbageCollectionEvent(event) {
- return isGarbageCollectionEvent(event) &&
- !isTopGarbageCollectionEvent(event);
- }
-
- function topGarbageCollectionEventName(event) {
- if (event.title === FULL_GC_EVENT) {
- // Full mark compact events inside a low memory notification
- // are counted as low memory mark compacts.
- if (findParent(event, isLowMemoryEvent)) {
- return TOP_GC_EVENTS[LOW_MEMORY_EVENT];
- }
- }
- return TOP_GC_EVENTS[event.title];
- }
-
- function subGarbageCollectionEventName(event) {
- var topEvent = findParent(event, isTopGarbageCollectionEvent);
- var prefix = topEvent ? topGarbageCollectionEventName(topEvent) : 'unknown';
- // Remove redundant prefixes and convert to lower case.
- var name = event.title.replace('V8.GC_MC_', '')
- .replace('V8.GC_SCAVENGER_', '')
- .replace('V8.GC_', '')
- .replace(/_/g, '-').toLowerCase();
- return prefix + '-' + name;
- }
-
- /**
- * Given a list of intervals, returns a new list with all overalapping
- * intervals merged into a single interval.
- */
- function unionOfIntervals(intervals) {
- if (intervals.length === 0)
- return [];
- return tr.b.mergeRanges(
- intervals.map(x => ({min: x.start, max: x.end})), 1e-6,
- function(ranges) {
- return {
- start: ranges.reduce((acc, x) => Math.min(acc, x.min), ranges[0].min),
- end: ranges.reduce((acc, x) => Math.max(acc, x.max), ranges[0].max)
- };
- }
- );
- }
-
- /**
- * An end-point of a window that is sliding from left to right
- * over |points| starting from time |start|.
- * It is intended to be used only by the |mutatorUtilization| function.
- * @constructor
- */
- function WindowEndpoint(start, points) {
- this.points = points;
- // The index of the last passed point.
- this.lastIndex = -1;
- // The position of the end-point in the time line.
- this.position = start;
- // The distance until the next point.
- this.distanceUntilNextPoint = points[0].position - start;
- // The cumulative duration of GC pauses until this position.
- this.cummulativePause = 0;
- // The number of entered GC intervals.
- this.stackDepth = 0;
- }
-
- WindowEndpoint.prototype = {
- // Advance the end-point by the given |delta|.
- advance: function(delta) {
- var points = this.points;
- if (delta < this.distanceUntilNextPoint) {
- this.position += delta;
- this.cummulativePause += this.stackDepth > 0 ? delta : 0;
- this.distanceUntilNextPoint =
- points[this.lastIndex + 1].position - this.position;
- } else {
- this.position += this.distanceUntilNextPoint;
- this.cummulativePause +=
- this.stackDepth > 0 ? this.distanceUntilNextPoint : 0;
- this.distanceUntilNextPoint = 0;
- this.lastIndex++;
- if (this.lastIndex < points.length) {
- this.stackDepth += points[this.lastIndex].delta;
- if (this.lastIndex + 1 < points.length)
- this.distanceUntilNextPoint =
- points[this.lastIndex + 1].position - this.position;
- }
- }
- }
- };
-
- /**
- * Returns mutator utilization as a piecewise linear function.
- * Mutator utilization for a window size w is a function of time mu_w(t)
- * that shows how much time in [t, t+w] is left for the mutator relative
- * to the time window size.
- * More formally:
- * mu_w(t) = (w - total_time_spent_in_gc_in(t, t + w)) / w.
- * The range of mu_w(t) is [0..1].
- * See "A Parallel, Real-Time Garbage Collector" by Cheng et. al. for
- * more info [https://www.cs.cmu.edu/~guyb/papers/gc2001.pdf].
- *
- * All parameters must use the same time unit.
- * @param {number} start The start time of execution.
- * @param {number} end The end time of execution.
- * @param {number} timeWindow The size of the time window.
- * @param {!Array<!{start: number, end: number}>} intervals The list of
- * GC pauses.
- */
- function mutatorUtilization(start, end, timeWindow, intervals) {
- var mu = new tr.b.PiecewiseLinearFunction();
- // If the interval is smaller than the time window, then the function is
- // empty.
- if (end - start <= timeWindow)
- return mu;
- // If there are GC pauses then the mutator utilization is 1.0.
- if (intervals.length === 0) {
- mu.push(start, 1.0, end - timeWindow, 1.0);
- return mu;
- }
- intervals = unionOfIntervals(intervals);
- // Create a point for the start and the end of each interval.
- var points = [];
- intervals.forEach(function(interval) {
- points.push({position: interval.start, delta: 1});
- points.push({position: interval.end, delta: -1});
- });
- points.sort((a, b) => a.position - b.position);
- points.push({position: end, delta: 0});
- // The left and the right limit of the sliding window.
- var left = new WindowEndpoint(start, points);
- var right = new WindowEndpoint(start, points);
- // Advance the right end-point until we get the correct window size.
- while (right.position - left.position < timeWindow)
- right.advance(timeWindow - (right.position - left.position));
- while (right.lastIndex < points.length) {
- // Advance the window end-points by the largest possible amount
- // without jumping over a point.
- var distanceUntilNextPoint =
- Math.min(left.distanceUntilNextPoint, right.distanceUntilNextPoint);
- var position1 = left.position;
- var value1 = right.cummulativePause - left.cummulativePause;
- left.advance(distanceUntilNextPoint);
- right.advance(distanceUntilNextPoint);
- // Add a new mutator utilization segment only if it is non-trivial.
- if (distanceUntilNextPoint > 0) {
- var position2 = left.position;
- var value2 = right.cummulativePause - left.cummulativePause;
- mu.push(position1, 1.0 - value1 / timeWindow,
- position2, 1.0 - value2 / timeWindow);
- }
- }
- return mu;
- }
-
- return {
- findParent: findParent,
- isIdleTask: isIdleTask,
- isLowMemoryEvent: isLowMemoryEvent,
- isV8ExecuteEvent: isV8ExecuteEvent,
- isTopV8ExecuteEvent: isTopV8ExecuteEvent,
- isGarbageCollectionEvent: isGarbageCollectionEvent,
- isTopGarbageCollectionEvent: isTopGarbageCollectionEvent,
- isSubGarbageCollectionEvent: isSubGarbageCollectionEvent,
- topGarbageCollectionEventName: topGarbageCollectionEventName,
- subGarbageCollectionEventName: subGarbageCollectionEventName,
- unionOfIntervals: unionOfIntervals,
- mutatorUtilization: mutatorUtilization
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html
deleted file mode 100644
index d5068a16c52..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html
+++ /dev/null
@@ -1,145 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/v8/utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var unionOfIntervals = tr.metrics.v8.utils.unionOfIntervals;
-
- function interval(start, end) {
- return {start: start, end: end};
- }
-
- /**
- * Brute force computation of the mutator utilization.
- * The function steps from the start to the end and for each step
- * computes the mutator utilization.
- */
- function mutatorUtilizationSlow(start, end, timeWindow, intervals) {
- var STEP = 0.001;
- function timeToIndex(time) {
- return Math.floor((time - start) / STEP);
- };
- var N = timeToIndex(end) + 1;
- // bitmap[i] === true means that GC is active at time i.
- var bitmap = new Array(N);
- for (var i = 0; i < N; i++)
- bitmap[i] = false;
- intervals.forEach(function(interval) {
- var start = timeToIndex(interval.start);
- var end = timeToIndex(interval.end);
- for (var i = start; i < end; i++)
- bitmap[i] = true;
- });
- var pause = new Array(N);
- for (var i = 0; i < N; i++)
- pause[i] = (i > 0 ? pause[i - 1] : 0) + (bitmap[i] ? 1 : 0);
- var windowWidth = timeToIndex(timeWindow);
- var mu = new Array(Math.max(N - windowWidth, 0));
- for (var i = 0; i < mu.length; i++) {
- var value = pause[i + windowWidth] - pause[i];
- mu[i] = 1.0 - value / windowWidth;
- }
- mu.sort((a, b) => a - b);
- return {
- average: mu.reduce((acc, x) => (acc + x), 0) / mu.length,
- min: mu.reduce((acc, x) => Math.min(acc, x), 0),
- max: mu.reduce((acc, x) => Math.max(acc, x), 0),
- percentile: function(percent) {
- return mu[Math.floor(percent * (mu.length - 1))];
- }
- };
- }
-
- /**
- * Constructs PiecewiseLinearFunction from pieces.
- * @param {!Array<!{x1: number, y1: number, x2: number, y2: number}>} pieces
- * The list of pieces ordered by the x coordinate.
- */
- function createExpectedFunction(pieces) {
- var f = new tr.b.PiecewiseLinearFunction();
- pieces.forEach(function(p) {
- f.push(p.x1, p.y1, p.x2, p.y2);
- });
- return f;
- }
-
- test('unionOfIntervals', function() {
- var list, union;
- assert.deepEqual(unionOfIntervals([]), []);
- assert.deepEqual(unionOfIntervals([interval(1, 1)]), [interval(1, 1)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 1), interval(1, 2), interval(2, 3)]),
- [interval(0, 3)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 1), interval(1, 2), interval(3, 3)]),
- [interval(0, 2), interval(3, 3)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 10), interval(1, 2), interval(3, 3)]),
- [interval(0, 10)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 10), interval(1, 2), interval(3, 11)]),
- [interval(0, 11)]);
- assert.deepEqual(
- unionOfIntervals([interval(3, 10), interval(1, 2), interval(11, 11)]),
- [interval(1, 2), interval(3, 10), interval(11, 11)]);
- });
-
- test('basicMutatorUtilization', function() {
- assert.deepEqual(
- tr.metrics.v8.utils.mutatorUtilization(0, 40, 10, [interval(10, 20)]),
- createExpectedFunction([
- { x1: 0, y1: 1.0, x2: 10, y2: 0.0 },
- { x1: 10, y1: 0.0, x2: 20, y2: 1.0 },
- { x1: 20, y1: 1.0, x2: 30, y2: 1.0 }])
- );
- assert.deepEqual(
- tr.metrics.v8.utils.mutatorUtilization(0, 40, 10, [interval(10, 15)]),
- createExpectedFunction([
- { x1: 0, y1: 1.0, x2: 5, y2: 0.5 },
- { x1: 5, y1: 0.5, x2: 10, y2: 0.5 },
- { x1: 10, y1: 0.5, x2: 15, y2: 1.0 },
- { x1: 15, y1: 1.0, x2: 30, y2: 1.0 }])
- );
- assert.deepEqual(
- tr.metrics.v8.utils.mutatorUtilization(0, 60, 20,
- [interval(30, 35), interval(40, 45)]),
- createExpectedFunction([
- { x1: 0, y1: 1.0, x2: 10, y2: 1.0 },
- { x1: 10, y1: 1.0, x2: 15, y2: 0.75 },
- { x1: 15, y1: 0.75, x2: 20, y2: 0.75 },
- { x1: 20, y1: 0.75, x2: 25, y2: 0.5 },
- { x1: 25, y1: 0.5, x2: 30, y2: 0.5 },
- { x1: 30, y1: 0.5, x2: 35, y2: 0.75 },
- { x1: 35, y1: 0.75, x2: 40, y2: 0.75 }])
- );
- });
-
- test('mutatorUtilization', function() {
- var pauses, actual, expected;
- pauses = [interval(10, 20),
- interval(15, 23),
- interval(30, 31),
- interval(33, 34),
- interval(60, 61),
- interval(61, 63),
- interval(80, 88)];
- actual = tr.metrics.v8.utils.mutatorUtilization(0, 100, 7, pauses);
- expected = mutatorUtilizationSlow(0, 100, 7, pauses);
- assert.closeTo(expected.average, actual.average, 1e-3);
- assert.closeTo(expected.max, actual.max, 1e-3);
- assert.closeTo(expected.min, actual.min, 1e-3);
- assert.closeTo(expected.percentile(0.5), actual.percentile(0.5), 1e-3);
- assert.closeTo(expected.percentile(0.9), actual.percentile(0.9), 1e-3);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html
deleted file mode 100644
index 1fa69344494..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 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/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/memory_metric.html">
-<link rel="import" href="/tracing/metrics/v8/execution_metric.html">
-<link rel="import" href="/tracing/metrics/v8/gc_metric.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8', function() {
- function v8AndMemoryMetrics(values, model) {
- tr.metrics.v8.executionMetric(values, model);
- tr.metrics.v8.gcMetric(values, model);
- tr.metrics.sh.memoryMetric(values, model);
- }
-
- tr.metrics.MetricRegistry.register(v8AndMemoryMetrics);
-
- return {
- v8AndMemoryMetrics: v8AndMemoryMetrics
- };
-});
-</script>