From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- SD-VBS/common/support/buildTimeTable.py | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 SD-VBS/common/support/buildTimeTable.py (limited to 'SD-VBS/common/support/buildTimeTable.py') diff --git a/SD-VBS/common/support/buildTimeTable.py b/SD-VBS/common/support/buildTimeTable.py new file mode 100644 index 0000000..c718cb2 --- /dev/null +++ b/SD-VBS/common/support/buildTimeTable.py @@ -0,0 +1,55 @@ +import re +import sys +import os + +def getExprName(fileName): + exprFileName = os.path.basename(fileName) + exprName = re.sub("\.txt", "", exprFileName) + exprName = re.sub("_","\t", exprName, 1) + exprName = re.sub("_", "", exprName) + return(exprName) + +def getBmrkName(fileName): + benchmarkDir = os.path.dirname(fileName) + benchmarkName = os.path.basename(benchmarkDir) + return(benchmarkName) + +def getTimeTup(fileName): + try: + inp = open(fileName, 'r') + except IOError, err: + print "ERROR: Could not open the inputFile:"+fileName + sys.exit(1) + globalTup = None + for currline in inp: + currline = currline.strip() + currline = currline.lower() + if(re.match("real", currline)): + #valTup = re.findall("(\d+)", currline) + + return(currline[4:].strip()) + + if(globalTup != None): + return(globalTup) + else: + print "ERROR: INVALID INPUT FILE:"+fileName + sys.exit(2) + +def main(): + if(len(sys.argv)<2): + print "USAGE: "+sys.argv[0]+" " + sys.exit(1) + + fileName = sys.argv[1] + exprName = getExprName(fileName) + benchmarkName = getBmrkName(fileName) + timeTup = getTimeTup(fileName) + + print "%-20s %-20s %10s\n" % (benchmarkName,exprName,timeTup) + + + + + +if __name__=="__main__": + main() -- cgit v1.2.2