diff options
| author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
|---|---|---|
| committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
| commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
| tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/support | |
| parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) | |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/common/support')
| -rw-r--r-- | SD-VBS/common/support/buildTable.py | 54 | ||||
| -rw-r--r-- | SD-VBS/common/support/buildTimeTable.py | 55 |
2 files changed, 109 insertions, 0 deletions
diff --git a/SD-VBS/common/support/buildTable.py b/SD-VBS/common/support/buildTable.py new file mode 100644 index 0000000..1a1a6aa --- /dev/null +++ b/SD-VBS/common/support/buildTable.py | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | import re | ||
| 2 | import sys | ||
| 3 | import os | ||
| 4 | |||
| 5 | def getExprName(fileName): | ||
| 6 | exprFileName = os.path.basename(fileName) | ||
| 7 | exprName = re.sub("\.txt", "", exprFileName) | ||
| 8 | exprName = re.sub("_","\t", exprName, 1) | ||
| 9 | exprName = re.sub("_", "", exprName) | ||
| 10 | return(exprName) | ||
| 11 | |||
| 12 | def getBmrkName(fileName): | ||
| 13 | benchmarkDir = os.path.dirname(fileName) | ||
| 14 | benchmarkName = os.path.basename(benchmarkDir) | ||
| 15 | return(benchmarkName) | ||
| 16 | |||
| 17 | def getCycleCountTup(fileName): | ||
| 18 | try: | ||
| 19 | inp = open(fileName, 'r') | ||
| 20 | except IOError, err: | ||
| 21 | print "ERROR: Could not open the inputFile:"+fileName | ||
| 22 | sys.exit(1) | ||
| 23 | globalTup = None | ||
| 24 | for currline in inp: | ||
| 25 | currline = currline.strip() | ||
| 26 | currline = currline.lower() | ||
| 27 | if(re.match("cycles elapsed", currline)): | ||
| 28 | valTup = re.findall("(\d+)", currline) | ||
| 29 | return(valTup) | ||
| 30 | |||
| 31 | if(globalTup != None): | ||
| 32 | return(globalTup) | ||
| 33 | else: | ||
| 34 | print "ERROR: INVALID INPUT FILE:"+fileName | ||
| 35 | sys.exit(2) | ||
| 36 | |||
| 37 | def main(): | ||
| 38 | if(len(sys.argv)<2): | ||
| 39 | print "USAGE: "+sys.argv[0]+" <inputFileName>" | ||
| 40 | sys.exit(1) | ||
| 41 | |||
| 42 | fileName = sys.argv[1] | ||
| 43 | exprName = getExprName(fileName) | ||
| 44 | benchmarkName = getBmrkName(fileName) | ||
| 45 | cycleCountTup = getCycleCountTup(fileName) | ||
| 46 | |||
| 47 | print "%-20s %-20s %10s\n" % (benchmarkName,exprName,cycleCountTup[0]) | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | if __name__=="__main__": | ||
| 54 | main() | ||
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 @@ | |||
| 1 | import re | ||
| 2 | import sys | ||
| 3 | import os | ||
| 4 | |||
| 5 | def getExprName(fileName): | ||
| 6 | exprFileName = os.path.basename(fileName) | ||
| 7 | exprName = re.sub("\.txt", "", exprFileName) | ||
| 8 | exprName = re.sub("_","\t", exprName, 1) | ||
| 9 | exprName = re.sub("_", "", exprName) | ||
| 10 | return(exprName) | ||
| 11 | |||
| 12 | def getBmrkName(fileName): | ||
| 13 | benchmarkDir = os.path.dirname(fileName) | ||
| 14 | benchmarkName = os.path.basename(benchmarkDir) | ||
| 15 | return(benchmarkName) | ||
| 16 | |||
| 17 | def getTimeTup(fileName): | ||
| 18 | try: | ||
| 19 | inp = open(fileName, 'r') | ||
| 20 | except IOError, err: | ||
| 21 | print "ERROR: Could not open the inputFile:"+fileName | ||
| 22 | sys.exit(1) | ||
| 23 | globalTup = None | ||
| 24 | for currline in inp: | ||
| 25 | currline = currline.strip() | ||
| 26 | currline = currline.lower() | ||
| 27 | if(re.match("real", currline)): | ||
| 28 | #valTup = re.findall("(\d+)", currline) | ||
| 29 | |||
| 30 | return(currline[4:].strip()) | ||
| 31 | |||
| 32 | if(globalTup != None): | ||
| 33 | return(globalTup) | ||
| 34 | else: | ||
| 35 | print "ERROR: INVALID INPUT FILE:"+fileName | ||
| 36 | sys.exit(2) | ||
| 37 | |||
| 38 | def main(): | ||
| 39 | if(len(sys.argv)<2): | ||
| 40 | print "USAGE: "+sys.argv[0]+" <inputFileName>" | ||
| 41 | sys.exit(1) | ||
| 42 | |||
| 43 | fileName = sys.argv[1] | ||
| 44 | exprName = getExprName(fileName) | ||
| 45 | benchmarkName = getBmrkName(fileName) | ||
| 46 | timeTup = getTimeTup(fileName) | ||
| 47 | |||
| 48 | print "%-20s %-20s %10s\n" % (benchmarkName,exprName,timeTup) | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | if __name__=="__main__": | ||
| 55 | main() | ||
