/* calltest.c
 *
 * Copyright (c) 2001
 * Hansjörg Malthaner
 *
 * Permission to use, copy, modify and distribute this software
 * for any purpose is hereby granted without fee, provided that 
 * the above copyright notice appears in all copies and that both
 * that copyright notice and this permission notice appear in 
 * supporting documentation.  
 *
 * I make no representations about the suitability of this software
 * for any purpose.  
 * It is provided "as is" without express or implied warranty.
 */

#include <time.h>

#define LOOPS 10000000

void dummy() {
  return;
}

int main() {

  void (*p_dummy)() = dummy;

  clock_t t0, t1, te;
  int i;

  t0 = clock();

  i=0;
  do {
    i++;
  } while(i<LOOPS);


  t1 = clock();

  te = t1-t0;

  printf("Empty test loop took %f seconds\n", ((double)te)/CLOCKS_PER_SEC);



  t0 = clock();

  i=0;
  do {
	dummy();	

    i++;
  } while(i<LOOPS);


  t1 = clock();

  printf("Calls took %f seconds\n", ((double)(t1-t0)-te)/CLOCKS_PER_SEC);


  t0 = clock();

  i=0;
  do {
	p_dummy();	

    i++;
  } while(i<LOOPS);


  t1 = clock();

  printf("Calls took %f seconds\n", ((double)(t1-t0)-te)/CLOCKS_PER_SEC);

}
