-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstrPlot.py
More file actions
112 lines (72 loc) · 2.63 KB
/
instrPlot.py
File metadata and controls
112 lines (72 loc) · 2.63 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
#!/usr/bin/env python
import glob
import csv
import numpy
import matplotlib
import matplotlib.pyplot as plt
from scipy import interpolate
size = 0
threads = []
fpattern = 'instrumentation_thread_*.csv'
files = glob.glob(fpattern)
threadCount = len(files)
for fname in files:
thread = []
#original X vals
thread.append(numpy.loadtxt(open(fname, "rb"), delimiter=",", skiprows=1, usecols=(2)))
#original Y vals
thread.append(numpy.loadtxt(open(fname, "rb"), delimiter=",", skiprows=1, usecols=(17)))
if (int(thread[0][-1]) < size) or (size == 0):
size = int(thread[0][-1])
#Append to the system data
threads.append(thread)
totaly = numpy.zeros((size))
xnew = numpy.arange(0, size, 1)
for thread in threads:
#Interpolate
fcy0 = interpolate.interp1d(thread[0],thread[1])
xnew = numpy.arange(0, size, 1)
#Save the output
thread.append(fcy0(xnew))
#Add to the total
totaly += thread[2]
totaly = totaly/100000
# Generic plotting setup
plt.rc("font", **{'size': 18})
matplotlib.rcParams['axes.linewidth'] = 1 # set the value globally
# First plot.
plt.figure(figsize=(18,10))
#Total messages plot
plt.plot(xnew, totaly, '-')
#plt.plot([307, 307], [0, 11], 'k--')
#plt.text(310, 6.5, "Completion at\n307 seconds", fontsize=18)
plt.title('Heated Plate, Sum of Thread Messsage Send Rate', fontsize=25)
plt.xlabel('Wallclock time (s)', fontsize=20)
plt.ylabel(r'Message send rate ($10^6$/s)', fontsize=20)
#plt.axis([0,size,0,11])
plt.grid(linestyle='-', linewidth='1', which='major')
plt.savefig('msgs.png')
# Rainbow plot
plt.figure(figsize=(18,10))
for i in range(threadCount):
plt.plot(xnew, threads[i][2], '-', label='Thread '+str(i))
#plt.axis([0,size,0,35000])
plt.title('Heated Plate, All Threads', fontsize=25)
plt.ylabel('Message send rate', fontsize=20)
plt.xlabel('Wallclock time (s)', fontsize=20)
plt.grid(linestyle='-', linewidth='1', which='major')
plt.savefig('msgs_rainbow.png')
# Selected threads
plt.figure(figsize=(18,10))
plt.plot(xnew, threads[0][2], '-', label='Thread '+str(0))
if threadCount>10:
plt.plot(xnew, threads[int(threadCount/4)][2], '-', label='Thread '+str(int(threadCount/4)))
plt.plot(xnew, threads[int((threadCount/4)*3)][2], '-', label='Thread '+str(int((threadCount/4)*3)))
plt.plot(xnew, threads[threadCount-2][2], '-', label='Thread '+str(threadCount-1))
plt.title('Heated Plate, Selected Threads', fontsize=25)
plt.ylabel('Message send rate', fontsize=20)
plt.xlabel('Wallclock time (s)', fontsize=20)
plt.legend()
plt.grid(linestyle='-', linewidth='1', which='major')
plt.savefig('msgs_threads.png')
plt.show()