-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotResults.py
executable file
·57 lines (41 loc) · 1.22 KB
/
plotResults.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
#!/usr/bin/env python3
""" Plots the results and creates a CSV for pgfplots. """
import argparse, csv, sys
import matplotlib.pyplot as plt
from EventTimings.EventTimings import getDataFrame
from ipdb import set_trace
parser = argparse.ArgumentParser()
parser.add_argument('--file', help = "Timings file")
if len(sys.argv) < 2:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
df = getDataFrame(args.file)
df.reset_index(inplace = True)
sizes = []
for d in df.Timestamp.unique():
sizes.append(df[df.Timestamp == d].Rank.max())
df = df[df.Rank == 0]
values = {
"Publish" : [],
"Connect" : [],
"Data 500" : [],
"Data 2000" : [],
"Data 4000" : []}
for row in df.itertuples():
size = df[df.Timestamp == row.Timestamp].Rank.max()
if row.Name in values:
values[row.Name].append(row.Total)
with open(args.file + ".csv", 'w', newline='') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(["Size"] + list(values))
for row in zip(sizes, *values.values()):
writer.writerow(row)
for v in values:
plt.plot(sizes, values[v], "d-", label = v)
plt.grid()
plt.title(args.file)
plt.xlabel("Ranks per participant")
plt.ylabel("Time [ms]")
plt.legend()
plt.show()