visualize.py 1.28 KB
Newer Older
1
#!/usr/bin/env python3
2
import argparse, sys, pprint, itertools
Ralf Jung's avatar
Ralf Jung committed
3
import matplotlib.pyplot as plt
4
5
6
7
8
9
10
11
12
import parse_log

# read command-line arguments
parser = argparse.ArgumentParser(description='Visualize iris-coq build times')
parser.add_argument("-f", "--file",
                    dest="file", required=True,
                    help="Filename to get the data from.")
parser.add_argument("-t", "--timings", nargs='+',
                    dest="timings",
13
                    help="The names of the Coq files (with or without the extension) whose timings should be extracted")
14
15
16
17
args = parser.parse_args()
pp = pprint.PrettyPrinter()
log_file = sys.stdin if args.file == "-" else open(args.file, "r")

18
19
timings = list(map(lambda t: t[:-2] if t.endswith(".v") else t, args.timings))
results = list(parse_log.parse(log_file, timings))
Ralf Jung's avatar
Ralf Jung committed
20

21
22
23
markers = itertools.cycle([(3, 0), (3, 0, 180), (4, 0), (4, 0, 45), (8, 0)])
for timing in timings:
    plt.plot(list(map(lambda r: r.times.get(timing), results)), marker=next(markers), markersize=8)
Ralf Jung's avatar
Ralf Jung committed
24

25
plt.legend(timings)
Ralf Jung's avatar
Ralf Jung committed
26
27
28
29
30
31
32
33
plt.xticks(range(len(results)), list(map(lambda r: r.commit[:7], results)), rotation=70)
plt.subplots_adjust(bottom=0.2) # more space for the commit labels

plt.xlabel('Commit')
plt.ylabel('Time (s)')
plt.title('Time to compile files')
plt.grid(True)
plt.show()