def read_exec_time(filename): if not os.path.exists(filename): return None assert isinstance(filename, str) with open(filename, "r") as f: sexp = sexpdata.loads(f.read()) m = sexp_to_map(sexp) return geometric_mean([parse_time(t) for t in m["raw_execution_time"]])
def load_execution_time(execution_stats_file): with open(execution_stats_file) as f: execution_stats_sexp = sexpdata.load(f) m = inlining_tree.sexp_to_map(execution_stats_sexp) execution_time = inlining_tree.geometric_mean([ inlining_tree.parse_time(inlining_tree.unpack_atom(x)) for x in m["raw_execution_time"] ]) return execution_time
def read_plugin_times(benchmark, plugin_name): bench_dir = "../results/%s/%s/" % (benchmark, PLUGIN_SUBDIR) with open(os.path.join(bench_dir, "plugin_%s.csv" % plugin_name), "rb") as f: times = [] for line in csv.reader(f): for i in range(4, len(line)): times.append(parse_time(line[i])) if len(times) >= 1: return geometric_mean(times) else: return None
def get_initial_time_from_records(benchmark): initial_exec_times = [] try: with open("../pca-data/%s.csv" % benchmark, "rb") as f: for line in csv.reader(f): t = parse_time(line[-1] + "s") if "initial" in line[0]: initial_exec_times.append(t) if initial_exec_times: return geometric_mean(initial_exec_times) else: return None except IOError: return None