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