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

Side by Side Diff: tools/telemetry/telemetry/benchmark_runner.py

Issue 1244223002: Create classes_util API, change discover to return a list instead of a dict. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Parses the command line, discovers the appropriate benchmarks, and runs them. 5 """Parses the command line, discovers the appropriate benchmarks, and runs them.
6 6
7 Handles benchmark configuration, but all the logic for 7 Handles benchmark configuration, but all the logic for
8 actually running the benchmark is in Benchmark and PageRunner.""" 8 actually running the benchmark is in Benchmark and PageRunner."""
9 9
10 import hashlib 10 import hashlib
11 import inspect 11 import inspect
12 import json 12 import json
13 import os 13 import os
14 import sys 14 import sys
15 15
16 from telemetry import benchmark 16 from telemetry import benchmark
17 from telemetry.core import discover
18 from telemetry import decorators 17 from telemetry import decorators
19 from telemetry.internal.browser import browser_finder 18 from telemetry.internal.browser import browser_finder
20 from telemetry.internal.browser import browser_options 19 from telemetry.internal.browser import browser_options
21 from telemetry.internal.util import command_line 20 from telemetry.internal.util import command_line
21 from telemetry.util import classes_util
22 22
23 23
24 def PrintBenchmarkList(benchmarks, possible_browser, output_pipe=sys.stdout): 24 def PrintBenchmarkList(benchmarks, possible_browser, output_pipe=sys.stdout):
25 """ Print benchmarks that are not filtered in the same order of benchmarks in 25 """ Print benchmarks that are not filtered in the same order of benchmarks in
26 the |benchmarks| list. 26 the |benchmarks| list.
27 27
28 Args: 28 Args:
29 benchmarks: the list of benchmarks to be printed (in the same order of the 29 benchmarks: the list of benchmarks to be printed (in the same order of the
30 list). 30 list).
31 possible_browser: the possible_browser instance that's used for checking 31 possible_browser: the possible_browser instance that's used for checking
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 yield cls 257 yield cls
258 258
259 def _MatchingCommands(string): 259 def _MatchingCommands(string):
260 return [command for command in _Commands() 260 return [command for command in _Commands()
261 if command.Name().startswith(string)] 261 if command.Name().startswith(string)]
262 262
263 @decorators.Cache 263 @decorators.Cache
264 def _Benchmarks(environment): 264 def _Benchmarks(environment):
265 benchmarks = [] 265 benchmarks = []
266 for search_dir in environment.benchmark_dirs: 266 for search_dir in environment.benchmark_dirs:
267 benchmarks += discover.DiscoverClasses(search_dir, 267 benchmarks += classes_util.DiscoverClasses(search_dir,
268 environment.top_level_dir, 268 environment.top_level_dir,
269 benchmark.Benchmark, 269 benchmark.Benchmark)
270 index_by_class_name=True).values()
271 return benchmarks 270 return benchmarks
272 271
273 def _MatchBenchmarkName(input_benchmark_name, environment, exact_matches=True): 272 def _MatchBenchmarkName(input_benchmark_name, environment, exact_matches=True):
274 def _Matches(input_string, search_string): 273 def _Matches(input_string, search_string):
275 if search_string.startswith(input_string): 274 if search_string.startswith(input_string):
276 return True 275 return True
277 for part in search_string.split('.'): 276 for part in search_string.split('.'):
278 if part.startswith(input_string): 277 if part.startswith(input_string):
279 return True 278 return True
280 return False 279 return False
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 409
411 # Parse and run the command. 410 # Parse and run the command.
412 parser = command.CreateParser() 411 parser = command.CreateParser()
413 command.AddCommandLineArgs(parser, environment) 412 command.AddCommandLineArgs(parser, environment)
414 options, args = parser.parse_args() 413 options, args = parser.parse_args()
415 if commands: 414 if commands:
416 args = args[1:] 415 args = args[1:]
417 options.positional_args = args 416 options.positional_args = args
418 command.ProcessCommandLineArgs(parser, options, environment) 417 command.ProcessCommandLineArgs(parser, options, environment)
419 return command().Run(options) 418 return command().Run(options)
OLDNEW
« no previous file with comments | « tools/perf/profile_creators/profile_generator.py ('k') | tools/telemetry/telemetry/core/discover.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698