aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/gencompile.py
blob: e636a545c02ec75412ab6e64585a5fc646eaef76 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python3.6

import numpy as np              # type: ignore
import matplotlib.pyplot as plt # type: ignore
import sys
from typing import *

##
# Reading data
##

if len(sys.argv) != 2:
  raise Exception("Only 1 argument should be given to this script: the file with the compile times")
data_file = sys.argv[1]

coords: List[Tuple[int, float]] = []
with open(data_file, "r") as f:
  for line in f:
    nb_inst_s, time_s = line.split(":")
    coords.append((int(nb_inst_s), float(time_s)))

##
# Generating PDF
##

fig, ax = plt.subplots()
x = [coord[0] for coord in coords]
y = [coord[1] for coord in coords]
plt.plot(x, y, "b+")

ax.set_ylabel("Time (s)")
ax.set_title("Verification time")
ax.set_xlabel("Size of basic block")

plt.savefig("compile-times.pdf")


#def generate_file(f: str, cols: List[str]) -> None:
#  ind = np.arange(len(df[cols[0]]))
#
#  width = 0.25  # the width of the bars
#
#  compilers = extract_compilers(cols)
#  start_inds = subdivide_interv(ind, ind+2*width, len(compilers))
#  heights: Dict[str, List[float]] = make_relative_heights(df, cols)
#
#  fig, ax = plt.subplots()
#  rects = []
#  for i, compiler in enumerate(compilers):
#    rects.append(ax.bar(start_inds[i], heights[compiler], width, color=colors[i], label=compiler))
#
#  # Add some text for labels, title and custom x-axis tick labels, etc.
#  ax.set_ylabel('Cycles (%)')
#  ax.set_yticklabels(['{:,.0%}'.format(x) for x in ax.get_yticks()])
#  ax.set_title('TITLE')
#  ax.set_xticks(ind)
#  ax.set_xticklabels(benches)
#  ax.legend()
#
#  plt.setp(ax.get_xticklabels(), rotation=30, horizontalalignment='right')
#  plt.xticks(size=5)
#
#  plt.savefig(f)
#
#generate_file("measures-host.pdf", host_measures_cols)
#generate_file("measures-k1c.pdf", k1c_measures_cols)