4 ## Copyright (c) 2010-2017 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
21 from csvreader import *
23 from csvwriter import *
30 def setBoundary(self, val):
33 def addCoreResult(self, core, val):
34 self.cores[core] = val
36 def getCoreResult(self, core):
37 if (core in self.cores):
38 return self.cores[core];
41 def getBoundary(self):
51 def __init__(self, key):
57 config.parse(sys.argv[0], sys.argv[1:])
59 err = config.getErrorMakeTable();
66 print "Performance data: " + config.getInputFileName2()
67 print "Boundaries: " + config.getInputFileName()
72 infileFields += [("msr", "int")]
73 infileFields += [("conn", "int")]
74 infileFields += [("ss", "Decimal")]
75 infileFields += [("bw", "Decimal")]
77 boundariesFile = CsvReader(infileFields)
78 boundariesFile.open(config.getInputFileName());
79 boundaries = boundariesFile.readAll();
88 if (key not in finalResults):
89 newDict = DictEntry(key)
90 finalResults[key] = newDict
91 orderedResults.append(newDict)
94 table = finalResults[a["conn"]]
98 value.conn = a["conn"]
99 value.boundary = a["bw"]
100 table.dictionary[key] = value
101 table.entries.append(value)
104 infileFields2 += [("cores", "int")]
105 infileFields2 += [("msr", "int")]
106 infileFields2 += [("conn", "int")]
107 infileFields2 += [("ss", "Decimal")]
108 infileFields2 += [("down", "Decimal")]
110 resultsFile = CsvReader(infileFields2)
111 resultsFile.open(config.getInputFileName2())
113 for a in resultsFile.readAll():
114 table = finalResults[a["conn"]]
116 table.dictionary[key].addCoreResult(a["cores"], a["down"])
117 cores.add(a["cores"]);
120 outputFile = CsvWriter()
122 outputFile.open(config._output_file_name)
124 title = ["setup rate", "maximum"]
125 for e in sorted(cores):
128 for a in orderedResults:
129 outputFile.write(["connections = " + str(a.key)])
130 outputFile.write(title)
133 line = [str(e.getMsr())]
134 line += [str(e.getBoundary())]
135 for c in sorted(cores):
136 if (e.getCoreResult(c) is not None):
137 line += [str(e.getCoreResult(c))]
140 outputFile.write(line)