-
Notifications
You must be signed in to change notification settings - Fork 0
/
summarize-benchmark-to-md.py
executable file
·52 lines (38 loc) · 1.44 KB
/
summarize-benchmark-to-md.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /usr/bin/env python
import sys
import pandas as pd
import argparse
import os
pd.options.display.precision = 1
def main():
p = argparse.ArgumentParser()
p.add_argument('bench_dir')
args = p.parse_args()
samples = ['SRR12324253', 'SRR1976948', 'SRR5650070', 'SRR606249']
prefixes = [ 'fastmultigather', 'fastmultigather_rocksdb', 'fastgather', 'pygather']
df_list = []
# load all the CSV files
for s in samples:
for p in prefixes:
df = pd.read_csv(f'{args.bench_dir}/{p}.{s}.txt', sep='\t')
df.insert(0, "prefix", [p], True)
df.insert(1, "sample", [s], True)
df_list.append(df)
df = pd.concat(df_list)
df_by_second = df[df["sample"] == 'SRR1976948'][["prefix", "s", "max_rss"]].sort_values(by="s")
df_by_second.set_index("prefix", inplace=True)
df_by_second["max_rss"] /= 1000
print(df_by_second.to_markdown(floatfmt=".1f"))
rocksdb_bench = f'{args.bench_dir}/index.rocksdb.txt'
if not os.path.exists(rocksdb_bench):
print("\n(no RocksDB benchmark exists.)")
return
rocksdb_df = pd.read_csv(rocksdb_bench, sep='\t')
rocksdb_df = rocksdb_df[["h:m:s", "s", "max_rss"]]
hms = list(rocksdb_df["h:m:s"])[0]
sec = list(rocksdb_df["s"])[0]
rss = list(rocksdb_df["max_rss"] / 1000)[0]
print('')
print(f"Cost of RocksDB indexing: {hms} / {int(sec)}s / {rss:.1f} GB")
if __name__ == '__main__':
main()