From 7b18489c6f25d9d4a4521625e177fed2b78eb8c8 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 24 Jul 2009 06:49:01 +0000 Subject: [PATCH] Use a dummy display to compute benchmark time to avoid relying on . --- tests/bench.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/bench.c b/tests/bench.c index 9340589..ca78e33 100644 --- a/tests/bench.c +++ b/tests/bench.c @@ -1,19 +1,18 @@ #include "config.h" #include -#include -#include #include "caca.h" - -#define TIME(desc,code) \ -{\ - time_t start, end;\ - start = time(NULL);\ - code ;\ - end = time(NULL);\ - printf("%-25s:%4ld\n", desc, end-start);\ +#define TIME(desc, code) \ +{ \ + caca_display_t *dummy = caca_create_display_with_driver(NULL, "null"); \ + printf("%-25s: ", desc);\ + caca_refresh_display(dummy); \ + code; \ + caca_refresh_display(dummy); \ + printf("%dms\n", caca_get_display_time(dummy) / 1000); \ + caca_free_display(dummy); \ } static void blit(int mask, int clear)