Commit 2ef4e2ee authored by Andrey Kamaev's avatar Andrey Kamaev

Perf tests: fixed some bugs in scripts

parent 52184c88
...@@ -3,13 +3,15 @@ from table_formatter import * ...@@ -3,13 +3,15 @@ from table_formatter import *
from optparse import OptionParser from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$") cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(8U|8S|16U|16S|32S|32F|64F)C\d{1,3}$") cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
def keyselector(a): def keyselector(a):
if cvsize_re.match(a): if cvsize_re.match(a):
size = [int(d) for d in a.split('x')] size = [int(d) for d in a.split('x')]
return size[0] * size[1] return size[0] * size[1]
elif cvtype_re.match(a): elif cvtype_re.match(a):
if a.startswith("CV_"):
a = a[3:]
depth = 7 depth = 7
if a[0] == '8': if a[0] == '8':
depth = (0, 1) [a[1] == 'S'] depth = (0, 1) [a[1] == 'S']
...@@ -21,9 +23,13 @@ def keyselector(a): ...@@ -21,9 +23,13 @@ def keyselector(a):
depth = 5 depth = 5
elif a[0] == '6': elif a[0] == '6':
depth = 6 depth = 6
channels = int(a[a.index('C') + 1:]) cidx = a.find('C')
if cidx < 0:
channels = 1
else:
channels = int(a[a.index('C') + 1:])
#return (depth & 7) + ((channels - 1) << 3) #return (depth & 7) + ((channels - 1) << 3)
return ((channels-1) & 511) + (depth << 8) return ((channels-1) & 511) + (depth << 9)
return a return a
def getValueParams(test): def getValueParams(test):
...@@ -86,7 +92,6 @@ if __name__ == "__main__": ...@@ -86,7 +92,6 @@ if __name__ == "__main__":
exit(1) exit(1)
options.generateHtml = detectHtmlOutputType(options.format) options.generateHtml = detectHtmlOutputType(options.format)
args[0] = os.path.basename(args[0])
if options.metric not in metrix_table: if options.metric not in metrix_table:
options.metric = "gmean" options.metric = "gmean"
if options.metric.endswith("%"): if options.metric.endswith("%"):
...@@ -97,6 +102,10 @@ if __name__ == "__main__": ...@@ -97,6 +102,10 @@ if __name__ == "__main__":
if options.filter: if options.filter:
expr = re.compile(options.filter) expr = re.compile(options.filter)
tests = [(t,getValueParams(t)) for t in tests if expr.search(str(t))] tests = [(t,getValueParams(t)) for t in tests if expr.search(str(t))]
else:
tests = [(t,getValueParams(t)) for t in tests]
args[0] = os.path.basename(args[0])
if not tests: if not tests:
print >> sys.stderr, "Error - no tests matched" print >> sys.stderr, "Error - no tests matched"
...@@ -108,22 +117,33 @@ if __name__ == "__main__": ...@@ -108,22 +117,33 @@ if __name__ == "__main__":
arglists = [] arglists = []
for i in range(argsnum): for i in range(argsnum):
arglists.append({}) arglists.append({})
names = set()
for pair in tests: for pair in tests:
if len(pair[1]) != argsnum: sn = pair[0].shortName()
print >> sys.stderr, "Error - unable to create chart tables for functions having different argument numbers" names.add(sn)
exit(1) if sn == sname:
if pair[0].shortName() != sname: if len(pair[1]) != argsnum:
print >> sys.stderr, "Error - unable to create chart tables for functions from different test suits:" print >> sys.stderr, "Error - unable to create chart tables for functions having different argument numbers"
print >> sys.stderr, "First: ", sname sys.exit(1)
print >> sys.stderr, "Second:", pair[0].shortName() for i in range(argsnum):
exit(1) arglists[i][pair[1][i]] = 1
for i in range(argsnum):
arglists[i][pair[1][i]] = 1 if len(names) != 1:
print >> sys.stderr, "Error - unable to create chart tables for functions from different test suits:"
i = 1
for name in sorted(names):
print >> sys.stderr, "%4s: %s" % (i, name)
i += 1
sys.exit(1)
if argsnum < 2:
print >> sys.stderr, "Error - tests from %s have less than 2 parameters" % sname
exit(1)
for i in range(argsnum): for i in range(argsnum):
arglists[i] = sorted([str(key) for key in arglists[i].iterkeys()], key=keyselector) arglists[i] = sorted([str(key) for key in arglists[i].iterkeys()], key=keyselector)
if options.generateHtml: if options.generateHtml:
htmlPrintHeader(sys.stdout, "Report %s for %s" % (args[0], sname)) htmlPrintHeader(sys.stdout, "Report %s for %s" % (args[0], sname))
......
...@@ -16,7 +16,6 @@ if __name__ == "__main__": ...@@ -16,7 +16,6 @@ if __name__ == "__main__":
exit(0) exit(0)
options.generateHtml = detectHtmlOutputType(options.format) options.generateHtml = detectHtmlOutputType(options.format)
args[0] = os.path.basename(args[0])
tests = [] tests = []
files = [] files = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment