summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwiltzius@chromium.org <wiltzius@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-30 17:23:35 +0000
committerwiltzius@chromium.org <wiltzius@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-30 17:23:35 +0000
commit8ac3cee2fcff59c6ff84fb6581760a1e2468f908 (patch)
treef029cae6297738cac5f62093b3875ef5fa656ea9
parent313fce134c61dec50b093020eed8b94a163c24b0 (diff)
downloadchromium_src-8ac3cee2fcff59c6ff84fb6581760a1e2468f908.zip
chromium_src-8ac3cee2fcff59c6ff84fb6581760a1e2468f908.tar.gz
chromium_src-8ac3cee2fcff59c6ff84fb6581760a1e2468f908.tar.bz2
Use the Telemetry bootstrap for run_multipage_benchmarks
Modifies the run_multipage_benchmarks script to attempt importing perf_tools and telemetry in this order: 1. Directly (i.e. if you're in a Chrome checkout) 2. From a local 'bootstrap-files' directory that is a skeletal Chrome checkout (i.e. if you've already bootstrapped the required files) If both fail, then suggests running with --bootstrap to download the necessary files into a skeletal Chrome checkout. Note that #2 means the run_multipage_benchmarks script needs to know where in the Chrome tree the perf_tools and telemetry modules live, but I can't think of a cleaner way to do it. BUG=162301 Review URL: https://chromiumcodereview.appspot.com/11953004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179658 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--tools/perf/perf_lib/bootstrap_deps20
-rwxr-xr-xtools/perf/run_multipage_benchmarks35
-rw-r--r--tools/telemetry/tools/telemetry_bootstrap.py31
3 files changed, 84 insertions, 2 deletions
diff --git a/tools/perf/perf_lib/bootstrap_deps b/tools/perf/perf_lib/bootstrap_deps
new file mode 100644
index 0000000..f5cdb95
--- /dev/null
+++ b/tools/perf/perf_lib/bootstrap_deps
@@ -0,0 +1,20 @@
+# Copyright (c) 2012 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.
+
+# This file specifies dependencies required to bootstrap perf_tools. It is in a
+# minimal version of the format used by other DEPS files that gclient can read,
+# but it should only be used to bootstrap perf_tools *outside* of a normal
+# Chrome checkout.
+
+deps = {
+ "src/tools/perf/perf_tools":
+ "https://src.chromium.org/chrome/trunk/src/tools/perf/perf_tools",
+ "src/tools/perf/page_sets":
+ "https://src.chromium.org/chrome/trunk/src/tools/perf/page_sets",
+ }
+
+# perf_tools depends on Telemetry, so pull in the Telemetry deps, too.
+deps_includes = [
+ "https://src.chromium.org/chrome/trunk/src/tools/telemetry/tools/bootstrap_deps"
+ ]
diff --git a/tools/perf/run_multipage_benchmarks b/tools/perf/run_multipage_benchmarks
index ac22e43..c25c433 100755
--- a/tools/perf/run_multipage_benchmarks
+++ b/tools/perf/run_multipage_benchmarks
@@ -2,12 +2,43 @@
# Copyright (c) 2012 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.
+import imp
import os
import sys
+import urllib
+
+# Directory path in which to save bootstrap files.
+BOOTSTRAPPED_FILES_DIR = 'support/bootstrap_files'
+
+
+def bootstrapIfNeeded(module_name, module_path, module_deps_url):
+ """Ensures that the given module_name is available, grab from URL if not."""
+ try:
+ imp.find_module(module_name)
+ return
+ except ImportError:
+ sys.path.append(os.path.join(os.path.dirname(__file__),
+ BOOTSTRAPPED_FILES_DIR,
+ module_path))
+ try:
+ imp.find_module(module_name)
+ return
+ except ImportError:
+ bootstrap_txt = urllib.urlopen('http://src.chromium.org/viewvc/chrome/' +
+ 'trunk/src/tools/telemetry/tools/' +
+ 'telemetry_bootstrap.py').read()
+ bootstrap = imp.new_module('bootstrap')
+ exec bootstrap_txt in bootstrap.__dict__
+ bootstrap.DownloadDepsURL(os.path.join(os.path.dirname(__file__),
+ BOOTSTRAPPED_FILES_DIR),
+ module_deps_url)
-import perf_tools
-from telemetry import multi_page_benchmark_runner
if __name__ == '__main__':
+ bootstrapIfNeeded('perf_tools', 'src/tools/perf',
+ 'http://src.chromium.org/viewvc/chrome/trunk/src/tools/' +
+ 'perf/perf_lib/bootstrap_deps')
+ import perf_tools
+ from telemetry import multi_page_benchmark_runner
benchmark_dir = os.path.join(os.path.dirname(__file__), 'perf_tools')
sys.exit(multi_page_benchmark_runner.Main(benchmark_dir))
diff --git a/tools/telemetry/tools/telemetry_bootstrap.py b/tools/telemetry/tools/telemetry_bootstrap.py
index b0bbb96..989958b 100644
--- a/tools/telemetry/tools/telemetry_bootstrap.py
+++ b/tools/telemetry/tools/telemetry_bootstrap.py
@@ -89,6 +89,32 @@ class DAVClientWrapper():
os.path.join(dst_path, subdir))
+def ListAllDepsPaths(deps_content):
+ """Recursively returns a list of all paths indicated in this deps file.
+
+ Note that this discards information about where path dependencies come from,
+ so this is only useful in the context of a Chromium source checkout that has
+ used gclient to already fetch all dependencies.
+
+ Args:
+ deps_content: String containing deps information to be evaluated, in the
+ format given in the header of this file.
+ Returns: A list of string paths starting under src that are required by the
+ given deps file, and all of its sub-dependencies. This amounts to
+ the keys of the 'deps' dictionary.
+ """
+ deps = imp.new_module('deps')
+ exec deps_content in deps.__dict__
+
+ deps_paths = deps.deps.keys()
+
+ if hasattr(deps, 'deps_includes'):
+ for url in deps.deps_includes:
+ deps_paths = deps_paths + ListAllDepsPaths(urllib.urlopen(url).read())
+
+ return deps_paths
+
+
def DownloadDepsURL(destination_dir, url):
"""Wrapper around DownloadDeps that takes a string URL to the deps file.
@@ -96,6 +122,7 @@ def DownloadDepsURL(destination_dir, url):
destination_dir: String path to local directory to download files into.
url: URL of deps file (see DownloadDeps for format).
"""
+ logging.warning('Downloading deps from %s...', url)
DownloadDeps(destination_dir, urllib.urlopen(url).read())
@@ -124,3 +151,7 @@ def DownloadDeps(destination_dir, deps_content):
dav_client = DAVClientWrapper(root_url)
dav_client.Traverse(parsed_url.path, full_dst_path)
+ if hasattr(deps, 'deps_includes'):
+ for url in deps.deps_includes:
+ DownloadDepsURL(destination_dir, url)
+