Skip to content

Commit a74ebcc

Browse files
committed
timeslices as options
1 parent 3d54908 commit a74ebcc

29 files changed

+18635
-0
lines changed

complete_data1/.DS_Store

6 KB
Binary file not shown.

complete_data1/2vm_aimd_a3p5_b9_11p0.txt

Lines changed: 1594 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/2vm_apid_tb.txt

Lines changed: 1548 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/2vm_static_tb.txt

Lines changed: 1650 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/3vm_aimd_a3p5_b9_11p0_rand.txt

Lines changed: 1020 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/3vm_apid_tb_rand.txt

Lines changed: 1054 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/3vm_info.txt

Lines changed: 979 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/3vm_static_tb_rand.txt

Lines changed: 1426 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/matmul_aimd_a3p5_b9_11p0.txt

Lines changed: 1027 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/matmul_apid_tb_rand.txt

Lines changed: 964 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/matmul_info.txt

Lines changed: 1112 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/matmul_static_tb_rand.txt

Lines changed: 453 additions & 0 deletions
Large diffs are not rendered by default.

complete_data1/minmax.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
min 10
2+
max 11
3+
timeslice_us 30.0

complete_data1/plot_2vm.py

Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
from os import listdir
2+
from os.path import isfile, join
3+
onlyfiles = [f for f in listdir('./') if isfile(join('./', f))]
4+
# print(onlyfiles)
5+
6+
files = [ f for f in onlyfiles if "2vm_" in f]
7+
print(files)
8+
9+
10+
11+
12+
import matplotlib.pyplot as plt
13+
import matplotlib.animation as animation
14+
from matplotlib.widgets import Cursor
15+
from matplotlib.font_manager import FontProperties
16+
from matplotlib.widgets import CheckButtons
17+
18+
import time
19+
for f in files:
20+
21+
22+
fig = plt.figure(figsize=(10, 7))
23+
ax1 = fig.add_subplot(2,1,1)
24+
ax2 = fig.add_subplot(2,1,2)
25+
buf = 1000
26+
show_frames=1
27+
show_anchors=0
28+
show_dummies=0
29+
show_ts=0
30+
font_per = [{'family': 'serif',
31+
'color': 'k',
32+
'size': 12,
33+
},{'family': 'serif',
34+
'color': 'k',
35+
# 'weight': 'bold',
36+
'size': 24,
37+
}]
38+
39+
ax_rtxen = plt.axes([0, 0.91, 0.2, 0.12])
40+
ax_rtxen.text(0.06,0.42,'Average VM1 CPU Utilization(%/sec):',fontdict=font_per[0])
41+
ax_rtxen_txt = ax_rtxen.text(0.1,0.01,'%.2f%%'%(0),fontdict=font_per[1])
42+
ax_rtxen.axis('off')
43+
44+
45+
ax_xen = plt.axes([0.65, 0.91, 0.2, 0.12])
46+
ax_xen.text(0.08,0.42,'Average VM2 CPU Utilization(%/sec):',fontdict=font_per[0])
47+
ax_xen_txt = ax_xen.text(0.4,0.01,'%.2f%%'%(0),fontdict=font_per[1])
48+
ax_xen.axis('off')
49+
50+
last_ts=[15,15]
51+
52+
maxx=30000
53+
54+
55+
56+
pullData = open(f,"r").read()
57+
minmax = open("minmax.txt","r").read()
58+
dataArray = pullData.split('\n')
59+
minmaxArray = minmax.split('\n')
60+
time_start=0
61+
time_end=0
62+
63+
x = []
64+
hrs = []
65+
cpus_xs =[]
66+
cpus = []
67+
anchor_xs = []
68+
anchors = []
69+
frame_xs = []
70+
frames = []
71+
dummy_x = []
72+
dummy_hrs = []
73+
ts_xs = []
74+
ts = []
75+
event_last_happened_at_cnt=[-1,-1]
76+
event_cnt_x=[]
77+
78+
for i in range(2):
79+
x.append([])
80+
hrs.append([])
81+
cpus_xs.append([])
82+
cpus.append([])
83+
anchor_xs.append([])
84+
anchors.append([])
85+
frame_xs.append([])
86+
frames.append([])
87+
dummy_x.append([])
88+
dummy_hrs.append([])
89+
ts_xs.append([])
90+
ts.append([])
91+
92+
93+
94+
95+
# for j in range(buf):
96+
# x[i].append(j)
97+
# hrs[i].append(0)
98+
# cpus[i].append(0)
99+
cnt=0
100+
maxhrs=0
101+
for eachLine in dataArray:
102+
if len(eachLine)>1:
103+
line = eachLine.split()
104+
if cnt==0:
105+
time_start = float(line[-1])
106+
time_end = float(line[-1])
107+
index=int(line[0])-1
108+
if len(line)==3+1:
109+
x[index].append(float(line[-1])-time_start)
110+
hrs[index].append(float(line[1]))
111+
112+
if len(line)==2+1:
113+
# print(line)
114+
anchor_xs[index].append(float(line[-1])-time_start)
115+
anchors[index].append(int(line[1]))
116+
event_last_happened_at_cnt[index]=cnt
117+
118+
if len(line)==4+1:
119+
frame_xs[index].append(float(line[-1])-time_start)
120+
frames[index].append(int(line[1]))
121+
event_last_happened_at_cnt[index]=cnt
122+
123+
if len(line)==5+1:
124+
dummy_x[index-2].append(float(line[-1])-time_start)
125+
dummy_hrs[index-2].append(float(line[1]))
126+
if len(line)==6+1:
127+
ts_xs[index].append(float(line[-1])-time_start)
128+
ts[index].append(int(line[1]))
129+
last_ts[index]=int(line[1])
130+
event_last_happened_at_cnt[index]=cnt
131+
if len(line)==7+1:
132+
cpus_xs[index].append(float(line[-1])-time_start)
133+
cpus[index].append(float(line[1])*100)
134+
135+
if len(line)!=7+1:
136+
cnt+=1
137+
min_max = []
138+
for eachLine in minmaxArray:
139+
if len(eachLine)>1:
140+
line = eachLine.split()
141+
min_max.append(float(line[1]))
142+
143+
ax1.clear()
144+
ax2.clear()
145+
sched=["VM1","VM2"]
146+
colrs = ['blue','skyblue']
147+
# colrs = ['g','lightgreen']
148+
for i in range(len(x)):
149+
ax1.scatter(x[i],hrs[i],s= ((1)%2)*6+5 ,label= sched[i] ,color=colrs[i])
150+
ax2.plot(cpus_xs[i],cpus[i],color=colrs[i],lw=((i+1)%2)+3,label= sched[i] )
151+
# tmp=[]
152+
# for j in range(len(cpus[i])):
153+
# tmp.append(100-cpus[i][j])
154+
# ax2.plot(x[i],tmp,color=dummy_colrs[i],lw=((i+1)%2)+3,label= sched[i] )
155+
# ax2.scatter(x[i],cpus[i],s= ((i+1)%2)*6+5,label= sched[i] ,color=colrs[i])
156+
dummy_colrs = ['cyan','lightgreen']
157+
dummy_sched=["Dummy\nRT-Xen","Dummy\nCredit"]
158+
159+
if show_dummies:
160+
for i in range(len(dummy_x)):
161+
ax1.scatter(dummy_x[i],dummy_hrs[i],s= ((1)%2)*6+5 ,label= dummy_sched[i] ,color=dummy_colrs[i],marker='o')
162+
163+
x_for_minmax = []
164+
miny = []
165+
maxy = []
166+
midy=[]
167+
total_x_len = len(x[0])+len(x[1])+len(dummy_x[0])+len(dummy_x[1])
168+
for i in range(total_x_len):
169+
x_for_minmax.append(i)
170+
miny.append(min_max[0])
171+
maxy.append(min_max[1])
172+
midy.append(min_max[0]/2+min_max[1]/2)
173+
174+
175+
176+
# if time_start>0 and time_end>0 and len(miny)>1:
177+
# ax1.plot([0,time_end-time_start],miny[0:2],'r')
178+
# # ax1.plot([0,time_end-time_start],[(miny[0]+maxy[0])/2,(miny[0]+maxy[0])/2],'pink')
179+
# ax1.plot([0,time_end-time_start],[(miny[0]+maxy[0])/2,(miny[0]+maxy[0])/2],'pink')
180+
# ax1.plot([0,time_end-time_start],maxy[0:2],'r',label= 'Target\nFPS\nInterval')
181+
# ax1.plot(x_for_minmax,miny,'r')
182+
# ax1.plot(x_for_minmax,midy,'pink')
183+
# ax1.plot(x_for_minmax,maxy,'r',label= 'Target\nFPS\nRange')
184+
ax1.plot([0 ,120],[10 ,10],'r',label= 'Min FPS')
185+
186+
187+
188+
189+
fontP = FontProperties()
190+
fontP.set_size('small')
191+
# ax1.legend(bbox_to_anchor=(1.01, 1), loc=2, borderaxespad=0.,prop=fontP)
192+
ax1.legend()
193+
# ax1.legend(loc='upper center', bbox_to_anchor=(0.5, 1.12),ncol=3, fancybox=True, shadow=True,prop=fontP)
194+
# ax2.legend(loc='upper center', bbox_to_anchor=(0.5, 1.1),ncol=3, fancybox=True, shadow=True,prop=fontP)
195+
# ax2.legend(bbox_to_anchor=(1.01, 1), loc=2, borderaxespad=0.,prop=fontP)
196+
ax2.legend()
197+
# fig.suptitle('RT-Xen vs Credit', fontsize=14, fontweight='bold')
198+
per = 0
199+
# try:
200+
# rtxen_fps = hrs[0][-1]
201+
# credit_fps = hrs[1][-1]
202+
# per=(rtxen_fps-credit_fps)/credit_fps*100
203+
204+
205+
try:
206+
hrs_after_event_rtxen=0
207+
hrs_after_event_rtxen_cnt=0
208+
hrs_after_event_credit=0
209+
hrs_after_event_credit_cnt=0
210+
for ii,xx in enumerate(hrs[0]):
211+
if x[0][ii]>event_last_happened_at_cnt[0]:
212+
hrs_after_event_rtxen+=xx
213+
hrs_after_event_rtxen_cnt+=1
214+
for ii,xx in enumerate(hrs[1]):
215+
if x[1][ii]>event_last_happened_at_cnt[1]:
216+
hrs_after_event_credit+=xx
217+
hrs_after_event_credit_cnt+=1
218+
if hrs_after_event_rtxen_cnt > 0 and hrs_after_event_rtxen_cnt >0:
219+
rtxen_fps = hrs_after_event_rtxen/hrs_after_event_rtxen_cnt
220+
credit_fps = hrs_after_event_credit/hrs_after_event_credit_cnt
221+
per=(rtxen_fps-credit_fps)/credit_fps*100
222+
except:
223+
per=0
224+
225+
area_under_curve_rtxen=0
226+
area_under_curve_xen=0
227+
if len(cpus_xs[1])>0:
228+
for i in range(1,len(cpus_xs[1])):
229+
area_under_curve_xen+=cpus[1][i-1]*(cpus_xs[1][i]-cpus_xs[1][i-1])
230+
if len(cpus_xs[0])>0:
231+
for i in range(1,len(cpus_xs[0])):
232+
area_under_curve_rtxen+=cpus[0][i-1]*(cpus_xs[0][i]-cpus_xs[0][i-1])
233+
234+
235+
if area_under_curve_xen>0:
236+
ax_xen_txt.set_text('%.2f%%'%(area_under_curve_xen/(cpus_xs[1][-1]-cpus_xs[1][0])))
237+
if area_under_curve_rtxen>0:
238+
ax_rtxen_txt.set_text('%.2f%%'%(area_under_curve_rtxen/(cpus_xs[0][-1]-cpus_xs[0][0])))
239+
240+
# ax1.set_title('RT-Xen improved by: %.2f %%'%(per)+"\n",loc='right',fontdict=font_per[1])
241+
# ax1.set_title(r'$\frac{RT-Xen\'s improvement}{Percentage}$ = %.2f %%'%(per)+"\n",loc='right',fontsize=18)
242+
# ax1.set_title(r'$\frac{RT-Xen \quad FPS}{Credit \quad FPS }$ = %.2f %%'%(per)+"\n",loc='right',fontsize=18)
243+
# ax1.set_xlabel('Time\n \n')
244+
ax2.set_xlabel('Time(seconds)')
245+
ax1.set_xlabel('Time(seconds)')
246+
ax1.set_ylabel('Moving Average FPS(frames/sec) \n (Window Size = 12)')
247+
ax2.set_ylabel('Assigned CPU Utilization(%)')
248+
# ax2.set_ylim( 45, 105 )
249+
ax2.set_ylim( -5, 105 )
250+
# ax1.set_xlim(0,200)
251+
# ax2.set_xlim(0,200)
252+
ax=[ax1, ax2]
253+
254+
255+
256+
257+
font = [{'family': 'serif',
258+
'color': 'b',
259+
'weight': 'bold',
260+
'size': 8,
261+
},{'family': 'serif',
262+
'color': 'skyblue',
263+
'weight': 'bold',
264+
'size': 8,
265+
}]
266+
colrs = ['b','skyblue']
267+
# font = [{'family': 'serif',
268+
# 'color': 'g',
269+
# 'weight': 'bold',
270+
# 'size': 8,
271+
# },{'family': 'serif',
272+
# 'color': 'lightgreen',
273+
# 'weight': 'bold',
274+
# 'size': 8,
275+
# }]
276+
# colrs = ['g','lightgreen']
277+
if show_anchors:
278+
for i in range(len(anchor_xs)):
279+
for j in range(len(anchor_xs[i])):
280+
ax1.axvline(x=anchor_xs[i][j],color=colrs[i], linestyle='-')
281+
ax2.axvline(x=anchor_xs[i][j],color=colrs[i], linestyle='-')
282+
ymin,ymax=ax1.get_ylim()
283+
if anchors[i][j]==0:
284+
ax1.text(anchor_xs[i][j],ymax,"50%",rotation=45,fontdict=font[i])
285+
elif anchors[i][j]==2:
286+
ax1.text(anchor_xs[i][j],ymax,"100%",rotation=45,fontdict=font[i])
287+
elif anchors[i][j]==1:
288+
ax1.text(anchor_xs[i][j],ymax,"Linear",rotation=45,fontdict=font[i])
289+
elif anchors[i][j]==3:
290+
ax1.text(anchor_xs[i][j],ymax,"APID",rotation=45,fontdict=font[i])
291+
elif anchors[i][j]==4:
292+
ax1.text(anchor_xs[i][j],ymax,"AIMD",rotation=45,fontdict=font[i])
293+
if show_frames:
294+
for i in range(len(frame_xs)):
295+
for j in range(len(frame_xs[i])):
296+
# ax1.axvline(x=30,color='k', linestyle='-')
297+
# ax1.axvline(x=60,color='k', linestyle='-')
298+
# ax1.axvline(x=90,color='k', linestyle='-')
299+
# ax2.axvline(x=30,color='k', linestyle='-')
300+
# ax2.axvline(x=60,color='k', linestyle='-')
301+
# ax2.axvline(x=90,color='k', linestyle='-')
302+
ax1.axvline(x=frame_xs[i][j],color=colrs[i], linestyle='--')
303+
ax2.axvline(x=frame_xs[i][j],color=colrs[i], linestyle='--')
304+
# ax2.text(frame_xs[i][j],-10,"period: "+str(frames[i][j]),rotation=45,fontdict=font[i],horizontalalignment='right',verticalalignment='top')
305+
if show_ts:
306+
for i in range(len(ts_xs)):
307+
for j in range(len(ts_xs[i])):
308+
ax1.axvline(x=ts_xs[i][j],color=colrs[i], linestyle=':')
309+
ax2.axvline(x=ts_xs[i][j],color=colrs[i], linestyle=':')
310+
ax2.text(ts_xs[i][j],10,"ts: "+str(ts[i][j]),rotation=45,fontdict=font[i],horizontalalignment='right',verticalalignment='top')
311+
312+
plt.show()

0 commit comments

Comments
 (0)