summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/support/buildTable.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/buildTable.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/buildTable.py')
-rw-r--r--SD-VBS/common/support/buildTable.py54
1 files changed, 54 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 @@
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 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
37def 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
53if __name__=="__main__":
54 main()