-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcpu-plot.py
executable file
·84 lines (72 loc) · 1.9 KB
/
cpu-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
#!/usr/bin/env python
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib
print("Backend used by matplotlib is: ", matplotlib.get_backend())
inputs = [
"top.log",
]
labels = inputs
linestyles = [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
]
dfs = [pd.read_csv(tag, sep=' ', header=None) for tag in inputs]
xscale = 9./24
xscale = 204./740
cpu_lim = [0, 900]
ram_size = 31.3 # 31.3, 10
ram_lim = [0, ram_size]
fontsize = 18
for i in range(len(inputs)) :
x = np.linspace(0,dfs[i][0].shape[0]*xscale,dfs[i][0].shape[0])
plt.plot(x,dfs[i][0],label=labels[i]
, linestyle=linestyles[i]
)
plt.legend(loc='best',fontsize=fontsize)
plt.grid()
plt.ylim(cpu_lim)
plt.xlabel("time [sec]", fontsize=fontsize)
plt.ylabel("cpu [%]", fontsize=fontsize)
plt.yticks(fontsize=fontsize)
plt.xticks(fontsize=fontsize)
plt.tight_layout()
plt.show()
for i in range(len(inputs)) :
x = np.linspace(0,dfs[i][0].shape[0]*xscale,dfs[i][0].shape[0])
plt.plot(x,dfs[i][1]*ram_size/100,label=labels[i]
, linestyle=linestyles[i]
)
# plt.plot((dfs[1][1]-dfs[0][1])*31.3/100,label="TBB-single - Pgrapher")
plt.legend(loc='best',fontsize=fontsize)
plt.grid()
plt.ylim(ram_lim)
plt.xlabel("time [sec]", fontsize=fontsize)
plt.ylabel("memory [GB]", fontsize=fontsize)
plt.yticks(fontsize=fontsize)
plt.xticks(fontsize=fontsize)
plt.tight_layout()
plt.show()
# plt.plot((dfs[1][1]-dfs[0][1])*31.3/100,label="TBB-single - Pgrapher")
# plt.legend(loc='best',fontsize=fontsize)
# plt.grid()
# plt.ylim(-1,1)
# plt.xlabel("time [sec]", fontsize=fontsize)
# plt.ylabel("memory [GB]", fontsize=fontsize)
# plt.show()
# for i in range(len(inputs)) :
# plt.plot(dfs[i][1]*31.3/dfs[i][0],label=labels[i])
# plt.legend(loc='best',fontsize=fontsize)
# plt.grid()
# plt.ylim(0,2)
# plt.xlabel("time [sec]", fontsize=fontsize)
# plt.ylabel("memory/CPU load [GB]", fontsize=fontsize)
# plt.show()
#%%