1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# 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.
"""Runs a Google Maps performance test.
Rerforms several common navigation actions on the map (pan, zoom, rotate)"""
import os
import re
from core import perf_benchmark
from telemetry import benchmark
from telemetry.core import util
from telemetry.page import page as page_module
from telemetry.page import page_test
from telemetry import story
from telemetry.value import scalar
class _MapsMeasurement(page_test.PageTest):
def __init__(self):
super(_MapsMeasurement, self).__init__()
def ValidateAndMeasurePage(self, page, tab, results):
js_get_results = 'document.getElementsByTagName("pre")[0].innerText'
test_results = tab.EvaluateJavaScript(js_get_results)
total = re.search('total=([0-9]+)', test_results).group(1)
render = re.search('render=([0-9.]+),([0-9.]+)', test_results).group(2)
results.AddValue(scalar.ScalarValue(
results.current_page, 'total_time', 'ms', int(total)))
results.AddValue(scalar.ScalarValue(
results.current_page, 'render_mean_time', 'ms', float(render)))
class MapsPage(page_module.Page):
def __init__(self, page_set, base_dir):
super(MapsPage, self).__init__(
url='http://localhost:10020/tracker.html',
page_set=page_set,
base_dir=base_dir,
make_javascript_deterministic=False)
def RunNavigateSteps(self, action_runner):
super(MapsPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition('window.testDone')
@benchmark.Disabled
class MapsBenchmark(perf_benchmark.PerfBenchmark):
"""Basic Google Maps benchmarks."""
test = _MapsMeasurement
@classmethod
def Name(cls):
return 'maps'
def CreateStorySet(self, options):
page_set_path = os.path.join(
util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets')
ps = story.StorySet(
archive_data_file='data/maps.json', base_dir=page_set_path,
cloud_storage_bucket=story.PUBLIC_BUCKET)
ps.AddStory(MapsPage(ps, ps.base_dir))
return ps
class MapsNoVsync(MapsBenchmark):
"""Runs the Google Maps benchmark with Vsync disabled"""
tag = 'novsync'
@classmethod
def Name(cls):
return 'maps.novsync'
def SetExtraBrowserOptions(self, options):
options.AppendExtraBrowserArgs('--disable-gpu-vsync')
|