Chromium Code Reviews| Index: tools/perf/metrics/startup_metric.py |
| diff --git a/tools/perf/metrics/startup_metric.py b/tools/perf/metrics/startup_metric.py |
| index af1e3fff5a326b65e596e6f9c420e162bf3d8836..dd04416a386d3170d44a3f955373b7d87bbf9232 100644 |
| --- a/tools/perf/metrics/startup_metric.py |
| +++ b/tools/perf/metrics/startup_metric.py |
| @@ -47,23 +47,12 @@ class StartupMetric(Metric): |
| tab_load_times = [] |
| TabLoadTime = collections.namedtuple( |
| 'TabLoadTime', |
| - ['load_start_ms', 'load_duration_ms', 'request_start_ms']) |
| + ['request_start_ms', 'load_end_ms']) |
|
nednguyen
2015/03/30 21:25:41
What is this renaming about?
cylee1
2015/03/31 10:52:27
load_start_ms + load_duration_ms = load_end_ms
it'
|
| def RecordTabLoadTime(t): |
| try: |
| - t.WaitForDocumentReadyStateToBeComplete() |
| - |
| - result = t.EvaluateJavaScript( |
| - 'statsCollectionController.tabLoadTiming()') |
| - result = json.loads(result) |
| - |
|
nednguyen
2015/03/30 21:25:41
What are these change about?
cylee1
2015/03/31 10:52:27
Explained in mail.
|
| - if 'load_start_ms' not in result or 'load_duration_ms' not in result: |
| - raise Exception("Outdated Chrome version, " |
| - "statsCollectionController.tabLoadTiming() not present") |
| - if result['load_duration_ms'] is None: |
| - tab_title = t.EvaluateJavaScript('document.title') |
| - print "Page: ", tab_title, " didn't finish loading." |
| - return |
| + t.WaitForJavaScriptExpression( |
| + 'window.performance.timing["loadEventEnd"] > 0', 10) |
| perf_timing = t.EvaluateJavaScript('window.performance.timing') |
| if 'requestStart' not in perf_timing: |
| @@ -71,9 +60,8 @@ class StartupMetric(Metric): |
| print 'requestStart is not supported by this browser' |
| tab_load_times.append(TabLoadTime( |
| - int(result['load_start_ms']), |
| - int(result['load_duration_ms']), |
| - int(perf_timing['requestStart']))) |
| + int(perf_timing['requestStart']), |
| + int(perf_timing['loadEventEnd']))) |
| except exceptions.TimeoutException: |
| # Low memory Android devices may not be able to load more than |
| # one tab at a time, so may timeout when the test attempts to |
| @@ -89,8 +77,8 @@ class StartupMetric(Metric): |
| RecordTabLoadTime(tab.browser.foreground_tab) |
| foreground_tab_stats = tab_load_times[0] |
| - foreground_tab_load_complete = ((foreground_tab_stats.load_start_ms + |
| - foreground_tab_stats.load_duration_ms) - browser_main_entry_time_ms) |
| + foreground_tab_load_complete = ( |
| + foreground_tab_stats.load_end_ms - browser_main_entry_time_ms) |
| results.AddValue(scalar.ScalarValue( |
| results.current_page, 'foreground_tab_load_complete', 'ms', |
| foreground_tab_load_complete)) |