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

Unified Diff: tools/perf/metrics/startup_metric.py

Issue 1051813002: Revert of Fix startup_metric racing condition: It used to wait t.WaitForDocumentReadyStateToBeComplete() befo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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: tools/perf/metrics/startup_metric.py
diff --git a/tools/perf/metrics/startup_metric.py b/tools/perf/metrics/startup_metric.py
index dd04416a386d3170d44a3f955373b7d87bbf9232..af1e3fff5a326b65e596e6f9c420e162bf3d8836 100644
--- a/tools/perf/metrics/startup_metric.py
+++ b/tools/perf/metrics/startup_metric.py
@@ -47,12 +47,23 @@
tab_load_times = []
TabLoadTime = collections.namedtuple(
'TabLoadTime',
- ['request_start_ms', 'load_end_ms'])
+ ['load_start_ms', 'load_duration_ms', 'request_start_ms'])
def RecordTabLoadTime(t):
try:
- t.WaitForJavaScriptExpression(
- 'window.performance.timing["loadEventEnd"] > 0', 10)
+ t.WaitForDocumentReadyStateToBeComplete()
+
+ result = t.EvaluateJavaScript(
+ 'statsCollectionController.tabLoadTiming()')
+ result = json.loads(result)
+
+ 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
perf_timing = t.EvaluateJavaScript('window.performance.timing')
if 'requestStart' not in perf_timing:
@@ -60,8 +71,9 @@
print 'requestStart is not supported by this browser'
tab_load_times.append(TabLoadTime(
- int(perf_timing['requestStart']),
- int(perf_timing['loadEventEnd'])))
+ int(result['load_start_ms']),
+ int(result['load_duration_ms']),
+ int(perf_timing['requestStart'])))
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
@@ -77,8 +89,8 @@
RecordTabLoadTime(tab.browser.foreground_tab)
foreground_tab_stats = tab_load_times[0]
- foreground_tab_load_complete = (
- foreground_tab_stats.load_end_ms - browser_main_entry_time_ms)
+ foreground_tab_load_complete = ((foreground_tab_stats.load_start_ms +
+ foreground_tab_stats.load_duration_ms) - browser_main_entry_time_ms)
results.AddValue(scalar.ScalarValue(
results.current_page, 'foreground_tab_load_complete', 'ms',
foreground_tab_load_complete))
« 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