@@ -80,15 +80,15 @@ def main():
8080 lines = firstFile .readlines ()
8181 # get the perfkeys out of the first line, first line starts with a '#'
8282 perfKeysString = lines [0 ]
83- perfKeys = [ l .strip () for l in perfKeysString .replace ('#' , '' ).split ('\t ' ) ]
84- # There are as many passes are there are keys (-1 for the date)
85- numPasses = len (perfKeys ) - 1
83+ perfKeys = [ l .strip () for l in perfKeysString .replace ('#' , '' ).split ('\t ' )[ 1 :] ]
84+ # There are as many passes are there are time keys
85+ numPasses = len ([ k for k in perfKeys if "time" in k ])
8686 # grab the date
8787 date = lines [1 ].split ('\t ' )[0 ]
8888 # create two lists to keep track of the combined results. One for the
8989 # tests in the release/examples directory and one for all tests
90- allCombinedValues = [ float (0 ) for i in range (numPasses ) ]
91- releaseExampleCombinedValues = [ float (0 ) for i in range (numPasses ) ]
90+ allCombinedValues = [ float (0 ) for i in range (len ( perfKeys ) ) ]
91+ releaseExampleCombinedValues = [ float (0 ) for i in range (len ( perfKeys ) ) ]
9292 firstFile .close ()
9393
9494 except IOError :
@@ -109,24 +109,24 @@ def main():
109109 # read in the actual values and remove the date
110110 perfValues = [ l .strip () for l in lines [1 ].split ('\t ' )[1 :] ]
111111 # check that we had the right number of passes
112- if len (perfValues ) != numPasses :
112+ if len (perfValues ) != len ( perfKeys ) :
113113 sys .stderr .write ('[ERROR: num passes is not the same for all files: %s]\n ' % (tempDatDir + datFile ))
114114 continue
115115 # for each value add it to the running total and maybe the release
116116 # example running total if it was in that dir
117117 for valueIndex in range (len (perfValues )):
118- value = float (perfValues [valueIndex ])
119- allCombinedValues [valueIndex ] += value ;
120- if isReleaseExample :
121- releaseExampleCombinedValues [valueIndex ] += value ;
118+ value = float (perfValues [valueIndex ])
119+ allCombinedValues [valueIndex ] += value
120+ if isReleaseExample :
121+ releaseExampleCombinedValues [valueIndex ] += value
122122 f .close ()
123123
124124 except IOError :
125125 sys .stderr .write ('[ERROR: Could not open dat file: %s]\n ' % (datFile ))
126126 return - 1
127127
128128 # get the total time compiling, which is the last "pass"
129- totalTimeCompiling = allCombinedValues [numPasses - 1 ]
129+ totalTimeCompiling = next ( allCombinedValues [i ] for i in range ( len ( allCombinedValues )) if perfKeys [ i ] == 'total time :' )
130130
131131 # compute the average for each value and truncate to two decimal places
132132 allCombinedValues = [ '%1.2f' % (i / numCompiles ) for i in allCombinedValues ]
0 commit comments