| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from telemetry.value import scalar |
| 6 |
| 5 from metrics import Metric | 7 from metrics import Metric |
| 6 from telemetry.value import scalar | 8 |
| 7 | 9 |
| 8 class LoadingMetric(Metric): | 10 class LoadingMetric(Metric): |
| 9 """A metric for page loading time based entirely on window.performance""" | 11 """A metric for page loading time based entirely on window.performance""" |
| 10 | 12 |
| 11 def Start(self, page, tab): | 13 def Start(self, page, tab): |
| 12 raise NotImplementedError() | 14 raise NotImplementedError() |
| 13 | 15 |
| 14 def Stop(self, page, tab): | 16 def Stop(self, page, tab): |
| 15 raise NotImplementedError() | 17 raise NotImplementedError() |
| 16 | 18 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 float(load_timings['responseStart']) - load_timings['requestStart']) | 62 float(load_timings['responseStart']) - load_timings['requestStart']) |
| 61 results.AddValue(scalar.ScalarValue( | 63 results.AddValue(scalar.ScalarValue( |
| 62 results.current_page, 'request_duration', 'ms', request_duration, | 64 results.current_page, 'request_duration', 'ms', request_duration, |
| 63 important=False)) | 65 important=False)) |
| 64 | 66 |
| 65 response_duration = ( | 67 response_duration = ( |
| 66 float(load_timings['responseEnd']) - load_timings['responseStart']) | 68 float(load_timings['responseEnd']) - load_timings['responseStart']) |
| 67 results.AddValue(scalar.ScalarValue( | 69 results.AddValue(scalar.ScalarValue( |
| 68 results.current_page, 'response_duration', 'ms', response_duration, | 70 results.current_page, 'response_duration', 'ms', response_duration, |
| 69 important=False)) | 71 important=False)) |
| OLD | NEW |