Skip to content

Commit

Permalink
Add a simple NavigateMeasurement to measure time taken in navigate_steps
Browse files Browse the repository at this point in the history
This is useful for pages (such as chromestatus.com) where the 'load' event
is not a good signal for 'page ready', but where there's some other condition,
easily expressible in navigate_steps, of that readiness.

R=dtu@chromium.org

Review URL: https://codereview.chromium.org/108303010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241888 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
adamk@chromium.org committed Dec 19, 2013
1 parent 71b03cd commit abd613a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tools/perf/measurements/navigate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from telemetry.page import page_measurement

class NavigateMeasurement(page_measurement.PageMeasurement):
""" Measures time between navigation start and the end of the navigate_steps
For pages where the 'load' event isn't a good measurement point, this
measurement allows a page_set to have its loading sequence listed by
way of navigate_steps, with a navigation_time result measured
by performance.now().
"""
def __init__(self):
super(NavigateMeasurement, self).__init__()
self._navigate_time = None

def DidNavigateToPage(self, page, tab):
self._navigate_time = int(tab.EvaluateJavaScript('performance.now()'))

def MeasurePage(self, page, tab, results):
results.Add('navigate_time', 'ms', self._navigate_time)

0 comments on commit abd613a

Please sign in to comment.