crete an idle task to run when theres ... umm. .. nothing to do ..
[AROS.git] / test / benchmarks / boopsi / domethod.c
blob7610df5c78e69eb6633d7880aee6d7a78e6094ca
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "common.c"
8 /*** Main *******************************************************************/
9 int main()
11 struct timeval tv_start,
12 tv_end;
13 int count = 100000000;
14 double elapsed = 0.0;
15 Object *object = NULL;
16 int i;
18 if (!Test_Initialize()) goto error;
20 object = TestObject, End;
22 gettimeofday(&tv_start, NULL);
24 for(i = 0; i < count; i++)
26 DoMethod(object, MUIM_Test_Dummy);
29 gettimeofday(&tv_end, NULL);
31 DisposeObject(object);
33 elapsed = ((double)(((tv_end.tv_sec * 1000000) + tv_end.tv_usec)
34 - ((tv_start.tv_sec * 1000000) + tv_start.tv_usec)))/1000000.;
36 printf
38 "Elapsed time: %f seconds\n"
39 "Number of calls: %d\n"
40 "Calls per second: %f\n"
41 "Seconds per call: %f\n",
42 elapsed, count, (double) count / elapsed, (double) elapsed / count
45 Test_Deinitialize();
47 return 0;
49 error:
50 printf("Could not initialize Test class!\n");
52 return 20;