summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2015-03-16 13:38:53 -0700
committerLaura Ekstrand <laura@jlekstrand.net>2015-03-16 13:48:50 -0700
commitf09043020bea9586e48c033a61857b5bfdc66e65 (patch)
tree2eab124b6c2fe8f5c09270be348d79ba6649e901
parent726ef2195f313f57814f1c5b8f1a5bf65a58883d (diff)
Added parsing script for teximage-colors --benchmark.
-rw-r--r--benchmark.py38
-rw-r--r--tests/texturing/teximage-colors.c2
2 files changed, 39 insertions, 1 deletions
diff --git a/benchmark.py b/benchmark.py
new file mode 100644
index 000000000..5ced055bc
--- /dev/null
+++ b/benchmark.py
@@ -0,0 +1,38 @@
+import math
+
+# Compares two results from teximage-colors --benchmark.
+def parsefile(filename):
+ """Parses one result from teximage-colors --benchmark."""
+ with open(filename, 'r') as f:
+ # Read the whole file
+ lines = list(f)
+ lines = [line.strip() for line in lines]
+ a = 0
+
+ # Clip it to just the benchmarking part
+ for line in lines:
+ if line.startswith('internalFormat'):
+ break
+ else:
+ a = a + 1
+ lines = lines[a + 1:-1]
+
+ parsedict = {}
+ for line in lines:
+ line = line.split(', ')
+ key = " ".join(line[0:3])
+ parsedict.update({key: float(line[3])})
+
+ return parsedict
+
+ f.closed
+
+metadict = parsefile('adsa-meta-out')
+fbdict = parsefile('adsa-framebuffers-out')
+resultdict = {key: metadict[key] - fbdict[key] for key in metadict if key in fbdict}
+avg = math.fsum(resultdict.values())/len(resultdict.values())
+
+for k, v in resultdict.items():
+ print(k.ljust(60, ' ') + "{: 10.2f}".format(v))
+print("".ljust(70, '-'))
+print("AVERAGE".ljust(60, ' ') + "{: 10.2f}".format(avg))
diff --git a/tests/texturing/teximage-colors.c b/tests/texturing/teximage-colors.c
index ea0c5e179..158171ae6 100644
--- a/tests/texturing/teximage-colors.c
+++ b/tests/texturing/teximage-colors.c
@@ -472,7 +472,7 @@ piglit_init(int argc, char **argv)
srand(seed);
} else if (strcmp(argv[i], "--benchmark") == 0) {
benchmark = true;
- texture_size = 128;
+ texture_size = 16;//128;
} else if (i == argc - 1) {
format = find_format(argv[i]);
break;