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

Unified Diff: bench/bench_util.py

Issue 201423002: gen_bench_expectations to generate bench expectations files. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adds reference to settings Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/check_bench_regressions.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/bench_util.py
diff --git a/bench/bench_util.py b/bench/bench_util.py
index 29ef1c473b22a59735bd4e1587918ec59d59f280..b6fecb7ca801c62c6e11dae12b053994d54602bc 100644
--- a/bench/bench_util.py
+++ b/bench/bench_util.py
@@ -4,6 +4,7 @@ Created on May 19, 2011
@author: bungeman
'''
+import os
import re
import math
@@ -147,6 +148,39 @@ def _ParseAndStoreTimes(config_re_compiled, is_per_tile, line, bench,
layout_dic.setdefault(bench, {}).setdefault(
current_config, {}).setdefault(current_time_type, tile_layout)
+def parse_skp_bench_data(directory, revision, rep, default_settings=None):
+ """Parses all the skp bench data in the given directory.
+
+ Args:
+ directory: string of path to input data directory.
+ revision: git hash revision that matches the data to process.
+ rep: bench representation algorithm, see bench_util.py.
+ default_settings: dictionary of other run settings. See writer.option() in
+ bench/benchmain.cpp.
+
+ Returns:
+ A list of BenchDataPoint objects.
+ """
+ revision_data_points = []
+ file_list = os.listdir(directory)
+ file_list.sort()
+ for bench_file in file_list:
+ scalar_type = None
+ # Scalar type, if any, is in the bench filename after 'scalar_'.
+ if (bench_file.startswith('bench_' + revision + '_data_')):
+ if bench_file.find('scalar_') > 0:
+ components = bench_file.split('_')
+ scalar_type = components[components.index('scalar') + 1]
+ else: # Skips non skp bench files.
+ continue
+
+ with open('/'.join([directory, bench_file]), 'r') as file_handle:
+ settings = dict(default_settings or {})
+ settings['scalar'] = scalar_type
+ revision_data_points.extend(parse(settings, file_handle, rep))
+
+ return revision_data_points
+
# TODO(bensong): switch to reading JSON output when available. This way we don't
# need the RE complexities.
def parse(settings, lines, representation=None):
« no previous file with comments | « no previous file | bench/check_bench_regressions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698