Resultbrowser: Integrate pruning intervals

Change-Id: I27b1eb087571e9470aa35e35e23db2e130b9f7c0
This commit is contained in:
Martin Hoffmann
2014-04-28 14:38:46 +02:00
parent 0fb6653fa8
commit ebb307f3ee

View File

@ -63,7 +63,7 @@ def closeSession():
'''Populate variant results for overview data''' '''Populate variant results for overview data'''
def getVariants(cur, table): def getVariants(cur, table):
restbl = table.getDetails().getDBName() restbl = table.getDetails().getDBName()
cur.execute("""SELECT resulttype, variant, variant_id, benchmark, count(*) as total from %s join fsppilot on %s.pilot_id=fsppilot.id join variant on fsppilot.variant_id=variant.id group by resulttype, variant.id ORDER BY variant.id""" % (restbl, restbl)) # % is used here, as a tablename must not be quoted cur.execute("""SELECT sum((t.time2 - t.time1 + 1) * width) AS total, resulttype,variant, v.id as variant_id, benchmark, details FROM variant v JOIN trace t ON v.id = t.variant_id JOIN fspgroup g ON g.variant_id = t.variant_id AND g.instr2 = t.instr2 AND g.data_address = t.data_address JOIN %s r ON r.pilot_id = g.pilot_id JOIN fsppilot p ON r.pilot_id = p.id GROUP BY v.id, resulttype, details""" % (restbl)) # % is used here, as a tablename must not be quoted
res = cur.fetchall() res = cur.fetchall()
rdic = {} rdic = {}
# Build dict with variant id as key # Build dict with variant id as key
@ -115,8 +115,8 @@ def getVariantResult(table, variantid):
cur = loadSession(sqlconfig) cur = loadSession(sqlconfig)
restbl = scrub(table) restbl = scrub(table)
stmt = "SELECT resulttype, count(*) as total from %s join fsppilot on %s.pilot_id=fsppilot.id join variant on fsppilot.variant_id=variant.id" % (restbl, restbl) stmt = "SELECT resulttype, count(*) as total from %s r join fsppilot on r.pilot_id=fsppilot.id join variant on fsppilot.variant_id=variant.id" % (restbl)
where = " WHERE variant.id = %s group by resulttype ORDER BY resulttype" where = " WHERE variant.id = %s group by resulttype ORDER BY resulttype "
stmt = stmt + where stmt = stmt + where
cur.execute(stmt, variantid) cur.execute(stmt, variantid)
res = cur.fetchall() res = cur.fetchall()
@ -142,14 +142,14 @@ def getCode(result_table, variant_id, resultlabel=None):
filt = " and resulttype = '" + resultlabel + "' " filt = " and resulttype = '" + resultlabel + "' "
# I especially like this one: # I especially like this one:
select = "SELECT instr_address, opcode, disassemble, comment, COUNT(*) as totals, GROUP_CONCAT(DISTINCT resulttype SEPARATOR ', ') as results FROM %s " % result_table select = "SELECT instr_address, opcode, disassemble, comment, sum(t.time2 - t.time1 + 1) as totals, GROUP_CONCAT(DISTINCT resulttype SEPARATOR ', ') as results FROM variant v "
join = "JOIN fsppilot ON pilot_id = fsppilot.id JOIN objdump ON objdump.instr_address = injection_instr_absolute " join = " JOIN trace t ON v.id = t.variant_id JOIN fspgroup g ON g.variant_id = t.variant_id AND g.instr2 = t.instr2 AND g.data_address = t.data_address JOIN result_VEZSProtoMsg r ON r.pilot_id = g.pilot_id JOIN fsppilot p ON r.pilot_id = p.id JOIN objdump ON objdump.variant_id = v.id AND objdump.instr_address = injection_instr_absolute "
where = "WHERE objdump.variant_id = %s AND fsppilot.variant_id = %s " where = "WHERE v.id = %s "
group = "GROUP BY injection_instr_absolute ORDER BY injection_instr_absolute " group = "GROUP BY injection_instr_absolute ORDER BY totals DESC "
cur = loadSession(sqlconfig) cur = loadSession(sqlconfig)
stmt = select + join + where + filt + group stmt = select + join + where + filt + group
cur.execute(stmt, (variant_id, variant_id)) cur.execute(stmt, (variant_id))
dump = cur.fetchall() dump = cur.fetchall()
closeSession() closeSession()
@ -158,7 +158,7 @@ def getCode(result_table, variant_id, resultlabel=None):
def getCodeExcerpt(variant_id, instr_addr): def getCodeExcerpt(variant_id, instr_addr):
code = {} code = {}
limit = 4 limit = 8
cur = loadSession(sqlconfig) cur = loadSession(sqlconfig)
cur.execute( """(SELECT instr_address, opcode, disassemble, comment FROM objdump \ cur.execute( """(SELECT instr_address, opcode, disassemble, comment FROM objdump \
WHERE instr_address < %s AND variant_id = %s \ WHERE instr_address < %s AND variant_id = %s \
@ -187,9 +187,7 @@ def getResultsbyInstruction(result_table, variant_id, instr_addr, resultlabel=No
restypefilter += "resulttype = '" + dbn + "' OR " restypefilter += "resulttype = '" + dbn + "' OR "
restypefilter += "resulttype = '" + dbnames[-1] +"' ) " restypefilter += "resulttype = '" + dbnames[-1] +"' ) "
select = "SELECT bitoffset as 'Bit Offset', hex(injection_instr_absolute) as 'Instruction Address', hex(original_value) as 'Original Value', hex(data_address) as 'Data Address', resulttype as 'Result Type', details as 'Details' from %s " % scrub(result_table)
#select = "SELECT data_address, data_width, original_value, bitoffset, experiment_number, details, resulttype from %s " % scrub(result_table)
select = "SELECT * from %s " % scrub(result_table)
join = "JOIN fsppilot ON pilot_id = fsppilot.id " join = "JOIN fsppilot ON pilot_id = fsppilot.id "
where = "WHERE variant_id = %s and injection_instr_absolute = %s " where = "WHERE variant_id = %s and injection_instr_absolute = %s "
order = "ORDER BY data_address, bitoffset" order = "ORDER BY data_address, bitoffset"