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

Unified Diff: tracing/tracing/metrics/system_health/long_tasks_metric.html

Issue 2293533002: Refactor NumericBuilder to HistogramBinBoundaries. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 years, 4 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
Index: tracing/tracing/metrics/system_health/long_tasks_metric.html
diff --git a/tracing/tracing/metrics/system_health/long_tasks_metric.html b/tracing/tracing/metrics/system_health/long_tasks_metric.html
index 9782488bd5fe90fad9135de4b38370d3f716f9a2..d12818d50d6f1cbf53b5b779de00cc74ad388d19 100644
--- a/tracing/tracing/metrics/system_health/long_tasks_metric.html
+++ b/tracing/tracing/metrics/system_health/long_tasks_metric.html
@@ -22,9 +22,6 @@ tr.exportTo('tr.metrics.sh', function() {
// 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.
@@ -67,18 +64,6 @@ tr.exportTo('tr.metrics.sh', function() {
});
}
- 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 range spans several orders of magnitude, and the data is likely to
- // form an exponential distribution, so use exponential bins in order to
- // prevent the lowest bin from containing almost all of the samples.
- // See also most UMA histograms that are exponential for similar reasons.
- var SLICE_NUMERIC_BUILDER = tr.v.NumericBuilder.createExponential(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0.1, LONGEST_TASK_MS), 50);
-
/**
* This metric directly measures long tasks on renderer main threads.
* This metric requires only the 'toplevel' tracing category.
@@ -89,7 +74,10 @@ tr.exportTo('tr.metrics.sh', function() {
*/
function longTasksMetric(values, model, opt_options) {
var rangeOfInterest = opt_options ? opt_options.rangeOfInterest : undefined;
- var longTaskNumeric = LONG_TASK_NUMERIC_BUILDER.build();
+ var longTaskNumeric = new
+ tr.v.Histogram(tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
+ tr.v.HistogramBinBoundaries.createLinear(
+ LONG_TASK_MS, LONGEST_TASK_MS, 40));
var slices = new tr.model.EventSet();
iterateRendererMainThreads(model, function(thread) {
iterateLongTopLevelTasksOnThreadInRange(
@@ -104,9 +92,13 @@ tr.exportTo('tr.metrics.sh', function() {
var longTaskValue = new tr.v.NumericValue(
'long tasks', longTaskNumeric, options);
values.addValue(longTaskValue);
+
+ var sampleForEvent = undefined;
var composition = tr.v.d.Composition.buildFromEvents(
- values, 'long tasks ', slices, SLICE_NUMERIC_BUILDER,
- e => (model.getUserFriendlyCategoryFromEvent(e) || 'unknown'));
+ values, 'long tasks ', slices,
+ e => (model.getUserFriendlyCategoryFromEvent(e) || 'unknown'),
+ tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, sampleForEvent,
+ tr.v.HistogramBinBoundaries.createExponential(1, LONGEST_TASK_MS, 40));
composition.colorScheme =
tr.v.d.COLOR_SCHEME_CHROME_USER_FRIENDLY_CATEGORY_DRIVER;
longTaskValue.diagnostics.set('category', composition);
« no previous file with comments | « tracing/tracing/metrics/system_health/loading_metric.html ('k') | tracing/tracing/metrics/system_health/memory_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698