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

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

Issue 2005753002: firstPaintMetric: Report timeToOnload metric to check PCv1/v2 consistency (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: ned's review Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/system_health/first_paint_metric.html
diff --git a/tracing/tracing/metrics/system_health/first_paint_metric.html b/tracing/tracing/metrics/system_health/first_paint_metric.html
index 3d12cf915f50f0ec38114d7b06bb20dd09a4fd72..8740ef0b358a54b736a6803c9b8d3ef034e6d9cf 100644
--- a/tracing/tracing/metrics/system_health/first_paint_metric.html
+++ b/tracing/tracing/metrics/system_health/first_paint_metric.html
@@ -74,8 +74,8 @@ tr.exportTo('tr.metrics.sh', function() {
}
}
- function findUrlOfFrameAt(rendererHelper, frameIdRef, ts) {
- var url;
+ function findFrameLoaderSnapshotAt(rendererHelper, frameIdRef, ts) {
+ var snapshot;
var objects = rendererHelper.process.objects;
var frameLoaderInstances = objects.instancesByTypeName_['FrameLoader'];
@@ -88,18 +88,18 @@ tr.exportTo('tr.metrics.sh', function() {
frameLoaderInstances.forEach(function(instance) {
if (!instance.isAliveAt(ts))
return;
- var snapshot = instance.getSnapshotAt(ts);
- if (frameIdRef !== snapshot.args['frame']['id_ref'])
+ var maybeSnapshot = instance.getSnapshotAt(ts);
+ if (frameIdRef !== maybeSnapshot.args['frame']['id_ref'])
return;
- url = snapshot.args['documentLoaderURL'];
+ snapshot = maybeSnapshot;
}, this);
- return url;
+ return snapshot;
}
- function findFirstPaintEvents(rendererHelper, title) {
- var firstPaintEvents = [];
+ function findAllUserTimingEvents(rendererHelper, title) {
+ var targetEvents = [];
rendererHelper.process.iterateAllEvents(
function(ev) {
@@ -107,10 +107,10 @@ tr.exportTo('tr.metrics.sh', function() {
ev.title !== title)
return;
- firstPaintEvents.push(ev);
+ targetEvents.push(ev);
}, this);
- return firstPaintEvents;
+ return targetEvents;
}
function prepareTelemetryInternalEventPredicate(rendererHelper) {
@@ -142,6 +142,19 @@ tr.exportTo('tr.metrics.sh', function() {
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 firstPaintMetric(values, model) {
var chromeHelper = model.getOrCreateHelper(
tr.model.helpers.ChromeModelHelper);
@@ -151,41 +164,45 @@ tr.exportTo('tr.metrics.sh', function() {
var findNavigationStartEventForFrameBeforeTimestamp =
navigationStartFinder(rendererHelper);
- var numericBuilder =
- new tr.v.NumericBuilder(timeDurationInMs_smallerIsBetter, 0)
- .addLinearBins(1000, 20) // 50ms step to 1s
- .addLinearBins(3000, 20) // 100ms step to 3s
- .addExponentialBins(20000, 20);
- var firstContentfulPaintHistogram = numericBuilder.build();
- firstContentfulPaintHistogram.customizeSummaryOptions({
- avg: true,
- count: true,
- max: true,
- min: true,
- std: true,
- sum: false,
- percentile: [0.90, 0.95, 0.99],
- });
-
- var firstPaintEvents = findFirstPaintEvents(rendererHelper,
- 'firstContentfulPaint');
- firstPaintEvents = firstPaintEvents.filter(
- (ev) => !isTelemetryInternalEvent(ev));
- firstPaintEvents.forEach(function(ev) {
- var frameIdRef = ev.args['frame'];
- var url = findUrlOfFrameAt(rendererHelper, frameIdRef, ev.start);
- if (url === undefined || shouldIgnoreURL(url))
- return;
- var navigationStartEvent =
- findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start);
+ METRICS.forEach(function(metric) {
+ var numericBuilder =
+ new tr.v.NumericBuilder(timeDurationInMs_smallerIsBetter, 0)
+ .addLinearBins(1000, 20) // 50ms step to 1s
+ .addLinearBins(3000, 20) // 100ms step to 3s
+ .addExponentialBins(20000, 20);
+ var histogram = numericBuilder.build();
+ histogram.customizeSummaryOptions({
+ avg: true,
+ count: false,
+ max: true,
+ min: true,
+ std: true,
+ sum: false,
+ percentile: [0.90, 0.95, 0.99],
+ });
+
+ var targetEvents = findAllUserTimingEvents(rendererHelper, metric.title);
+ targetEvents = targetEvents.filter(
+ (ev) => !isTelemetryInternalEvent(ev));
+ targetEvents.forEach(function(ev) {
+ var frameIdRef = ev.args['frame'];
+ var snapshot =
+ findFrameLoaderSnapshotAt(rendererHelper, frameIdRef, ev.start);
+ if (snapshot === undefined || !snapshot.args.isLoadingMainFrame)
+ return;
+ var url = snapshot.args.documentLoaderURL;
+ if (shouldIgnoreURL(url))
+ return;
+ var navigationStartEvent =
+ findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start);
- var timeToFirstContentfulPaint = ev.start - navigationStartEvent.start;
- firstContentfulPaintHistogram.add(timeToFirstContentfulPaint, {url: url});
+ var timeToEvent = ev.start - navigationStartEvent.start;
+ histogram.add(timeToEvent, {url: url});
+ }, this);
+ values.addValue(new tr.v.NumericValue(
+ model.canonicalUrl, metric.valueName, histogram,
+ { description: metric.description }));
}, this);
- values.addValue(new tr.v.NumericValue(
- model.canonicalUrl, 'firstContentfulPaint',
- firstContentfulPaintHistogram,
- { description: 'time to first contentful paint' }));
}
firstPaintMetric.prototype = {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698