-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperf_plot.py
executable file
·99 lines (74 loc) · 2.37 KB
/
perf_plot.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from zplot import *
import sys
from subprocess import call
def get_ymax(coll_list, t):
ymax = 0
for c in coll_list:
ymax = ymax if t.getmax(c) < ymax else t.getmax(c)
ymax = ymax + ymax * 0.1
round_ymax = 0
round_scale = 10 if ymax < 100 else 100
while round_ymax < ymax:
round_ymax += round_scale
#print(round_ymax)
return round_ymax
#data_file='memtable.hit.64.dat'
if len(sys.argv) < 2:
print("./plot.py memtable.hit.dat")
sys.exit()
#data_file='test.dat'
data_file=sys.argv[1]
ctype = 'eps' #if len(sys.argv) < 2 else sys.argv[1]
t = table(file=data_file)
#t.dump()
ymax = get_ymax(['count'], t)
c = canvas(ctype, title=data_file, dimensions=['3in', '1.85in'])
d = drawable(canvas=c, xrange=[0,16], yrange=[-1,ymax],
#coord=[0,25]
# dimensions=['3in','1.85in']
)
# background: green, with a yellow vertical grid
#c.box(coord=[[0,0],[300,140]], fill=True, fillcolor='darkgreen', linewidth=0)
#grid(drawable=d, y=False, xrange=[90,101], xstep=1, linecolor='yellow',
# linedash=[2,2])
options = [('skip_list', 'solid', 0.5, 'pink'),
('cuckoo', 'dline2', 0.5, 'blue')]
xm = []
w='mrep="%s"' % "cuckoo"
for x, y in t.query(select='thread,line', where=w):
y = str(float(y) - 0.5)
xm.append((x, y))
#ym = [ymax // 1000000,ymax]
ym = []
ym.append((ymax // 1000,ymax))
axis(drawable=d, style='box',
# xauto=[1,15,1],
title=data_file,
ytitle="IOPS(K)",
ytitleshift=[10,0],
xtitle="Threads",
xmanual=xm,
#yauto=[0, ymax, ymax/5],
ymanual=ym,
domajortics=False,
#xaxisposition=0,
linewidth=0.5, xlabelfontsize=8.0, doxlabels=True,
)
#xlabelformat='\'%s',
# xlabelshift=[0,-30],linecolor='black', xlabelfontcolor='black')'
p = plotter()
L = legend()
for opt, ftype, fsize, color in options:
w = 'mrep="%s"' % opt
st = table(table=t, where=w)
barargs = {'drawable':d, 'table':st, 'xfield': 'line', 'yfield': 'count',
'fill': True, 'barwidth': 0.8, 'fillsize': fsize,
'fillstyle': ftype, 'fillcolor': color,
'legendtext': opt,'legend' : L}
p.verticalbars(**barargs)
L.draw (c, coord=[d.left() + 5, d.top() -6], style='right', skipnext=2, skipspace=45, fontsize=8, height=5, hspace=2)
c.render()
#
#
#call(["mv", _title + ".eps", "figure"])
call(["open", data_file + "." + ctype])