-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot-averted-tlb-miss-histogram.py
More file actions
executable file
·63 lines (43 loc) · 1.06 KB
/
plot-averted-tlb-miss-histogram.py
File metadata and controls
executable file
·63 lines (43 loc) · 1.06 KB
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
#!/usr/bin/env python3
from os import environ
if "NOX" in environ:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from sys import argv, exit
filename = argv[1]
MARKER_LINE = "Histogram of # averted TLB misses (# averted: frequency):"
data = {}
start = False
with open(filename, 'r') as f:
for line in f.readlines():
if line.strip() == MARKER_LINE:
start = True
continue
if not start:
continue
a, f = line.split()
data[int(a)] = int(f)
if len(data) == 0:
print("no data")
exit(0)
xs = []
ys = []
for n in range(min(data.keys()), max(data.keys()) + 1):
if n in data:
xs.append(n)
ys.append(data[n])
else:
xs.append(n)
ys.append(0)
plt.plot(xs, ys)
plt.yscale('symlog')
plt.xscale('symlog')
plt.xlim(left = 0)
plt.ylim(bottom = 0)
plt.xlabel("Number of Averted TLB misses")
plt.ylabel("Number of Huge Pages")
if "NOX" not in environ:
plt.show()
plt.savefig('{}.averted.png'.format(filename))