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

Side by Side Diff: tracing/tracing/metrics/system_health/loading_metric.html

Issue 2283213002: Rename Histogram.add() to addSample(). (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2016 The Chromium Authors. All rights reserved. 3 Copyright 2016 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/category_util.html"> 8 <link rel="import" href="/tracing/base/category_util.html">
9 <link rel="import" href="/tracing/base/statistics.html"> 9 <link rel="import" href="/tracing/base/statistics.html">
10 <link rel="import" href="/tracing/metrics/metric_registry.html"> 10 <link rel="import" href="/tracing/metrics/metric_registry.html">
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (shouldIgnoreURL(url)) 233 if (shouldIgnoreURL(url))
234 continue; 234 continue;
235 var navigationStartEvent = navigationStartFinder. 235 var navigationStartEvent = navigationStartFinder.
236 findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start); 236 findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start);
237 // Ignore layout w/o preceding navigationStart, as they are not 237 // Ignore layout w/o preceding navigationStart, as they are not
238 // attributed to any time-to-X metric. 238 // attributed to any time-to-X metric.
239 if (navigationStartEvent === undefined) 239 if (navigationStartEvent === undefined)
240 continue; 240 continue;
241 241
242 var timeToEvent = ev.start - navigationStartEvent.start; 242 var timeToEvent = ev.start - navigationStartEvent.start;
243 histogram.add(timeToEvent, tr.v.d.DiagnosticMap.fromObject( 243 histogram.addSample(timeToEvent, {url: new tr.v.d.Generic(url)});
244 {url: new tr.v.d.Generic(url)}));
245 } 244 }
246 values.addValue(new tr.v.NumericValue(metric.valueName, histogram, 245 values.addValue(new tr.v.NumericValue(metric.valueName, histogram,
247 {description: metric.description})); 246 {description: metric.description}));
248 } 247 }
249 } 248 }
250 249
251 function addTimeToInteractiveSampleToHistogram(histogram, rendererHelper, 250 function addTimeToInteractiveSampleToHistogram(histogram, rendererHelper,
252 navigationStartTime, firstMeaningfulPaint, url) { 251 navigationStartTime, firstMeaningfulPaint, url) {
253 if (shouldIgnoreURL(url)) 252 if (shouldIgnoreURL(url))
254 return; 253 return;
(...skipping 22 matching lines...) Expand all
277 firstInteractiveCandidate = ev.end - 50; 276 firstInteractiveCandidate = ev.end - 50;
278 } 277 }
279 } 278 }
280 var diagnosticDict = rendererHelper.generateTimeBreakdownTree( 279 var diagnosticDict = rendererHelper.generateTimeBreakdownTree(
281 navigationStartTime, firstInteractive); 280 navigationStartTime, firstInteractive);
282 diagnosticDict.url = url; 281 diagnosticDict.url = url;
283 diagnosticDict.start = navigationStartTime; 282 diagnosticDict.start = navigationStartTime;
284 diagnosticDict.interactive = firstInteractive; 283 diagnosticDict.interactive = firstInteractive;
285 diagnosticDict.pid = rendererHelper.pid; 284 diagnosticDict.pid = rendererHelper.pid;
286 var timeToFirstInteractive = firstInteractive - navigationStartTime; 285 var timeToFirstInteractive = firstInteractive - navigationStartTime;
287 histogram.add(timeToFirstInteractive, tr.v.d.DiagnosticMap.fromObject( 286 histogram.addSample(timeToFirstInteractive,
288 {breakdown: new tr.v.d.Generic(diagnosticDict)})); 287 {breakdown: new tr.v.d.Generic(diagnosticDict)});
289 } 288 }
290 289
291 /** 290 /**
292 * Computes Time to first meaningful paint (TTFMP) & time to interactive (TTI) 291 * Computes Time to first meaningful paint (TTFMP) & time to interactive (TTI)
293 * from |model| and add it to |value|. 292 * from |model| and add it to |value|.
294 * 293 *
295 * First meaningful paint is the paint following the layout with the highest 294 * First meaningful paint is the paint following the layout with the highest
296 * "Layout Significance". The Layout Significance is computed inside Blink, 295 * "Layout Significance". The Layout Significance is computed inside Blink,
297 * by FirstMeaningfulPaintDetector class. It logs 296 * by FirstMeaningfulPaintDetector class. It logs
298 * "firstMeaningfulPaintCandidate" event every time the Layout Significance 297 * "firstMeaningfulPaintCandidate" event every time the Layout Significance
(...skipping 25 matching lines...) Expand all
324 if (snapshot === undefined || !snapshot.args.isLoadingMainFrame) 323 if (snapshot === undefined || !snapshot.args.isLoadingMainFrame)
325 return; 324 return;
326 var url = snapshot.args.documentLoaderURL; 325 var url = snapshot.args.documentLoaderURL;
327 if (shouldIgnoreURL(url)) 326 if (shouldIgnoreURL(url))
328 return; 327 return;
329 var timeToFirstMeaningfulPaint = 328 var timeToFirstMeaningfulPaint =
330 fmpMarkerEvent.start - navigationStart.start; 329 fmpMarkerEvent.start - navigationStart.start;
331 var diagnosticDict = rendererHelper.generateTimeBreakdownTree( 330 var diagnosticDict = rendererHelper.generateTimeBreakdownTree(
332 navigationStart.start, fmpMarkerEvent.start); 331 navigationStart.start, fmpMarkerEvent.start);
333 diagnosticDict.url = url; 332 diagnosticDict.url = url;
334 firstMeaningfulPaintHistogram.add( 333 firstMeaningfulPaintHistogram.addSample(timeToFirstMeaningfulPaint,
335 timeToFirstMeaningfulPaint, 334 {breakdown: new tr.v.d.Generic(diagnosticDict)});
336 tr.v.d.DiagnosticMap.fromObject(
337 {breakdown: new tr.v.d.Generic(diagnosticDict)}));
338 return {firstMeaningfulPaint: fmpMarkerEvent.start, url: url}; 335 return {firstMeaningfulPaint: fmpMarkerEvent.start, url: url};
339 } 336 }
340 337
341 var candidatesForFrameId = 338 var candidatesForFrameId =
342 findFirstMeaningfulPaintCandidates(rendererHelper); 339 findFirstMeaningfulPaintCandidates(rendererHelper);
343 340
344 for (var frameIdRef in candidatesForFrameId) { 341 for (var frameIdRef in candidatesForFrameId) {
345 var navigationStart; 342 var navigationStart;
346 var lastCandidate; 343 var lastCandidate;
347 344
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 timeToFirstMeaningfulPaintAndTimeToInteractiveMetrics(values, model); 393 timeToFirstMeaningfulPaintAndTimeToInteractiveMetrics(values, model);
397 } 394 }
398 395
399 tr.metrics.MetricRegistry.register(loadingMetric); 396 tr.metrics.MetricRegistry.register(loadingMetric);
400 397
401 return { 398 return {
402 loadingMetric: loadingMetric 399 loadingMetric: loadingMetric
403 }; 400 };
404 }); 401 });
405 </script> 402 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/metrics/system_health/hazard_metric.html ('k') | tracing/tracing/metrics/system_health/long_tasks_metric.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698