diff --git a/python-libs/poulpe/runner.py b/python-libs/poulpe/runner.py index e813d1329fa4204acd87fadb0b689a69d815caea_cHl0aG9uLWxpYnMvcG91bHBlL3J1bm5lci5weQ==..6612a120c6a2b38a8264132205c7b70f8a2f1aae_cHl0aG9uLWxpYnMvcG91bHBlL3J1bm5lci5weQ== 100644 --- a/python-libs/poulpe/runner.py +++ b/python-libs/poulpe/runner.py @@ -64,6 +64,23 @@ all_dimensions = l_2.get('dimensions', {}) return all_dimensions.copy() + def run_one(self, bin_env_path, data_env_path): + data_env_desc = poulpe.data_env_file(data_env_path) + data_env_data = poulpe.get_data(data_env_desc) + + cmd = SimpleCommand(self) + cmd.apply_data_env(data_env_data) + r = _time_command(bin_env_path, data_env_path, cmd) + res = {} + # we should store more + res['time'] = {} + res['time']['median'] = r['results'][0]['median'] + res['time']['mean'] = r['results'][0]['mean'] + res['time']['standard-deviation'] = r['results'][0]['stddev'] + res['time']['min'] = r['results'][0]['min'] + res['time']['max'] = r['results'][0]['max'] + return res + def get_benchmark(path_def): """get a benchmark from path applying possible variant selection on the way @@ -85,6 +102,8 @@ class SimpleCommand(object): + # XXX should probably be merged back (or rebalanced) with the + # SimpleCommandBenchmark class def __init__(self, benchmark_data): self._benchmark_data = benchmark_data @@ -142,9 +161,10 @@ benchmark = get_benchmark(benchmark_path) assert benchmark is not None, benchmark_path + result_data['benchmark'] = {} result_data['benchmark']['name'] = benchmark.name variants = benchmark.selected_variants if variants: result_data['benchmark']['variants'] = variants @@ -145,13 +165,8 @@ result_data['benchmark'] = {} result_data['benchmark']['name'] = benchmark.name variants = benchmark.selected_variants if variants: result_data['benchmark']['variants'] = variants - # building the benchmark scenarion, that will likely changes often and quickly - - cmd = SimpleCommand(benchmark) - cmd.apply_data_env(data_env_data) - - r = _time_command(bin_env_path, data_env_path, cmd) + bench_result = benchmark.run_one(bin_env_path, data_env_path) @@ -157,10 +172,3 @@ - # we should store more - result_data['result'] = {} - result_data['result']['time'] = {} - result_data['result']['time']['median'] = r['results'][0]['median'] - result_data['result']['time']['mean'] = r['results'][0]['mean'] - result_data['result']['time']['standard-deviation'] = r['results'][0]['stddev'] - result_data['result']['time']['min'] = r['results'][0]['min'] - result_data['result']['time']['max'] = r['results'][0]['max'] + result_data['result'] = bench_result @@ -166,5 +174,6 @@ - result_data['run']["duration"] = time.time() - result_data['run']["timestamp"] + duration = time.time() - result_data['run']["timestamp"] + result_data['run']["duration"] = duration poulpe.write_data(result, result_data) return 0