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

Side by Side Diff: tools/perf/benchmarks/speedometer.py

Issue 809393002: Added support for improvement_direction to relevant values, which is propogated to chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linter issues Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Apple's Speedometer performance benchmark. 5 """Apple's Speedometer performance benchmark.
6 6
7 Speedometer measures simulated user interactions in web applications. 7 Speedometer measures simulated user interactions in web applications.
8 8
9 The current benchmark uses TodoMVC to simulate user actions for adding, 9 The current benchmark uses TodoMVC to simulate user actions for adding,
10 completing, and removing to-do items. Speedometer repeats the same actions using 10 completing, and removing to-do items. Speedometer repeats the same actions using
11 DOM APIs - a core set of web platform APIs used extensively in web applications- 11 DOM APIs - a core set of web platform APIs used extensively in web applications-
12 as well as six popular JavaScript frameworks: Ember.js, Backbone.js, jQuery, 12 as well as six popular JavaScript frameworks: Ember.js, Backbone.js, jQuery,
13 AngularJS, React, and Flight. Many of these frameworks are used on the most 13 AngularJS, React, and Flight. Many of these frameworks are used on the most
14 popular websites in the world, such as Facebook and Twitter. The performance of 14 popular websites in the world, such as Facebook and Twitter. The performance of
15 these types of operations depends on the speed of the DOM APIs, the JavaScript 15 these types of operations depends on the speed of the DOM APIs, the JavaScript
16 engine, CSS style resolution, layout, and other technologies. 16 engine, CSS style resolution, layout, and other technologies.
17 """ 17 """
18 18
19 import os 19 import os
20 20
21 from telemetry import benchmark 21 from telemetry import benchmark
22 from telemetry import page as page_module 22 from telemetry import page as page_module
23 from telemetry.page import page_set 23 from telemetry.page import page_set
24 from telemetry.page import page_test 24 from telemetry.page import page_test
25 from telemetry.value import improvement_direction
25 from telemetry.value import list_of_scalar_values 26 from telemetry.value import list_of_scalar_values
26 27
27 28
28 class SpeedometerMeasurement(page_test.PageTest): 29 class SpeedometerMeasurement(page_test.PageTest):
29 enabled_suites = [ 30 enabled_suites = [
30 'VanillaJS-TodoMVC', 31 'VanillaJS-TodoMVC',
31 'EmberJS-TodoMVC', 32 'EmberJS-TodoMVC',
32 'BackboneJS-TodoMVC', 33 'BackboneJS-TodoMVC',
33 'jQuery-TodoMVC', 34 'jQuery-TodoMVC',
34 'AngularJS-TodoMVC', 35 'AngularJS-TodoMVC',
(...skipping 20 matching lines...) Expand all
55 benchmarkClient._measuredValues.push(measuredValues); 56 benchmarkClient._measuredValues.push(measuredValues);
56 benchmarkClient._timeValues.push(measuredValues.total); 57 benchmarkClient._timeValues.push(measuredValues.total);
57 }; 58 };
58 benchmarkClient.iterationCount = %d; 59 benchmarkClient.iterationCount = %d;
59 startTest(); 60 startTest();
60 """ % iterationCount) 61 """ % iterationCount)
61 tab.WaitForJavaScriptExpression( 62 tab.WaitForJavaScriptExpression(
62 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) 63 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600)
63 results.AddValue(list_of_scalar_values.ListOfScalarValues( 64 results.AddValue(list_of_scalar_values.ListOfScalarValues(
64 page, 'Total', 'ms', 65 page, 'Total', 'ms',
65 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True)) 66 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True,
67 improvement_direction=improvement_direction.DOWN))
66 68
67 # Extract the timings for each suite 69 # Extract the timings for each suite
68 for suite_name in self.enabled_suites: 70 for suite_name in self.enabled_suites:
69 results.AddValue(list_of_scalar_values.ListOfScalarValues( 71 results.AddValue(list_of_scalar_values.ListOfScalarValues(
70 page, suite_name, 'ms', 72 page, suite_name, 'ms',
71 tab.EvaluateJavaScript(""" 73 tab.EvaluateJavaScript("""
72 var suite_times = []; 74 var suite_times = [];
73 for(var i = 0; i < benchmarkClient.iterationCount; i++) { 75 for(var i = 0; i < benchmarkClient.iterationCount; i++) {
74 suite_times.push( 76 suite_times.push(
75 benchmarkClient._measuredValues[i].tests['%s'].total); 77 benchmarkClient._measuredValues[i].tests['%s'].total);
76 }; 78 };
77 suite_times; 79 suite_times;
78 """ % suite_name), important=False)) 80 """ % suite_name), important=False,
81 improvement_direction=improvement_direction.DOWN))
79 82
80 class Speedometer(benchmark.Benchmark): 83 class Speedometer(benchmark.Benchmark):
81 test = SpeedometerMeasurement 84 test = SpeedometerMeasurement
82 85
83 def CreatePageSet(self, options): 86 def CreatePageSet(self, options):
84 ps = page_set.PageSet( 87 ps = page_set.PageSet(
85 file_path=os.path.abspath(__file__), 88 file_path=os.path.abspath(__file__),
86 archive_data_file='../page_sets/data/speedometer.json', 89 archive_data_file='../page_sets/data/speedometer.json',
87 bucket=page_set.PUBLIC_BUCKET) 90 bucket=page_set.PUBLIC_BUCKET)
88 ps.AddUserStory(page_module.Page( 91 ps.AddUserStory(page_module.Page(
89 'http://browserbench.org/Speedometer/', ps, ps.base_dir, 92 'http://browserbench.org/Speedometer/', ps, ps.base_dir,
90 make_javascript_deterministic=False)) 93 make_javascript_deterministic=False))
91 return ps 94 return ps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698