Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 1 | import argparse |
| 2 | import sqlite3 |
| 3 | import re |
| 4 | import pandas as pd |
| 5 | import numpy as np |
Christophe Favergeon | ed0eab8 | 2020-05-18 08:43:38 +0200 | [diff] [blame] | 6 | from TestScripts.doc.Structure import * |
| 7 | from TestScripts.doc.Format import * |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 8 | |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 9 | |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 10 | runidCMD = "runid = ?" |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 11 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 12 | # Command to get last runid |
| 13 | lastID="""SELECT runid FROM RUN ORDER BY runid DESC LIMIT 1 |
| 14 | """ |
| 15 | |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 16 | # Command to get last runid and date |
| 17 | lastIDAndDate="""SELECT date FROM RUN WHERE runid=? |
| 18 | """ |
| 19 | |
Christophe Favergeon | 0e0449a | 2020-07-28 09:44:14 +0200 | [diff] [blame] | 20 | def joinit(iterable, delimiter): |
| 21 | # Intersperse a delimiter between element of a list |
| 22 | it = iter(iterable) |
| 23 | yield next(it) |
| 24 | for x in it: |
| 25 | yield delimiter |
| 26 | yield x |
| 27 | |
| 28 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 29 | def getLastRunID(): |
| 30 | r=c.execute(lastID) |
| 31 | return(int(r.fetchone()[0])) |
| 32 | |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 33 | def getrunIDDate(forID): |
| 34 | r=c.execute(lastIDAndDate,(forID,)) |
| 35 | return(r.fetchone()[0]) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 36 | |
| 37 | runid = 1 |
| 38 | |
| 39 | parser = argparse.ArgumentParser(description='Generate summary benchmarks') |
| 40 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 41 | parser.add_argument('-b', nargs='?',type = str, default="bench.db", help="Database") |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 42 | parser.add_argument('-o', nargs='?',type = str, default="full.md", help="Full summary") |
| 43 | parser.add_argument('-r', action='store_true', help="Regression database") |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 44 | parser.add_argument('-t', nargs='?',type = str, default="md", help="md,html") |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 45 | parser.add_argument('-byc', action='store_true', help="By Compiler") |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 46 | parser.add_argument('-g', action='store_true', help="Include graphs in regression report") |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 47 | |
| 48 | # For runid or runid range |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 49 | parser.add_argument('others', nargs=argparse.REMAINDER,help="Run ID") |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 50 | |
| 51 | args = parser.parse_args() |
| 52 | |
| 53 | c = sqlite3.connect(args.b) |
| 54 | |
| 55 | if args.others: |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 56 | if len(args.others) == 1: |
Christophe Favergeon | 0e0449a | 2020-07-28 09:44:14 +0200 | [diff] [blame] | 57 | if re.search(r'[,]',args.others[0]): |
| 58 | runidval=tuple([int(x) for x in args.others[0].split(",")]) |
| 59 | runidCMD=["runid == ?" for x in runidval] |
| 60 | runidCMD = "".join(joinit(runidCMD," OR ")) |
| 61 | runidCMD = "(" + runidCMD + ")" |
| 62 | else: |
| 63 | runid=int(args.others[0]) |
| 64 | runidval = (runid,) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 65 | else: |
| 66 | runidCMD = "runid >= ? AND runid <= ?" |
| 67 | runid=int(args.others[1]) |
| 68 | runidLOW=int(args.others[0]) |
| 69 | runidval = (runidLOW,runid) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 70 | else: |
| 71 | runid=getLastRunID() |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 72 | print("Last run ID = %d\n" % runid) |
| 73 | runidval=(runid,) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 74 | |
| 75 | # We extract data only from data tables |
| 76 | # Those tables below are used for descriptions |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 77 | REMOVETABLES=['TESTNAME','TESTDATE','RUN','CORE', 'PLATFORM', 'COMPILERKIND', 'COMPILER', 'TYPE', 'CATEGORY', 'CONFIG'] |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 78 | |
| 79 | # This is assuming the database is generated by the regression script |
| 80 | # So platform is the same for all benchmarks. |
| 81 | # Category and type is coming from the test name in the yaml |
| 82 | # So no need to add this information here |
| 83 | # Name is removed here because it is added at the beginning |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 84 | REMOVECOLUMNS=['runid','name','type','platform','category','coredef','OPTIMIZED','HARDFP','FASTMATH','NEON','HELIUM','UNROLL','ROUNDING','DATE','compilerkindid','date','categoryid', 'ID', 'platformid', 'coreid', 'compilerid', 'typeid'] |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 85 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 86 | REMOVECOLUMNSFORHISTORY=['Regression','MAXREGCOEF','name','type','platform','category','coredef','OPTIMIZED','HARDFP','FASTMATH','NEON','HELIUM','UNROLL','ROUNDING','DATE','compilerkindid','date','categoryid', 'ID', 'platformid', 'coreid', 'compilerid', 'typeid'] |
| 87 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 88 | # Get existing benchmark tables |
| 89 | def getBenchTables(): |
| 90 | r=c.execute("SELECT name FROM sqlite_master WHERE type='table'") |
| 91 | benchtables=[] |
| 92 | for table in r: |
| 93 | if not table[0] in REMOVETABLES: |
| 94 | benchtables.append(table[0]) |
| 95 | return(benchtables) |
| 96 | |
| 97 | # get existing types in a table |
| 98 | def getExistingTypes(benchTable): |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 99 | r=c.execute("select distinct typeid from %s order by typeid desc" % benchTable).fetchall() |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 100 | result=[x[0] for x in r] |
| 101 | return(result) |
| 102 | |
| 103 | # Get compilers from specific type and table |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 104 | allCompilers="""select distinct compilerid from %s WHERE typeid=?""" |
| 105 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 106 | # Get compilers from specific type and table |
| 107 | allCores="""select distinct coreid from %s WHERE typeid=?""" |
| 108 | |
| 109 | |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 110 | compilerDesc="""select compiler,version from COMPILER |
| 111 | INNER JOIN COMPILERKIND USING(compilerkindid) WHERE compilerid=?""" |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 112 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 113 | coreDesc="""select core from CORE WHERE coreid=?""" |
| 114 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 115 | # Get existing compiler in a table for a specific type |
| 116 | # (In case report is structured by types) |
| 117 | def getExistingCompiler(benchTable,typeid): |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 118 | r=c.execute(allCompilers % benchTable,(typeid,)).fetchall() |
| 119 | return([x[0] for x in r]) |
| 120 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 121 | def getExistingCores(benchTable,typeid): |
| 122 | r=c.execute(allCores % benchTable,(typeid,)).fetchall() |
| 123 | return([x[0] for x in r]) |
| 124 | |
| 125 | |
| 126 | |
| 127 | def getCoreDesc(compilerid): |
| 128 | r=c.execute(coreDesc,(compilerid,)).fetchone() |
| 129 | return(r) |
| 130 | |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 131 | def getCompilerDesc(compilerid): |
| 132 | r=c.execute(compilerDesc,(compilerid,)).fetchone() |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 133 | return(r) |
| 134 | |
| 135 | # Get type name from type id |
| 136 | def getTypeName(typeid): |
| 137 | r=c.execute("select type from TYPE where typeid=?",(typeid,)).fetchone() |
| 138 | return(r[0]) |
| 139 | |
| 140 | # Diff of 2 lists |
| 141 | def diff(first, second): |
| 142 | second = set(second) |
| 143 | return [item for item in first if item not in second] |
| 144 | |
| 145 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 146 | # Command to get data for specific core |
| 147 | # and type |
| 148 | historyCmd="""select %s from %s |
| 149 | INNER JOIN CATEGORY USING(categoryid) |
| 150 | INNER JOIN PLATFORM USING(platformid) |
| 151 | INNER JOIN CORE USING(coreid) |
| 152 | INNER JOIN COMPILER USING(compilerid) |
| 153 | INNER JOIN COMPILERKIND USING(compilerkindid) |
| 154 | INNER JOIN TYPE USING(typeid) |
| 155 | INNER JOIN TESTNAME USING(testnameid) |
| 156 | WHERE compilerid=? AND coreid=? AND typeid = ? AND ID = ? AND runid > (? - 10) |
| 157 | """ |
| 158 | |
| 159 | compilersForHistory="""select distinct compilerid,compiler,version from %s |
| 160 | INNER JOIN COMPILER USING(compilerid) |
| 161 | INNER JOIN COMPILERKIND USING(compilerkindid) |
| 162 | WHERE coreid=? AND typeid = ? AND ID = ? AND runid > (? - 10) |
| 163 | """ |
| 164 | |
| 165 | # Command to get data for specific core |
| 166 | # and type |
| 167 | benchCmdForCore="""select %s from %s |
| 168 | INNER JOIN CATEGORY USING(categoryid) |
| 169 | INNER JOIN PLATFORM USING(platformid) |
| 170 | INNER JOIN CORE USING(coreid) |
| 171 | INNER JOIN COMPILER USING(compilerid) |
| 172 | INNER JOIN COMPILERKIND USING(compilerkindid) |
| 173 | INNER JOIN TYPE USING(typeid) |
| 174 | INNER JOIN TESTNAME USING(testnameid) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 175 | WHERE coreid=? AND typeid = ? AND %s |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 176 | """ |
| 177 | |
| 178 | coresForHistory="""select distinct coreid,core from %s |
| 179 | INNER JOIN CORE USING(coreid) |
| 180 | WHERE compilerid=? AND typeid = ? AND ID = ? AND runid > (? - 10) |
| 181 | """ |
| 182 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 183 | # Command to get data for specific compiler |
| 184 | # and type |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 185 | benchCmdForCompiler="""select %s from %s |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 186 | INNER JOIN CATEGORY USING(categoryid) |
| 187 | INNER JOIN PLATFORM USING(platformid) |
| 188 | INNER JOIN CORE USING(coreid) |
| 189 | INNER JOIN COMPILER USING(compilerid) |
| 190 | INNER JOIN COMPILERKIND USING(compilerkindid) |
| 191 | INNER JOIN TYPE USING(typeid) |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 192 | INNER JOIN TESTNAME USING(testnameid) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 193 | WHERE compilerid=? AND typeid = ? AND %s |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 194 | """ |
| 195 | |
| 196 | # Command to get test names for specific compiler |
| 197 | # and type |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 198 | benchNamesForCore="""select distinct ID,name from %s |
| 199 | INNER JOIN COMPILER USING(compilerid) |
| 200 | INNER JOIN COMPILERKIND USING(compilerkindid) |
| 201 | INNER JOIN TYPE USING(typeid) |
| 202 | INNER JOIN TESTNAME USING(testnameid) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 203 | WHERE coreid=? AND typeid = ? AND %s |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 204 | """ |
| 205 | # Command to get test names for specific compiler |
| 206 | # and type |
| 207 | benchNamesForCompiler="""select distinct ID,name from %s |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 208 | INNER JOIN COMPILER USING(compilerid) |
| 209 | INNER JOIN COMPILERKIND USING(compilerkindid) |
| 210 | INNER JOIN TYPE USING(typeid) |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 211 | INNER JOIN TESTNAME USING(testnameid) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 212 | WHERE compilerid=? AND typeid = ? AND %s |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 213 | """ |
| 214 | |
| 215 | # Command to get columns for specific table |
| 216 | benchCmdColumns="""select * from %s |
| 217 | INNER JOIN CATEGORY USING(categoryid) |
| 218 | INNER JOIN PLATFORM USING(platformid) |
| 219 | INNER JOIN CORE USING(coreid) |
| 220 | INNER JOIN COMPILER USING(compilerid) |
| 221 | INNER JOIN COMPILERKIND USING(compilerkindid) |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 222 | INNER JOIN TESTNAME USING(testnameid) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 223 | INNER JOIN TYPE USING(typeid) |
| 224 | """ |
| 225 | |
| 226 | def joinit(iterable, delimiter): |
| 227 | it = iter(iterable) |
| 228 | yield next(it) |
| 229 | for x in it: |
| 230 | yield delimiter |
| 231 | yield x |
| 232 | |
| 233 | # Is not a column name finishing by id |
| 234 | # (often primary key for thetable) |
| 235 | def isNotIDColumn(col): |
| 236 | if re.match(r'^.*id$',col): |
| 237 | return(False) |
| 238 | else: |
| 239 | return(True) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 240 | |
| 241 | # Get test names |
| 242 | # for specific typeid and core (for the data) |
| 243 | def getTestNamesForCore(benchTable,core,typeid): |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 244 | vals=(core,typeid) + runidval |
| 245 | result=c.execute(benchNamesForCore % (benchTable,runidCMD),vals).fetchall() |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 246 | names=[(x[0],x[1]) for x in list(result)] |
| 247 | return(names) |
| 248 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 249 | # Get test names |
| 250 | # for specific typeid and compiler (for the data) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 251 | def getTestNamesForCompiler(benchTable,comp,typeid): |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 252 | vals=(comp,typeid) + runidval |
| 253 | result=c.execute(benchNamesForCompiler % (benchTable,runidCMD),vals).fetchall() |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 254 | names=[(x[0],x[1]) for x in list(result)] |
| 255 | return(names) |
| 256 | |
| 257 | # Command to get data for specific core |
| 258 | # and type |
| 259 | nbElemsInBenchAndTypeAndCoreCmd="""select count(*) from %s |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 260 | WHERE coreid=? AND typeid = ? AND %s |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 261 | """ |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 262 | |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 263 | # Command to get data for specific compiler |
| 264 | # and type |
| 265 | nbElemsInBenchAndTypeAndCompilerCmd="""select count(*) from %s |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 266 | WHERE compilerid=? AND typeid = ? AND %s |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 267 | """ |
| 268 | |
| 269 | nbElemsInBenchAndTypeCmd="""select count(*) from %s |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 270 | WHERE typeid = ? AND %s |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 271 | """ |
| 272 | |
| 273 | nbElemsInBenchCmd="""select count(*) from %s |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 274 | WHERE %s |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 275 | """ |
| 276 | |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 277 | categoryName="""select distinct category from %s |
| 278 | INNER JOIN CATEGORY USING(categoryid) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 279 | WHERE %s |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 280 | """ |
| 281 | |
| 282 | def getCategoryName(benchTable,runid): |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 283 | result=c.execute(categoryName % (benchTable,runidCMD),runidval).fetchone() |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 284 | return(result[0]) |
| 285 | |
Christophe Favergeon | 4f75070 | 2020-05-13 15:56:15 +0200 | [diff] [blame] | 286 | # Get nb elems in a table |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 287 | def getNbElemsInBenchAndTypeAndCoreCmd(benchTable,coreid,typeid): |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 288 | vals=(coreid,typeid) + runidval |
| 289 | result=c.execute(nbElemsInBenchAndTypeAndCoreCmd % (benchTable,runidCMD),vals).fetchone() |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 290 | return(result[0]) |
| 291 | |
| 292 | # Get nb elems in a table |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 293 | def getNbElemsInBenchAndTypeAndCompilerCmd(benchTable,comp,typeid): |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 294 | vals=(comp,typeid) + runidval |
| 295 | result=c.execute(nbElemsInBenchAndTypeAndCompilerCmd % (benchTable,runidCMD),vals).fetchone() |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 296 | return(result[0]) |
| 297 | |
| 298 | def getNbElemsInBenchAndTypeCmd(benchTable,typeid): |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 299 | vals=(typeid,) + runidval |
| 300 | result=c.execute(nbElemsInBenchAndTypeCmd % (benchTable,runidCMD),vals).fetchone() |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 301 | return(result[0]) |
| 302 | |
| 303 | def getNbElemsInBenchCmd(benchTable): |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 304 | result=c.execute(nbElemsInBenchCmd % (benchTable,runidCMD),runidval).fetchone() |
Christophe Favergeon | 4f75070 | 2020-05-13 15:56:15 +0200 | [diff] [blame] | 305 | return(result[0]) |
| 306 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 307 | # Get names of columns and data for a table |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 308 | # for specific typeid and coreid (for the data) |
| 309 | def getColNamesAndHistory(benchTable,compiler,core,typeid,testid): |
| 310 | cursor=c.cursor() |
| 311 | result=cursor.execute(benchCmdColumns % (benchTable)) |
| 312 | cols= [member[0] for member in cursor.description] |
| 313 | keepCols = ['name','runid'] + [c for c in diff(cols , REMOVECOLUMNSFORHISTORY) if isNotIDColumn(c)] |
| 314 | keepColsStr = "".join(joinit(keepCols,",")) |
| 315 | vals=(compiler,core,typeid,testid,runid) |
| 316 | result=cursor.execute(historyCmd % (keepColsStr,benchTable),vals) |
| 317 | vals =np.array([list(x) for x in list(result)]) |
| 318 | return(keepCols,vals) |
| 319 | |
| 320 | # Get names of columns and data for a table |
| 321 | # for specific typeid and coreid (for the data) |
| 322 | def getColNamesAndDataForCore(benchTable,core,typeid): |
| 323 | cursor=c.cursor() |
| 324 | result=cursor.execute(benchCmdColumns % (benchTable)) |
| 325 | cols= [member[0] for member in cursor.description] |
| 326 | keepCols = ['name'] + [c for c in diff(cols , REMOVECOLUMNS) if isNotIDColumn(c)] |
| 327 | keepColsStr = "".join(joinit(keepCols,",")) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 328 | vals=(core,typeid) + runidval |
| 329 | result=cursor.execute(benchCmdForCore % (keepColsStr,benchTable,runidCMD),vals) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 330 | vals =np.array([list(x) for x in list(result)]) |
| 331 | return(keepCols,vals) |
| 332 | |
| 333 | |
| 334 | # Get names of columns and data for a table |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 335 | # for specific typeid and compiler (for the data) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 336 | def getColNamesAndDataForCompiler(benchTable,comp,typeid): |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 337 | cursor=c.cursor() |
| 338 | result=cursor.execute(benchCmdColumns % (benchTable)) |
| 339 | cols= [member[0] for member in cursor.description] |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 340 | keepCols = ['name'] + [c for c in diff(cols , REMOVECOLUMNS) if isNotIDColumn(c)] |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 341 | keepColsStr = "".join(joinit(keepCols,",")) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 342 | vals=(comp,typeid) + runidval |
| 343 | result=cursor.execute(benchCmdForCompiler % (keepColsStr,benchTable,runidCMD),vals) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 344 | vals =np.array([list(x) for x in list(result)]) |
| 345 | return(keepCols,vals) |
| 346 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 347 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 348 | |
| 349 | PARAMS=["NB","NumTaps", "NBA", "NBB", "Factor", "NumStages","VECDIM","NBR","NBC","NBI","IFFT", "BITREV"] |
| 350 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 351 | def regressionTableFor(byname,name,section,ref,toSort,indexCols,field): |
| 352 | data=ref.pivot_table(index=indexCols, columns=byname, |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 353 | values=[field], aggfunc='first') |
| 354 | |
| 355 | data=data.sort_values(toSort) |
| 356 | |
| 357 | cores = [c[1] for c in list(data.columns)] |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 358 | columns = diff(indexCols,['name']) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 359 | |
Christophe Favergeon | 34d313a | 2020-05-14 15:09:41 +0200 | [diff] [blame] | 360 | dataTable=Table(columns,cores) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 361 | section.addContent(dataTable) |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 362 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 363 | dataForFunc=data.loc[name] |
| 364 | if type(dataForFunc) is pd.DataFrame: |
Christophe Favergeon | 0dcf9a1 | 2020-05-27 15:55:27 +0200 | [diff] [blame] | 365 | bars={'cols':columns,'cores':cores,'data':[]} |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 366 | for row in dataForFunc.itertuples(): |
| 367 | row=list(row) |
| 368 | if type(row[0]) is int: |
| 369 | row=[row[0]] + row[1:] |
| 370 | else: |
| 371 | row=list(row[0]) + row[1:] |
Christophe Favergeon | ed0eab8 | 2020-05-18 08:43:38 +0200 | [diff] [blame] | 372 | if field=="MAXREGCOEF": |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 373 | newrow = row |
| 374 | newrow[len(columns):] = [("%.3f" % x) for x in row[len(columns):]] |
| 375 | row=newrow |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 376 | dataTable.addRow(row) |
Christophe Favergeon | 0dcf9a1 | 2020-05-27 15:55:27 +0200 | [diff] [blame] | 377 | bars['data'].append(row) |
| 378 | return(bars) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 379 | else: |
Christophe Favergeon | ed0eab8 | 2020-05-18 08:43:38 +0200 | [diff] [blame] | 380 | if field=="MAXREGCOEF": |
| 381 | dataForFunc=[("%.3f" % x) for x in dataForFunc] |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 382 | dataTable.addRow(dataForFunc) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 383 | return(list(zip(cores,dataForFunc))) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 384 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 385 | def formatColumnName(c): |
| 386 | return("".join(joinit(c,":"))) |
| 387 | |
| 388 | def getCoresForHistory(benchTable,compilerid,typeid,testid,runid): |
| 389 | vals=(compilerid,typeid,testid,runid) |
| 390 | result=c.execute(coresForHistory % benchTable,vals).fetchall() |
| 391 | ids=[(x[0],x[1]) for x in list(result)] |
| 392 | return(ids) |
| 393 | |
| 394 | def getCompilerForHistory(benchTable,coreid,typeid,testid,runid): |
| 395 | vals=(coreid,typeid,testid,runid) |
| 396 | result=c.execute(compilersForHistory % benchTable,vals).fetchall() |
| 397 | ids=[(x[0],x[1],x[2]) for x in list(result)] |
| 398 | return(ids) |
| 399 | |
| 400 | def getHistory(desc,testid,indexCols): |
| 401 | benchName,sectionID,typeid,runid = desc |
| 402 | |
| 403 | #print(benchName) |
| 404 | #print(sectionID) |
| 405 | #print(typeid) |
| 406 | #print(testid) |
| 407 | columns = diff(indexCols,['name']) |
| 408 | #print(columns) |
| 409 | if args.byc: |
| 410 | coreid=sectionID |
| 411 | compilerids=getCompilerForHistory(benchName,coreid,typeid,testid,runid) |
| 412 | series={} |
| 413 | for compilerid,compilername,version in compilerids: |
| 414 | result=getColNamesAndHistory(benchName,compilerid,coreid,typeid,testid) |
| 415 | #print("%s:%s" % (compilername,version)) |
| 416 | maxpos = result[0].index('MAX') |
| 417 | lrunid = result[0].index('runid') |
| 418 | r=[[int(x[lrunid]),int(x[maxpos])] for x in result[1:][0]] |
| 419 | series[corename]=r |
| 420 | hist=History(series,runid) |
| 421 | return(hist) |
| 422 | else: |
| 423 | compilerid=sectionID |
| 424 | coreids = getCoresForHistory(benchName,compilerid,typeid,testid,runid) |
| 425 | series={} |
| 426 | for coreid,corename in coreids: |
| 427 | result=getColNamesAndHistory(benchName,compilerid,coreid,typeid,testid) |
| 428 | #print(corename) |
| 429 | maxpos = result[0].index('MAX') |
| 430 | corepos = result[0].index('core') |
| 431 | lrunid = result[0].index('runid') |
| 432 | r=[[int(x[lrunid]),int(x[maxpos])] for x in result[1:][0]] |
| 433 | series[corename]=r |
| 434 | hist=History(series,runid) |
| 435 | return(hist) |
| 436 | |
| 437 | def formatTableBy(desc,byname,section,typeSection,testNames,cols,vals): |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 438 | if vals.size != 0: |
| 439 | ref=pd.DataFrame(vals,columns=cols) |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 440 | toSort=["name"] |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 441 | |
| 442 | for param in PARAMS: |
| 443 | if param in ref.columns: |
| 444 | ref[param]=pd.to_numeric(ref[param]) |
| 445 | toSort.append(param) |
| 446 | if args.r: |
| 447 | # Regression table |
| 448 | ref['MAX']=pd.to_numeric(ref['MAX']) |
| 449 | ref['MAXREGCOEF']=pd.to_numeric(ref['MAXREGCOEF']) |
| 450 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 451 | indexCols=diff(cols,byname + ['Regression','MAXREGCOEF','MAX'] + section) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 452 | valList = ['Regression'] |
| 453 | else: |
| 454 | ref['CYCLES']=pd.to_numeric(ref['CYCLES']) |
| 455 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 456 | indexCols=diff(cols,byname + ['CYCLES'] + section) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 457 | valList = ['CYCLES'] |
| 458 | |
| 459 | |
| 460 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 461 | for testid,name in testNames: |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 462 | if args.r: |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 463 | testSection = Section(name) |
| 464 | typeSection.addSection(testSection) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 465 | |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 466 | maxCyclesSection = Section("Max cycles") |
| 467 | testSection.addSection(maxCyclesSection) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 468 | theCycles=regressionTableFor(byname,name,maxCyclesSection,ref,toSort,indexCols,'MAX') |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 469 | if args.g: |
| 470 | if type(theCycles) is dict: |
| 471 | nbParams=len(theCycles['cols']) |
| 472 | for bar in theCycles['data']: |
| 473 | params=bar[0:nbParams] |
| 474 | values=bar[nbParams:] |
| 475 | title=[("%s=%s" % x) for x in list(zip(theCycles['cols'],params))] |
| 476 | title="".join(joinit(title," ")) |
| 477 | sec=Section(title) |
| 478 | maxCyclesSection.addSection(sec) |
| 479 | values=list(zip(theCycles['cores'],values)) |
| 480 | barChart=BarChart(values) |
| 481 | sec.addContent(barChart) |
| 482 | else: |
| 483 | #print(theCycles) |
| 484 | sec=Section("Graph") |
Christophe Favergeon | 0dcf9a1 | 2020-05-27 15:55:27 +0200 | [diff] [blame] | 485 | maxCyclesSection.addSection(sec) |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 486 | barChart=BarChart(theCycles) |
Christophe Favergeon | 0dcf9a1 | 2020-05-27 15:55:27 +0200 | [diff] [blame] | 487 | sec.addContent(barChart) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 488 | |
Christophe Favergeon | 670b167 | 2020-05-28 12:47:58 +0200 | [diff] [blame] | 489 | #history=getHistory(desc,testid,indexCols) |
| 490 | #testSection.addContent(history) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 491 | |
| 492 | regressionSection = Section("Regression") |
| 493 | testSection.addSection(regressionSection) |
| 494 | regressionTableFor(byname,name,regressionSection,ref,toSort,indexCols,'Regression') |
| 495 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 496 | |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 497 | maxRegCoefSection = Section("Max Reg Coef") |
| 498 | testSection.addSection(maxRegCoefSection) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 499 | regressionTableFor(byname,name,maxRegCoefSection,ref,toSort,indexCols,'MAXREGCOEF') |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 500 | |
| 501 | else: |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 502 | data=ref.pivot_table(index=indexCols, columns=byname, |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 503 | values=valList, aggfunc='first') |
| 504 | |
| 505 | data=data.sort_values(toSort) |
| 506 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 507 | #print(list(data.columns)) |
| 508 | columnsID = [formatColumnName(c[1:]) for c in list(data.columns)] |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 509 | columns = diff(indexCols,['name']) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 510 | |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 511 | testSection = Section(name) |
| 512 | typeSection.addSection(testSection) |
| 513 | |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 514 | dataTable=Table(columns,columnsID) |
| 515 | testSection.addContent(dataTable) |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 516 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 517 | dataForFunc=data.loc[name] |
| 518 | if type(dataForFunc) is pd.DataFrame: |
| 519 | for row in dataForFunc.itertuples(): |
| 520 | row=list(row) |
| 521 | if type(row[0]) is int: |
| 522 | row=[row[0]] + row[1:] |
| 523 | else: |
| 524 | row=list(row[0]) + row[1:] |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 525 | dataTable.addRow(row) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 526 | else: |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 527 | dataTable.addRow(dataForFunc) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 528 | |
| 529 | # Add a report for each table |
Christophe Favergeon | ed0eab8 | 2020-05-18 08:43:38 +0200 | [diff] [blame] | 530 | def addReportFor(document,runid,benchName): |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 531 | nbElems = getNbElemsInBenchCmd(benchName) |
| 532 | if nbElems > 0: |
Christophe Favergeon | ed0eab8 | 2020-05-18 08:43:38 +0200 | [diff] [blame] | 533 | categoryName = getCategoryName(benchName,runid) |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 534 | benchSection = Section(categoryName) |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 535 | document.addSection(benchSection) |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 536 | print("Process %s\n" % benchName) |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 537 | allTypes = getExistingTypes(benchName) |
| 538 | # Add report for each type |
| 539 | for aTypeID in allTypes: |
| 540 | nbElems = getNbElemsInBenchAndTypeCmd(benchName,aTypeID) |
| 541 | if nbElems > 0: |
| 542 | typeName = getTypeName(aTypeID) |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 543 | typeSection = Section(typeName) |
| 544 | benchSection.addSection(typeSection) |
Christophe Favergeon | feb7393 | 2020-05-20 14:48:06 +0200 | [diff] [blame] | 545 | if args.byc: |
| 546 | ## Add report for each core |
| 547 | allCores = getExistingCores(benchName,aTypeID) |
| 548 | for core in allCores: |
| 549 | #print(core) |
| 550 | nbElems = getNbElemsInBenchAndTypeAndCoreCmd(benchName,core,aTypeID) |
| 551 | # Print test results for table, type, compiler |
| 552 | if nbElems > 0: |
| 553 | coreName=getCoreDesc(core) |
| 554 | coreSection = Section("%s" % coreName) |
| 555 | typeSection.addSection(coreSection) |
| 556 | cols,vals=getColNamesAndDataForCore(benchName,core,aTypeID) |
| 557 | desc=(benchName,core,aTypeID,runid) |
| 558 | names=getTestNamesForCore(benchName,core,aTypeID) |
| 559 | formatTableBy(desc,['compiler','version'],['core'],coreSection,names,cols,vals) |
| 560 | else: |
| 561 | ## Add report for each compiler |
| 562 | allCompilers = getExistingCompiler(benchName,aTypeID) |
| 563 | for compiler in allCompilers: |
| 564 | #print(compiler) |
| 565 | nbElems = getNbElemsInBenchAndTypeAndCompilerCmd(benchName,compiler,aTypeID) |
| 566 | # Print test results for table, type, compiler |
| 567 | if nbElems > 0: |
| 568 | compilerName,version=getCompilerDesc(compiler) |
| 569 | compilerSection = Section("%s (%s)" % (compilerName,version)) |
| 570 | typeSection.addSection(compilerSection) |
| 571 | cols,vals=getColNamesAndDataForCompiler(benchName,compiler,aTypeID) |
| 572 | desc=(benchName,compiler,aTypeID,runid) |
| 573 | names=getTestNamesForCompiler(benchName,compiler,aTypeID) |
| 574 | formatTableBy(desc,['core'],['version','compiler'],compilerSection,names,cols,vals) |
| 575 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 576 | |
| 577 | |
| 578 | |
Christophe Favergeon | ed0eab8 | 2020-05-18 08:43:38 +0200 | [diff] [blame] | 579 | toc=[Hierarchy("BasicMathsBenchmarks"), |
| 580 | Hierarchy("ComplexMathsBenchmarks"), |
| 581 | Hierarchy("FastMath"), |
| 582 | Hierarchy("Filters", |
| 583 | [Hierarchy("FIR"), |
| 584 | Hierarchy("BIQUAD"), |
| 585 | Hierarchy("DECIM"), |
| 586 | Hierarchy("MISC")]), |
| 587 | |
| 588 | Hierarchy("Support Functions", |
| 589 | [Hierarchy("Support"), |
| 590 | Hierarchy("SupportBar")]), |
| 591 | |
| 592 | Hierarchy("Matrix Operations" , |
| 593 | [Hierarchy("Binary"), |
| 594 | Hierarchy("Unary")]), |
| 595 | Hierarchy("Transform"), |
| 596 | |
| 597 | ] |
| 598 | |
| 599 | processed=[] |
| 600 | |
| 601 | def createDoc(document,sections,benchtables): |
| 602 | global processed |
| 603 | for s in sections: |
| 604 | if s.name in benchtables: |
| 605 | addReportFor(document,runid,s.name) |
| 606 | processed.append(s.name) |
| 607 | else: |
| 608 | section=Section(s.name) |
| 609 | document.addSection(section) |
| 610 | createDoc(section,s.sections,benchtables) |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 611 | |
| 612 | try: |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 613 | benchtables=getBenchTables() |
Christophe Favergeon | e15894e | 2020-05-14 07:25:53 +0200 | [diff] [blame] | 614 | theDate = getrunIDDate(runid) |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 615 | document = Document(runid,theDate) |
Christophe Favergeon | ed0eab8 | 2020-05-18 08:43:38 +0200 | [diff] [blame] | 616 | createDoc(document,toc,benchtables) |
| 617 | misc=Section("Miscellaneous") |
| 618 | document.addSection(misc) |
| 619 | remaining=diff(benchtables,processed) |
| 620 | for bench in remaining: |
| 621 | addReportFor(misc,runid,bench) |
| 622 | |
| 623 | #for bench in benchtables: |
| 624 | # addReportFor(document,bench) |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 625 | with open(args.o,"w") as output: |
| 626 | if args.t=="md": |
| 627 | document.accept(Markdown(output)) |
| 628 | if args.t=="html": |
Christophe Favergeon | 4fa1e23 | 2020-05-15 12:28:17 +0200 | [diff] [blame] | 629 | document.accept(HTML(output,args.r)) |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 630 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 631 | finally: |
| 632 | c.close() |
| 633 | |
Christophe Favergeon | c3f455c | 2020-05-14 09:24:07 +0200 | [diff] [blame] | 634 | |
| 635 | |
Christophe Favergeon | 8cb3730 | 2020-05-13 13:06:58 +0200 | [diff] [blame] | 636 | |