| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import imp | 6 import imp |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import urllib2 | 9 import urllib2 |
| 10 | 10 |
| 11 | 11 |
| 12 BASE_URL = 'http://src.chromium.org/chrome/trunk/' | 12 BASE_URL = 'http://src.chromium.org/chrome/trunk/' |
| 13 DEPS_FILE = 'bootstrap_deps' | 13 DEPS_FILE = 'bootstrap_deps' |
| 14 | 14 |
| 15 SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) | 15 SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) |
| 16 # Directory containing src/ in a Chromium checkout. | 16 # Directory containing src/ in a Chromium checkout. |
| 17 CHECKOUT_BASE_PATH = os.path.join(SCRIPT_PATH, os.pardir, os.pardir, os.pardir) | 17 CHECKOUT_BASE_PATH = os.path.join(SCRIPT_PATH, os.pardir, os.pardir, os.pardir) |
| 18 # Directory in which to save bootstrap files. | 18 # Directory in which to save bootstrap files. |
| 19 BOOTSTRAP_BASE_PATH = os.path.join(SCRIPT_PATH, 'support', 'bootstrap_files') | 19 BOOTSTRAP_BASE_PATH = os.path.join(SCRIPT_PATH, 'support', 'bootstrap_files') |
| 20 | 20 |
| 21 CROS_DIR = os.path.join('src', 'tools', 'cros') |
| 21 PERF_DIR = os.path.join('src', 'tools', 'perf') | 22 PERF_DIR = os.path.join('src', 'tools', 'perf') |
| 22 TELEMETRY_DIR = os.path.join('src', 'tools', 'telemetry') | 23 TELEMETRY_DIR = os.path.join('src', 'tools', 'telemetry') |
| 23 TELEMETRY_TOOLS_DIR = os.path.join('src', 'tools', 'telemetry_tools') | 24 TELEMETRY_TOOLS_DIR = os.path.join('src', 'tools', 'telemetry_tools') |
| 24 | 25 |
| 25 | 26 |
| 26 def _GetBasePath(): | 27 def _GetBasePath(): |
| 27 """Find the location of our Chromium or bootstrap checkout. | 28 """Find the location of our Chromium or bootstrap checkout. |
| 28 | 29 |
| 29 It tries to import Telemetry. If the import succeeds, | 30 It tries to import Telemetry. If the import succeeds, |
| 30 we assume that's the correct location. | 31 we assume that's the correct location. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 def _Bootstrap(bootstrap_deps_url): | 56 def _Bootstrap(bootstrap_deps_url): |
| 56 """Grab all the deps listed in the file at bootstrap_deps_url.""" | 57 """Grab all the deps listed in the file at bootstrap_deps_url.""" |
| 57 bootstrap_txt = urllib2.urlopen( | 58 bootstrap_txt = urllib2.urlopen( |
| 58 BASE_URL + 'src/tools/telemetry_tools/telemetry_bootstrap.py').read() | 59 BASE_URL + 'src/tools/telemetry_tools/telemetry_bootstrap.py').read() |
| 59 bootstrap = imp.new_module('bootstrap') | 60 bootstrap = imp.new_module('bootstrap') |
| 60 exec bootstrap_txt in bootstrap.__dict__ | 61 exec bootstrap_txt in bootstrap.__dict__ |
| 61 bootstrap.DownloadDeps(BOOTSTRAP_BASE_PATH, bootstrap_deps_url) | 62 bootstrap.DownloadDeps(BOOTSTRAP_BASE_PATH, bootstrap_deps_url) |
| 62 | 63 |
| 63 | 64 |
| 64 def ListBootstrapDeps(base_path): | 65 def ListBootstrapDeps(base_path, subdir): |
| 65 """List the deps required for telemetry.""" | 66 """List the deps required for telemetry.""" |
| 66 sys.path.append(os.path.join(base_path, TELEMETRY_TOOLS_DIR)) | 67 sys.path.append(os.path.join(base_path, TELEMETRY_TOOLS_DIR)) |
| 67 import telemetry_bootstrap | 68 import telemetry_bootstrap |
| 68 | 69 |
| 69 deps_file = os.path.join(base_path, PERF_DIR, DEPS_FILE) | 70 deps_file = os.path.join(base_path, subdir, DEPS_FILE) |
| 70 return telemetry_bootstrap.ListAllDepsPaths(deps_file) | 71 return telemetry_bootstrap.ListAllDepsPaths(deps_file) |
| 71 | 72 |
| 72 | 73 |
| 73 def Main(): | 74 def Main(): |
| 74 if not _GetBasePath(): | 75 if not _GetBasePath(): |
| 75 _Bootstrap(BASE_URL + 'src/tools/perf/' + DEPS_FILE) | 76 _Bootstrap(BASE_URL + 'src/tools/perf/' + DEPS_FILE) |
| 76 | 77 |
| 77 new_base_path = _GetBasePath() | 78 new_base_path = _GetBasePath() |
| 78 new_perf_path = os.path.join(new_base_path, PERF_DIR) | 79 new_perf_path = os.path.join(new_base_path, PERF_DIR) |
| 79 new_telemetry_path = os.path.join(new_base_path, TELEMETRY_DIR) | 80 new_telemetry_path = os.path.join(new_base_path, TELEMETRY_DIR) |
| 80 | 81 |
| 82 if '--print-bootstrap-deps-cros' in sys.argv: |
| 83 print ListBootstrapDeps(new_base_path, CROS_DIR) |
| 84 return 0 |
| 85 |
| 81 if '--print-bootstrap-deps' in sys.argv: | 86 if '--print-bootstrap-deps' in sys.argv: |
| 82 print ListBootstrapDeps(new_base_path) | 87 print ListBootstrapDeps(new_base_path, PERF_DIR) |
| 83 return 0 | 88 return 0 |
| 84 | 89 |
| 85 sys.path.append(new_perf_path) | 90 sys.path.append(new_perf_path) |
| 86 import page_sets | 91 import page_sets |
| 87 page_set_filenames = page_sets.GetAllPageSetFilenames() | 92 page_set_filenames = page_sets.GetAllPageSetFilenames() |
| 88 | 93 |
| 89 old_benchmark_names = { | 94 old_benchmark_names = { |
| 90 "image_decoding_benchmark": "image_decoding", | 95 "image_decoding_benchmark": "image_decoding", |
| 91 "image_decoding_measurement": "image_decoding", | 96 "image_decoding_measurement": "image_decoding", |
| 92 "loading_benchmark": "loading", | 97 "loading_benchmark": "loading", |
| (...skipping 26 matching lines...) Expand all Loading... |
| 119 arg, | 124 arg, |
| 120 old_benchmark_names.get(arg))) | 125 old_benchmark_names.get(arg))) |
| 121 return old_benchmark_names[arg] | 126 return old_benchmark_names[arg] |
| 122 | 127 |
| 123 runner = MeasurementRunner() | 128 runner = MeasurementRunner() |
| 124 return runner.Run(new_perf_path, page_set_filenames) | 129 return runner.Run(new_perf_path, page_set_filenames) |
| 125 | 130 |
| 126 | 131 |
| 127 if __name__ == '__main__': | 132 if __name__ == '__main__': |
| 128 sys.exit(Main()) | 133 sys.exit(Main()) |
| OLD | NEW |