| Index: bench/gen_bench_ranges.py
|
| ===================================================================
|
| --- bench/gen_bench_ranges.py (working copy)
|
| +++ bench/gen_bench_ranges.py (working copy)
|
| @@ -3,16 +3,16 @@
|
| # Use of this source code is governed by a BSD-style license that can be found
|
| # in the LICENSE file.
|
|
|
| -""" Analyze recent SkPicture bench data, and output suggested ranges.
|
| +""" Analyze recent SkPicture or Microbench data, and output suggested ranges.
|
|
|
| The outputs can be edited and pasted to bench_expectations.txt to trigger
|
| buildbot alerts if the actual benches are out of range. Details are documented
|
| in the .txt file.
|
|
|
| -Currently the easiest way to update bench_expectations.txt is to delete all skp
|
| -bench lines, run this script, and redirect outputs (">>") to be added to the
|
| +Currently the easiest way to batch update bench_expectations.txt is to delete
|
| +all bench lines, run this script, and redirect outputs (">>") to be added to the
|
| .txt file.
|
| -TODO(bensong): find a better way for updating the bench lines in place.
|
| +You can also just manually change a few lines of interest, of course.
|
|
|
| Note: since input data are stored in Google Storage, you will need to set up
|
| the corresponding library.
|
| @@ -63,7 +63,7 @@
|
| HOWTO_STRING = """
|
| Feel free to revise PLATFORMS for your own needs. The default is the most common
|
| combination that we care most about. Platforms that did not run bench_pictures
|
| -in the given revision range will not have corresponding outputs.
|
| +or benchmain in the given revision range will not have corresponding outputs.
|
| Please check http://go/skpbench to choose a range that fits your needs.
|
| BENCH_UB, BENCH_LB and BENCH_ALLOWED_NOISE can be changed to expand or narrow
|
| the permitted bench ranges without triggering buidbot alerts.
|
| @@ -71,37 +71,49 @@
|
| HELP_STRING = """
|
| Outputs expectation picture bench ranges for the latest revisions for the given
|
| revision range. For instance, --rev_range=6000:6000 will return only bench
|
| -ranges for the bots that ran bench_pictures at rev 6000; --rev-range=6000:7000
|
| +ranges for the bots that ran benches at rev 6000; --rev-range=6000:7000
|
| may have multiple bench data points for each bench configuration, and the code
|
| returns bench data for the latest revision of all available (closer to 7000).
|
| """ + HOWTO_STRING
|
|
|
| OPTION_REVISION_RANGE = '--rev-range'
|
| OPTION_REVISION_RANGE_SHORT = '-r'
|
| -# Bench bench representation algorithm flag.
|
| +# Bench representation algorithm flag.
|
| OPTION_REPRESENTATION_ALG = '--algorithm'
|
| OPTION_REPRESENTATION_ALG_SHORT = '-a'
|
| +# Bench type to examine. Either 'micro' or 'skp'.
|
| +OPTION_BENCH_TYPE = '--bench-type'
|
| +OPTION_BENCH_TYPE_SHORT = '-b'
|
|
|
| +# List of valid bench types.
|
| +BENCH_TYPES = ['micro', 'skp']
|
| # List of valid representation algorithms.
|
| REPRESENTATION_ALGS = ['avg', 'min', 'med', '25th']
|
|
|
| -def OutputSkpBenchExpectations(rev_min, rev_max, representation_alg):
|
| - """Reads skp bench data from google storage, and outputs expectations.
|
| +def OutputBenchExpectations(bench_type, rev_min, rev_max, representation_alg):
|
| + """Reads bench data from google storage, and outputs expectations.
|
|
|
| Ignores data with revisions outside [rev_min, rev_max] integer range. For
|
| bench data with multiple revisions, we use higher revisions to calculate
|
| expected bench values.
|
| + bench_type is either 'micro' or 'skp', according to the flag '-b'.
|
| Uses the provided representation_alg for calculating bench representations.
|
| """
|
| + if bench_type not in BENCH_TYPES:
|
| + raise Exception('Not valid bench_type! (%s)' % BENCH_TYPES)
|
| expectation_dic = {}
|
| uri = boto.storage_uri(URI_BUCKET, GOOGLE_STORAGE_URI_SCHEME)
|
| for obj in uri.get_bucket():
|
| - # Filters out non-skp-bench files.
|
| + # Filters out non-bench files.
|
| if ((not obj.name.startswith('perfdata/%s' % BENCH_BUILDER_PREFIX) and
|
| not obj.name.startswith(
|
| 'playback/perfdata/%s' % BENCH_BUILDER_PREFIX)) or
|
| - obj.name.find('_data_skp_') < 0):
|
| + obj.name.find('_data') < 0):
|
| continue
|
| + if ((bench_type == 'micro' and obj.name.find('_data_skp_') > 0) or
|
| + (bench_type == 'skp' and obj.name.find('_skp_') < 0)):
|
| + # Skips wrong bench type.
|
| + continue
|
| # Ignores uninterested platforms.
|
| platform = obj.name.split('/')[1]
|
| if not platform.startswith(BENCH_BUILDER_PREFIX):
|
| @@ -140,11 +152,14 @@
|
| bench_val * BENCH_UB + BENCH_ALLOWED_NOISE)
|
|
|
| def main():
|
| - """Parses flags and outputs expected Skia picture bench results."""
|
| + """Parses flags and outputs expected Skia bench results."""
|
| parser = optparse.OptionParser(USAGE_STRING % '%prog' + HELP_STRING)
|
| parser.add_option(OPTION_REVISION_RANGE_SHORT, OPTION_REVISION_RANGE,
|
| dest='rev_range',
|
| help='(Mandatory) revision range separated by ":", e.g., 6000:6005')
|
| + parser.add_option(OPTION_BENCH_TYPE_SHORT, OPTION_BENCH_TYPE,
|
| + dest='bench_type', default='skp',
|
| + help=('Bench type, either "skp" or "micro". Default to "skp".'))
|
| parser.add_option(OPTION_REPRESENTATION_ALG_SHORT, OPTION_REPRESENTATION_ALG,
|
| dest='alg', default='25th',
|
| help=('Bench representation algorithm. One of '
|
| @@ -157,7 +172,7 @@
|
| else:
|
| rev_min = int(range_match.group(1))
|
| rev_max = int(range_match.group(2))
|
| - OutputSkpBenchExpectations(rev_min, rev_max, options.alg)
|
| + OutputBenchExpectations(options.bench_type, rev_min, rev_max, options.alg)
|
| else:
|
| parser.error('Please provide mandatory flag %s' % OPTION_REVISION_RANGE)
|
|
|
|
|