From f55c6a35fba2851ba909cab433f0a94f8a1d4107 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 30 Sep 2018 13:23:52 +0200 Subject: Add model to benchmarks --- scripts/serd_bench.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/serd_bench.py b/scripts/serd_bench.py index 2ecaf8eb..018734c4 100755 --- a/scripts/serd_bench.py +++ b/scripts/serd_bench.py @@ -43,8 +43,8 @@ def gen(sp2b_dir, n_min, n_max, step): def write_header(results, progs): "Write the header line for TSV output" - results.write("n") - for prog in progs: + results.write("n\tserdi_stream\tserdi_model") + for prog in progs[2:]: results.write("\t" + os.path.basename(prog.split()[0])) results.write("\n") @@ -145,13 +145,15 @@ def run(progs, n_min, n_max, step): cmd = "/usr/bin/time -v " + prog + " " + filename(n) with open(filename(n) + ".out", "w") as out: sys.stderr.write(cmd + "\n") - proc = subprocess.Popen( + proc = subprocess.run( cmd.split(), stdout=out, stderr=subprocess.PIPE ) - time, memory = parse_time(proc.communicate()[1].decode()) + time, memory = parse_time(proc.stderr.decode()) rows["time"] += ["%.07f" % time] - rows["throughput"] += ["%d" % (n / time)] + rows["throughput"] += ( + ["%d" % (n / time)] if time > 0.0 else ["0"] + ) rows["memory"] += [str(memory)] # Write rows to output files @@ -223,7 +225,11 @@ example: args = ap.parse_args(sys.argv[1:]) - progs = ["serdi -b -f -i turtle -o turtle"] + args.run + progs = [ + "serdi -b -i turtle -o turtle", + "serdi -m -b -i turtle -o turtle", + ] + args.run + min_n = int(args.max / 10) max_n = args.max step = min_n -- cgit v1.2.1