summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-03-25 11:26:05 -0700
committerEric Anholt <eric@anholt.net>2013-03-25 14:45:06 -0700
commitf8800ecf25a5e7344abd87d4914ca6a2152875d2 (patch)
tree9f68693a432bda1bdff56a3826f5b26aaa6c9355
parentb00c17efd016831ef7c210ba8a24259933603cd3 (diff)
Report a time for the execution of each shader test.
This can be useful for looking at startup time optimization. If you just sysprof a whole run.py, all you learn is that we spend a lot of time in reading builtins for all those short shaders.
-rwxr-xr-xrun.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/run.py b/run.py
index 49d093e..92e25a3 100755
--- a/run.py
+++ b/run.py
@@ -31,6 +31,8 @@ def run_test(filename):
filename,
'pass']
+ timebefore = time.time()
+
try:
p = subprocess.Popen(
command,
@@ -39,6 +41,8 @@ def run_test(filename):
except:
return filename + " FAIL"
+ timeafter = time.time()
+
try:
(stdout, stderr) = p.communicate()
results = (stdout + stderr).decode("utf-8")
@@ -76,10 +80,12 @@ def run_test(filename):
counts[current_type] = counts[current_type] + 1
del counts["ignore"]
+ timestr = " {:.4} secs".format(timeafter - timebefore)
out = ''
for t in counts:
if counts[t] != 0:
- out += "".join([filename, " ", t, ": ", str(counts[t]), "\n"])
+ out += "{0} {1} : {2:6}{3}\n".format(filename, t, counts[t], timestr)
+ timestr = ""
return out
def main():