-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.py
More file actions
executable file
·43 lines (38 loc) · 1.78 KB
/
Copy pathgraph.py
File metadata and controls
executable file
·43 lines (38 loc) · 1.78 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
#!/usr/bin/env python3
import argparse
from matplotlib import pyplot as plt
import analyze, rend
import HPLResult
if __name__ == "__main__":
# Set up argument values
parser = argparse.ArgumentParser()
parser.add_argument("input", help = "HPL output file to analyze")
parser.add_argument("-b", "--bin", help = "The result property used for binning the output (required)", choices = HPLResult.GetterCommandLineNames, required = True)
parser.add_argument("-s", "--statistic", help = "The result property used for finding the best bin on average (required)", choices = HPLResult.GetterCommandLineNames, required = True)
parser.add_argument("-t", "--title", help = "Title for this run")
args = parser.parse_args()
binFunc = HPLResult.NameToGetter.get(args.bin)
statFunc = HPLResult.NameToGetter.get(args.statistic)
# Process data
binnedResults = analyze.binResultsBy(rend.rendData(args.input), binFunc)
minMaxAvg = analyze.minMaxAvgPerBin(binnedResults, statFunc)
# Break minimums, averages, and maximums into their own lists
bins = list(minMaxAvg.keys())
mins = [x[analyze.MMAMin] for x in minMaxAvg.values()]
maxxes = [x[analyze.MMAMax] for x in minMaxAvg.values()]
averages = [x[analyze.MMAAvg] for x in minMaxAvg.values()]
# Get graph labels
xLabel = HPLResult.NameToDisplayName.get(args.bin)
yLabel = HPLResult.NameToDisplayName.get(args.statistic)
title = "{} vs. {}".format(yLabel, xLabel)
if args.title:
title += " ({})".format(args.title)
# Plot results and display graph
plt.plot(bins, mins, label = "Minimum")
plt.plot(bins, averages, label = "Average")
plt.plot(bins, maxxes, label = "Maximum")
plt.title(title)
plt.xlabel(xLabel)
plt.ylabel(yLabel)
plt.legend()
plt.show()