/*

    benchm.c

*/


#include    "renderfx.h"
#include    "dummy.h"
#include    "tilefx.h"
#include    "benchm.h"

#include    <stdio.h>

static bench blist[]={
    (void*)1             ,0,0,"Refresh",
    (void*)doit_back     ,0,0,"Background zoom",
    (void*)doit_twirl    ,0,0,"Twirl",
    (void*)doit_addcomb  ,0,0,"Adding with clamping",
    (void*)doit_rotz     ,0,0,"Zoomrotator",
    (void*)doit_copyxfade,0,0,"Crossfade Scrollers",
    (void*)doit_water    ,0,0,"3D plane"};

int stime2;
void    b_start(void) {

    stime2=l_gettime();

    }

void    b_stop(void *in) {
int i;
int rtime;

    rtime=(l_gettime()-stime2);

    for (i=0; i<(sizeof(blist)/sizeof(bench));i++) {
        if (in==blist[i].function) {
            blist[i].calls++;
            blist[i].time+=rtime;
            }
        }
    }

void    b_result(void) {
int i;
    printf("Timing results (average):\n");

    for (i=0; i<(sizeof(blist)/sizeof(bench));i++) {
        printf("%s %fms\n",blist[i].name,(((float)blist[i].time)/1000)/((float)blist[i].calls));

        }
    }

