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

Unified Diff: tracing/tracing/metrics/resource_cpu_metric.html

Issue 2639213004: [not for commit] Add per-resource CPU cost metric (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/metrics/all_metrics.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/resource_cpu_metric.html
diff --git a/tracing/tracing/metrics/resource_cpu_metric.html b/tracing/tracing/metrics/resource_cpu_metric.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e28b299b8d680f8bddb2193067d6eedf3c2ef79
--- /dev/null
+++ b/tracing/tracing/metrics/resource_cpu_metric.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<!--
+Copyright 2017 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/base/unit.html">
+<link rel="import" href="/tracing/metrics/metric_registry.html">
+<link rel="import" href="/tracing/value/histogram.html">
+
+<script>
+'use strict';
+
+// This metric is designed to measure the CPU-bound aspects of resource loading.
+tr.exportTo('tr.metrics', function() {
+ function resourceCPUMetric(values, model) {
+ var CUSTOM_BOUNDARIES = tr.v.HistogramBinBoundaries.createLinear(0, 10, 50);
+
+ var cpuTotalExecution = new tr.v.Histogram('resource_request_cpu_total',
+ tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES);
+
+ var wallTotalDuration = new tr.v.Histogram('resource_request_wall_total',
+ tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, CUSTOM_BOUNDARIES);
+
+ for (var e of model.findTopmostSlicesNamed(
+ 'ResourceFetcher::requestResource')) {
+ cpuTotalExecution.addSample(e.cpuDuration);
+ wallTotalDuration.addSample(e.duration);
+ }
+ values.addHistogram(cpuTotalExecution);
+ values.addHistogram(wallTotalDuration);
+ }
+
+ tr.metrics.MetricRegistry.register(resourceCPUMetric);
+
+ return {
+ resourceCPUMetric,
+ };
+});
+</script>
« no previous file with comments | « tracing/tracing/metrics/all_metrics.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698