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

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

Issue 1041213003: 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 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))
« 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