source: icGREP/icgrep-devel/performance/DataAnalysisPlot/plot.py

Last change on this file was 5041, checked in by aambarts, 3 years ago

Adding the files needed for Jenkins CI jobs as well as some QA scripts.

File size: 2.2 KB
Line 
1import os.path
2import json
3import glob
4import matplotlib
5# Force matplotlib to not use any Xwindows backend.
6matplotlib.use('Agg')
7import matplotlib.pyplot as plt
8import sys
9
10BUILD = 'Build'
11BUILD_NUMBER = 'buildNumber'
12CYCLES = 'cycles:u'
13GEOCYCLES = 'geoCycles'
14GEOINSTRUCTIONS = 'geoInstructions'
15GEOTRACKER = 'geoTracking.json'
16ICGREP = 'icgrep'
17INSTRUCTIONS = 'instructions:u'
18TRACKER = 'performanceTracking.json'
19
20if os.path.isfile(GEOTRACKER) != True:
21        print "No " + GEOTRACKER + " file found in this folder. Exit"
22        sys.exit()
23
24if os.path.isfile(TRACKER) != True:
25        print "No " + TRACKER + " file found in this folder. Exit"
26        sys.exit()
27
28with open (GEOTRACKER) as datafile:
29        inData = json.load(datafile)
30
31buildsUncoded = inData[BUILD_NUMBER]
32builds = []
33
34for word in buildsUncoded:
35        builds.append(word.encode("utf-8"))
36
37x = range(1, len(inData[GEOCYCLES])+1)
38y = inData[GEOCYCLES]
39
40plt.xticks(x, builds)
41plt.plot(x, y)
42plt.xlabel(BUILD)
43plt.ylabel('Geometric Mean of Cycles')
44plt.title('Geometric Mean of Cycles vs Build')
45plt.savefig(GEOCYCLES)
46plt.clf()
47
48y = inData[GEOINSTRUCTIONS]
49
50plt.xticks(x, builds)
51plt.plot(x, y)
52plt.xlabel(BUILD)
53plt.ylabel('Geometric Mean of Instructions')
54plt.title('Geometric Mean of Instructions vs Build')
55plt.savefig(GEOINSTRUCTIONS)
56plt.clf()
57
58
59with open (TRACKER) as outFile:
60        inData = json.load(outFile)
61
62for section in inData[ICGREP]:
63        for test in inData[ICGREP][section]:
64
65                x = range(1, len(inData[ICGREP][section][test][CYCLES])+1)
66                y = inData[ICGREP][section][test][CYCLES]
67
68                plt.xticks(x, builds)
69                plt.plot(x, y)
70                plt.xlabel(BUILD)
71                plt.ylabel(CYCLES.replace(':u', ""))
72                plt.title(section.replace('.', "-") + "_" + test.replace('.', "-") + "_" + CYCLES.replace(':u', ""))
73                plt.savefig(section.replace('.', "-") + "_" + test.replace('.', "-") + "_" + CYCLES.replace(':u', ""))
74                plt.clf()
75
76                y = inData[ICGREP][section][test][INSTRUCTIONS]
77
78                plt.xticks(x, builds)
79                plt.plot(x, y)
80                plt.xlabel(BUILD)
81                plt.ylabel(INSTRUCTIONS.replace(':u', ""))
82                plt.title(section.replace('.', "-") + "_" + test.replace('.', "-") + "_" + INSTRUCTIONS.replace(':u', ""))
83                plt.savefig(section.replace('.', "-") + "_" + test.replace('.', "-") + "_" + INSTRUCTIONS.replace(':u', ""))
84                plt.clf()
85
86
87
88
89
Note: See TracBrowser for help on using the repository browser.