From bfe96dd587b1133220e24f123f500379db1bef8b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 23 Feb 2023 17:04:01 -0500 Subject: demo: Exclude delay time from benchmark --- diff --git a/src/demo.c b/src/demo.c index 24ebfc5..6ee46b0 100644 --- a/src/demo.c +++ b/src/demo.c @@ -27,6 +27,7 @@ #define DEMO() \ do { \ + start = SDL_GetTicks(); \ vp->x = x + map->tilewidth / 2 - vp->w / 2; \ vp->y = y + map->tileheight / 2 - vp->h / 2; \ /* \ @@ -75,8 +76,10 @@ } \ render_area_to_viewport(a, vp); \ SDL_Flip(vp->screen); \ - SDL_Delay(10); \ ++i; \ + end = SDL_GetTicks(); \ + total += end - start; \ + SDL_Delay(10); \ } while (0) void @@ -116,7 +119,7 @@ demo(void) /* Demo */ { - Uint32 start, end; + Uint32 total, start, end; int i, i_max, t_max; int x, y; SDL_Palette *pal_start, *pal_end; @@ -127,7 +130,7 @@ demo(void) i = 0; i_max = 1440; - start = SDL_GetTicks(); + total = 0; x = 9 * map->tilewidth ; y = 58 * map->tileheight; for (; y > 50 * map->tileheight; y -= 1) DEMO(); /* Up */ @@ -145,7 +148,6 @@ demo(void) for (; y > 5 * map->tileheight; y -= 1) DEMO(); /* Up */ for (; x < 17 * map->tilewidth ; x += 1) DEMO(); /* Right */ for (; y > 1 * map->tileheight; y -= 1) DEMO(); /* Up */ - end = SDL_GetTicks(); - debug("Rendered %d frames in %d milliseconds", i, end - start); + debug("Rendered %d frames in %d milliseconds", i, total); } } -- cgit v0.9.1