OLD | NEW |
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/math/statistics.html"> |
10 <link rel="import" href="/tracing/metrics/metric_registry.html"> | 10 <link rel="import" href="/tracing/metrics/metric_registry.html"> |
11 <link rel="import" href="/tracing/metrics/system_health/utils.html"> | 11 <link rel="import" href="/tracing/metrics/system_health/utils.html"> |
12 <link rel="import" href="/tracing/model/helpers/chrome_model_helper.html"> | 12 <link rel="import" href="/tracing/model/helpers/chrome_model_helper.html"> |
13 <link rel="import" href="/tracing/model/timed_event.html"> | 13 <link rel="import" href="/tracing/model/timed_event.html"> |
14 <link rel="import" href="/tracing/value/histogram.html"> | 14 <link rel="import" href="/tracing/value/histogram.html"> |
15 | 15 |
16 <script> | 16 <script> |
17 'use strict'; | 17 'use strict'; |
18 | 18 |
19 tr.exportTo('tr.metrics.sh', function() { | 19 tr.exportTo('tr.metrics.sh', function() { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 start: navigationStart.start, | 208 start: navigationStart.start, |
209 fmp: fmpMarkerEvent.start | 209 fmp: fmpMarkerEvent.start |
210 }), | 210 }), |
211 } | 211 } |
212 }); | 212 }); |
213 return {firstMeaningfulPaint: fmpMarkerEvent.start, url: url}; | 213 return {firstMeaningfulPaint: fmpMarkerEvent.start, url: url}; |
214 } | 214 } |
215 | 215 |
216 function addFirstMeaningfulPaintCpuTimeSample(samples, rendererHelper, | 216 function addFirstMeaningfulPaintCpuTimeSample(samples, rendererHelper, |
217 frameIdRef, navigationStart, fmpMarkerEvent) { | 217 frameIdRef, navigationStart, fmpMarkerEvent) { |
218 var rangeOfInterest = tr.b.Range.fromExplicitRange(navigationStart.cpuStart, | 218 var rangeOfInterest = tr.b.math.Range.fromExplicitRange( |
219 fmpMarkerEvent.cpuStart); | 219 navigationStart.cpuStart, fmpMarkerEvent.cpuStart); |
220 var snapshot = findFrameLoaderSnapshotAt( | 220 var snapshot = findFrameLoaderSnapshotAt( |
221 rendererHelper, frameIdRef, fmpMarkerEvent.start); | 221 rendererHelper, frameIdRef, fmpMarkerEvent.start); |
222 if (!snapshot || !snapshot.args.isLoadingMainFrame) return; | 222 if (!snapshot || !snapshot.args.isLoadingMainFrame) return; |
223 var url = snapshot.args.documentLoaderURL; | 223 var url = snapshot.args.documentLoaderURL; |
224 if (shouldIgnoreURL(url)) return; | 224 if (shouldIgnoreURL(url)) return; |
225 | 225 |
226 var mainThreadCpuTime = getMainThreadCpuTime(rendererHelper, | 226 var mainThreadCpuTime = getMainThreadCpuTime(rendererHelper, |
227 rangeOfInterest); | 227 rangeOfInterest); |
228 | 228 |
229 var breakdownTree = rendererHelper.generateCpuTimeBreakdownTree( | 229 var breakdownTree = rendererHelper.generateCpuTimeBreakdownTree( |
(...skipping 12 matching lines...) Expand all Loading... |
242 fmp: fmpMarkerEvent.start | 242 fmp: fmpMarkerEvent.start |
243 }), | 243 }), |
244 } | 244 } |
245 }); | 245 }); |
246 } | 246 } |
247 | 247 |
248 function getMainThreadCpuTime(rendererHelper, rangeOfInterest) { | 248 function getMainThreadCpuTime(rendererHelper, rangeOfInterest) { |
249 var mainThreadCpuTime = 0; | 249 var mainThreadCpuTime = 0; |
250 for (var slice of rendererHelper.mainThread.sliceGroup.topLevelSlices) { | 250 for (var slice of rendererHelper.mainThread.sliceGroup.topLevelSlices) { |
251 if (!slice.cpuDuration) continue; | 251 if (!slice.cpuDuration) continue; |
252 var sliceRange = tr.b.Range.fromExplicitRange(slice.cpuStart, | 252 var sliceRange = tr.b.math.Range.fromExplicitRange(slice.cpuStart, |
253 slice.cpuStart + slice.cpuDuration); | 253 slice.cpuStart + slice.cpuDuration); |
254 var intersection = rangeOfInterest.findIntersection(sliceRange); | 254 var intersection = rangeOfInterest.findIntersection(sliceRange); |
255 mainThreadCpuTime += intersection.duration; | 255 mainThreadCpuTime += intersection.duration; |
256 } | 256 } |
257 | 257 |
258 return mainThreadCpuTime; | 258 return mainThreadCpuTime; |
259 } | 259 } |
260 | 260 |
261 function addFirstInteractiveSample(samples, rendererHelper, | 261 function addFirstInteractiveSample(samples, rendererHelper, |
262 navigationStart, firstMeaningfulPaint, url) { | 262 navigationStart, firstMeaningfulPaint, url) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 tr.metrics.MetricRegistry.register(loadingMetric); | 465 tr.metrics.MetricRegistry.register(loadingMetric); |
466 | 466 |
467 return { | 467 return { |
468 loadingMetric, | 468 loadingMetric, |
469 collectLoadingMetricsForRenderer, | 469 collectLoadingMetricsForRenderer, |
470 RESPONSIVENESS_THRESHOLD_MS, | 470 RESPONSIVENESS_THRESHOLD_MS, |
471 INTERACTIVE_WINDOW_SIZE_MS, | 471 INTERACTIVE_WINDOW_SIZE_MS, |
472 }; | 472 }; |
473 }); | 473 }); |
474 </script> | 474 </script> |
OLD | NEW |