2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
10 # Directory path in which to save bootstrap files.
11 BOOTSTRAPPED_FILES_DIR
= 'support/bootstrap_files'
12 PERF_DIR
= 'src/tools/perf'
13 DEPS_FILE
= 'bootstrap_deps'
15 def BootstrapIfNeeded(module_name
, module_path
, module_deps_url
):
16 """Ensures that the given module_name is available, grab from URL if not."""
18 imp
.find_module(module_name
)
21 sys
.path
.append(os
.path
.join(os
.path
.dirname(__file__
),
22 BOOTSTRAPPED_FILES_DIR
,
25 imp
.find_module(module_name
)
28 bootstrap_txt
= urllib
.urlopen('http://src.chromium.org/viewvc/chrome/' +
29 'trunk/src/tools/telemetry_tools/' +
30 'telemetry_bootstrap.py').read()
31 bootstrap
= imp
.new_module('bootstrap')
32 exec bootstrap_txt
in bootstrap
.__dict
__
33 bootstrap
.DownloadDepsURL(os
.path
.join(os
.path
.dirname(__file__
),
34 BOOTSTRAPPED_FILES_DIR
),
38 def ListBootstrapDeps():
39 """List the deps required for telemetry.
41 Returns: a list of telemetry deps.
43 import telemetry_bootstrap
44 deps_file
= os
.path
.join(os
.path
.dirname(perf_tools
.__file
__),
46 return telemetry_bootstrap
.ListAllDepsPaths(open(deps_file
).read())
48 if __name__
== '__main__':
49 BootstrapIfNeeded('perf_tools', PERF_DIR
,
50 'http://src.chromium.org/viewvc/chrome/trunk/src/tools'
51 '/perf/perf_tools/' + DEPS_FILE
)
53 if '--print-bootstrap-deps' in sys
.argv
:
54 print ListBootstrapDeps()
57 from telemetry
.page
import page_measurement_runner
59 measurement_dir
= os
.path
.dirname(perf_tools
.__file
__)
60 page_set_filenames
= page_sets
.GetAllPageSetFilenames()
62 old_benchmark_names
= {
63 "cheapness_predictor_benchmark": "cheapness_predictor_measurement",
64 "image_decoding_benchmark": "image_decoding_measurement",
65 "loading_benchmark": "loading_measurement",
66 "memory_benchmark": "memory_measurement",
67 "rasterize_and_record_benchmark": "rasterize_and_record_benchmark",
68 "scrolling_benchmark": "smoothness_measurement",
69 "smoothness_benchmark": "smoothness_measurement",
70 "startup_benchmark": "startup_measurement"
73 # There are bots that are hard-coded to run some specific named tests.
74 # Convert these to the current naming conventions by overriding them in the runner.
75 class MeasurementRunner(page_measurement_runner
.PageMeasurementRunner
):
76 def GetModernizedTestName(self
, arg
):
77 if arg
not in old_benchmark_names
:
80 'An old name %s was given. Please use %s in the future.\n' % (
82 old_benchmark_names
.get(arg
)))
83 return old_benchmark_names
[arg
]
85 runner
= MeasurementRunner()
86 sys
.exit(runner
.Run(measurement_dir
, page_set_filenames
))