[Piglit] [PATCH 04/10] shader_runner: add 'time reset' and 'time show' commands

Jordan Justen jordan.l.justen at intel.com
Wed Oct 16 01:33:08 CEST 2013


Insert time reset to set the timer to 0.

The 'time show' command will then print out:
microseconds: #

When # is the elapsed time in microseconds since the reset.

Piping the output through an awk command of
awk '/microseconds: / {print $2}'
will filter the time and provide a convenient input for ministat.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 tests/shaders/shader_runner.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 2667aed..b833e5c 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1667,6 +1667,7 @@ piglit_display(void)
 	bool pass = true;
 	GLbitfield clear_bits = 0;
 	bool link_error_expected = false;
+	uint64_t microseconds = 0;
 
 	if (test_start == NULL)
 		return PIGLIT_PASS;
@@ -1910,6 +1911,11 @@ piglit_display(void)
 			}
 		} else if (string_match("link success", line)) {
 			program_must_be_in_use();
+		} else if (string_match("time reset", line)) {
+			microseconds = piglit_get_microseconds();
+		} else if (string_match("time show", line)) {
+			uint64_t delta = piglit_get_microseconds() - microseconds;
+			printf("microseconds: %lu\n", delta);
 		} else if ((line[0] != '\n') && (line[0] != '\0')
 			   && (line[0] != '#')) {
 			printf("unknown command \"%s\"\n", line);
-- 
1.7.10.4



More information about the Piglit mailing list