@ -137,9 +137,10 @@ def findInCompilerTable(conn,kind,version):
if result != None :
if result != None :
return ( result [ 0 ] )
return ( result [ 0 ] )
else :
else :
conn . execute ( " INSERT INTO COMPILER(compilerkindid,version) VALUES(?,?) " , ( kind , version ) )
fullDate = datetime . datetime . now ( )
conn . execute ( " INSERT INTO COMPILER(compilerkindid,version,date) VALUES(?,?,?) " , ( kind , version , fullDate ) )
conn . commit ( )
conn . commit ( )
r = conn . execute ( " select compilerid from COMPILER where compilerkindid=? AND version=? " , ( kind , version ) )
r = conn . execute ( " select compilerid from COMPILER where compilerkindid=? AND version=? AND date=? " , ( kind , version , fullDate ) )
result = r . fetchone ( )
result = r . fetchone ( )
if result != None :
if result != None :
#print(result)
#print(result)
@ -151,6 +152,9 @@ def findInCompilerTable(conn,kind,version):
def addRows ( conn , elem , tableName , full ) :
def addRows ( conn , elem , tableName , full ) :
# List of columns we have in DB which is
# List of columns we have in DB which is
# different from the columns in the table
# different from the columns in the table
compilerid = 0
platformid = 0
coreid = 0
keep = getColumns ( elem , full )
keep = getColumns ( elem , full )
cols = list ( full . columns )
cols = list ( full . columns )
params = diff ( elem . params . full , elem . params . summary )
params = diff ( elem . params . full , elem . params . summary )
@ -224,9 +228,11 @@ def addRows(conn,elem,tableName,full):
if field == " CORE " :
if field == " CORE " :
val = findInTable ( conn , " CORE " , " coredef " , row [ field ] , " coreid " )
val = findInTable ( conn , " CORE " , " coredef " , row [ field ] , " coreid " )
keys [ field ] = val
keys [ field ] = val
coreid = val
if field == " PLATFORM " :
if field == " PLATFORM " :
val = findInTable ( conn , " PLATFORM " , " platform " , row [ field ] , " platformid " )
val = findInTable ( conn , " PLATFORM " , " platform " , row [ field ] , " platformid " )
keys [ field ] = val
keys [ field ] = val
platformid = val
if field == " TYPE " :
if field == " TYPE " :
val = findInTable ( conn , " TYPE " , " type " , keys [ " TYPE " ] , " typeid " )
val = findInTable ( conn , " TYPE " , " type " , keys [ " TYPE " ] , " typeid " )
keys [ field ] = val
keys [ field ] = val
@ -234,6 +240,7 @@ def addRows(conn,elem,tableName,full):
compilerkind = findInTable ( conn , " COMPILERKIND " , " compiler " , row [ field ] , " compilerkindid " )
compilerkind = findInTable ( conn , " COMPILERKIND " , " compiler " , row [ field ] , " compilerkindid " )
compiler = findInCompilerTable ( conn , compilerkind , keys [ " VERSION " ] )
compiler = findInCompilerTable ( conn , compilerkind , keys [ " VERSION " ] )
keys [ field ] = compiler
keys [ field ] = compiler
compilerid = compiler
# Generate sql command
# Generate sql command
start = " "
start = " "
@ -255,18 +262,25 @@ def addRows(conn,elem,tableName,full):
#print(sql)
#print(sql)
conn . execute ( sql )
conn . execute ( sql )
conn . commit ( )
conn . commit ( )
return ( { ' compilerid ' : compilerid , ' platformid ' : platformid , ' coreid ' : coreid } )
def addConfig ( conn , config , fullDate ) :
conn . execute ( " INSERT INTO CONFIG(compilerid,platformid,coreid,date) VALUES(?,?,?,?) " , ( config [ ' compilerid ' ] , config [ ' platformid ' ] , config [ ' coreid ' ] , fullDate ) )
conn . commit ( )
def addOneBenchmark ( elem , fullPath , db , group ) :
def addOneBenchmark ( elem , fullPath , db , group ) :
if os . path . isfile ( fullPath ) :
if os . path . isfile ( fullPath ) :
full = pd . read_csv ( fullPath , dtype = { ' OLDID ' : str } , keep_default_na = False )
full = pd . read_csv ( fullPath , dtype = { ' OLDID ' : str } , keep_default_na = False )
full [ ' DATE ' ] = datetime . datetime . now ( )
fullDate = datetime . datetime . now ( )
full [ ' DATE ' ] = fullDate
if group :
if group :
tableName = group
tableName = group
else :
else :
tableName = elem . data [ " class " ]
tableName = elem . data [ " class " ]
conn = sqlite3 . connect ( db )
conn = sqlite3 . connect ( db )
createTableIfMissing ( conn , elem , tableName , full )
createTableIfMissing ( conn , elem , tableName , full )
addRows ( conn , elem , tableName , full )
config = addRows ( conn , elem , tableName , full )
addConfig ( conn , config , fullDate )
conn . close ( )
conn . close ( )