Index: bench/bench_util.py |
diff --git a/bench/bench_util.py b/bench/bench_util.py |
index 29ef1c473b22a59735bd4e1587918ec59d59f280..b184e11d6c8b15ebe5fc785db321b45fdc6e83a2 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,41 @@ 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. |
borenet
2014/03/17 19:14:42
Can you give some examples of what these run setti
benchen
2014/03/17 19:37:54
Added some. Seems like this is currently only used
borenet
2014/03/17 20:07:26
hmm.. Are all of the acceptable settings documente
|
+ |
+ Returns: |
+ A list of BenchDataPoint objects. |
+ """ |
+ if not default_settings: |
+ default_settings = {} |
+ |
+ 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 = default_settings |
borenet
2014/03/17 19:14:42
This will point to the same object and will theref
benchen
2014/03/17 19:37:54
ah right. fixed.
On 2014/03/17 19:14:42, borenet w
|
+ 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): |