-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_graphs.py
More file actions
106 lines (94 loc) · 4.15 KB
/
plot_graphs.py
File metadata and controls
106 lines (94 loc) · 4.15 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
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
99
100
101
102
103
104
105
106
import matplotlib.pyplot as plt
DATA_ROOT_DIR = "/Users/raghavbhat/Code/WISETutorial/vis/data/"
PLOT_SAVE_LOCATION = "/Users/raghavbhat/Code/WISETutorial/vis/plots/"
def cpu(serviceName):
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "cpu0.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="CPU 0")
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "cpu1.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="CPU 1")
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "cpu2.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="CPU 2")
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "cpu3.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="CPU 3")
plt.title("CPU")
plt.xlabel("Time (seconds)")
plt.ylabel("CPU utilization (%)")
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + serviceName + "/" + "cpu")
def plot_by_cpu(serviceName, i):
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "cpu" + str(i) + ".data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label=str("CPU " + str(i)))
plt.title("CPU " + str(i) + " Plot")
plt.xlabel("Time (seconds)")
plt.ylabel("CPU utilization (%)")
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + serviceName + "/" + "cpu-" + str(i))
def disk(serviceName):
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "diskread.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="Read")
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "diskwrite.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="Write")
plt.title("Disk")
plt.xlabel("Time (seconds)")
plt.ylabel("Disk I/O (in kB)")
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + serviceName + "/" + "disk")
def mem(serviceName):
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + serviceName + "/" + "mem.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="Memory")
plt.title("Memory")
plt.xlabel("Time (seconds)")
plt.ylabel("Memory utilization (%)")
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + serviceName + "/" + "mem")
def queue_length():
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + "queue_length.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="Items")
plt.title("Queue Length")
plt.xlabel("Time (milliseconds)")
plt.ylabel("Queue Length")
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + "queue_length")
def requests_per_sec():
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + "requests_per_sec.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="Requests")
plt.title("Requests per Second")
plt.xlabel("Time (seconds)")
plt.ylabel("# Requests")
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + "reqs_per_sec")
def response_time_distribution():
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + "rt_dist.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="# Requests")
plt.title("Response Time Distribution")
plt.xlabel("Response Time (milliseconds)")
plt.ylabel("# Requests")
plt.xlim((-30, 3000))
plt.yscale(value='log')
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + "response_time_distribution")
def point_in_time_distribution():
plt.clf()
plt.plotfile(fname = DATA_ROOT_DIR + "rt_pit.data", cols=(0,1), skiprows=0, delimiter=" ", newfig=False, label="PIT Response Time")
plt.title("Point in Time Distribution")
plt.xlabel("Time (milliseconds)")
plt.ylabel("PIT Response Time (milliseconds)")
plt.legend()
plt.grid()
plt.savefig(PLOT_SAVE_LOCATION + "point_in_time_distribution")
for serviceName in ["auth", "client", "db", "inbox", "microblog", "queue", "sub", "stress-test-1"]:
try:
cpu(serviceName)
for i in range(4):
plot_by_cpu(serviceName, i)
disk(serviceName)
mem(serviceName)
except Exception:
pass
queue_length()
requests_per_sec()
response_time_distribution()
point_in_time_distribution()