summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/support/buildTimeTable.py
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/support/buildTimeTable.py
parent601ed25a4c5b66cb75315832c15613a727db2c26 (diff)
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/support/buildTimeTable.py')
-rw-r--r--SD-VBS/common/support/buildTimeTable.py55
1 files changed, 55 insertions, 0 deletions
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 @@
1import re
2import sys
3import os
4
5def 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
12def getBmrkName(fileName):
13 benchmarkDir = os.path.dirname(fileName)
14 benchmarkName = os.path.basename(benchmarkDir)
15 return(benchmarkName)
16
17def 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
38def 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
54if __name__=="__main__":
55 main()