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

Side by Side Diff: tools/perf/perf_tools/multipage_benchmark_runner.py

Issue 11199003: Create a run_multipage_benchmarks entry point for all benchmarks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address dtu's comments Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
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.
5 import csv
6 import logging
7 import os
8 import sys
9
10 from chrome_remote_control import browser_finder
11 from chrome_remote_control import browser_options
12 from chrome_remote_control import multi_page_benchmark
13 from chrome_remote_control import page_runner
14 from chrome_remote_control import page_set
15
16 import perf_tools.first_paint_time_benchmark
17 import perf_tools.scrolling_benchmark
18 import perf_tools.skpicture_printer
19 import perf_tools.texture_upload_benchmark
20
21 # TODO(tonyg/nduca): Discover benchmarks automagically.
22 _BENCHMARKS = {
23 'first_paint_time_benchmark':
24 perf_tools.first_paint_time_benchmark.FirstPaintTimeBenchmark,
25 'scrolling_benchmark':
26 perf_tools.scrolling_benchmark.ScrollingBenchmark,
27 'skpicture_printer':
28 perf_tools.skpicture_printer.SkPicturePrinter,
29 'texture_upload_benchmark':
30 perf_tools.texture_upload_benchmark.TextureUploadBenchmark
31 }
32
33
34 def Main():
35 """Turns a MultiPageBenchmark into a command-line program.
36
37 If args is not specified, sys.argv[1:] is used.
38 """
39 options = browser_options.BrowserOptions()
40 parser = options.CreateParser('%prog [options] <benchmark> <page_set>')
41 _, args = parser.parse_args()
42
43 if len(args) != 2 or args[0] not in _BENCHMARKS:
44 parser.print_usage()
45 import page_sets # pylint: disable=F0401
46 print >> sys.stderr, 'Available benchmarks:\n%s\n' % ',\n'.join(
47 _BENCHMARKS.keys())
48 print >> sys.stderr, 'Available page_sets:\n%s\n' % ',\n'.join(
49 [os.path.relpath(f) for f in page_sets.GetAllPageSetFilenames()])
50 sys.exit(1)
51
52 benchmark = _BENCHMARKS[args[0]]()
53 ps = page_set.PageSet.FromFile(args[1])
54
55 benchmark.AddOptions(parser)
56 _, args = parser.parse_args()
57
58 benchmark.CustomizeBrowserOptions(options)
59 possible_browser = browser_finder.FindBrowser(options)
60 if not possible_browser:
61 print >> sys.stderr, """No browser found.\n
62 Use --browser=list to figure out which are available.\n"""
63 sys.exit(1)
64
65 results = multi_page_benchmark.CsvBenchmarkResults(csv.writer(sys.stdout))
66 with page_runner.PageRunner(ps) as runner:
67 runner.Run(options, possible_browser, benchmark, results)
68 # When using an exact executable, assume it is a reference build for the
69 # purpose of outputting the perf results.
70 results.PrintSummary(options.browser_executable and '_ref' or '')
71
72 if len(results.page_failures):
73 logging.warning('Failed pages: %s', '\n'.join(
74 [failure['page'].url for failure in results.page_failures]))
75 return max(255, len(results.page_failures))
OLDNEW
« no previous file with comments | « tools/perf/perf_tools/first_paint_time_benchmark.py ('k') | tools/perf/perf_tools/scrolling_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698