test/testtimer.c
changeset 5514 6bd701987ba9
parent 1895 c121d94672cb
child 5535 96594ac5fd1a
     1.1 --- a/test/testtimer.c	Fri Mar 25 13:48:48 2011 -0700
     1.2 +++ b/test/testtimer.c	Fri Mar 25 14:45:04 2011 -0700
     1.3 @@ -29,8 +29,9 @@
     1.4  int
     1.5  main(int argc, char *argv[])
     1.6  {
     1.7 -    int desired;
     1.8 +    int i, desired;
     1.9      SDL_TimerID t1, t2, t3;
    1.10 +    Uint64 start, now;
    1.11  
    1.12      if (SDL_Init(SDL_INIT_TIMER) < 0) {
    1.13          fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.14 @@ -85,6 +86,15 @@
    1.15      SDL_RemoveTimer(t2);
    1.16      SDL_RemoveTimer(t3);
    1.17  
    1.18 +    start = SDL_GetPerformanceCounter();
    1.19 +    for (i = 0; i < 1000000; ++i) {
    1.20 +        ticktock(0);
    1.21 +    }
    1.22 +    now = SDL_GetPerformanceCounter();
    1.23 +    printf("1 million iterations of ticktock took %f ms\n", (double)((now - start)*1000) / SDL_GetPerformanceFrequency());
    1.24 +
    1.25      SDL_Quit();
    1.26      return (0);
    1.27  }
    1.28 +
    1.29 +/* vi: set ts=4 sw=4 expandtab: */