grub2: bring back build of aros-side grub2 tools
[AROS.git] / test / benchmarks / boopsi / newobject.c
blobddbff368fd8f657bef6f34cc3230b294fd7f7548
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 = 1000000;
14 double elapsed = 0.0;
15 Object *object = NULL;
16 int i;
18 if (!Test_Initialize()) goto error;
20 gettimeofday(&tv_start, NULL);
22 for(i = 0; i < count; i++)
24 object = TestObject, End;
25 DisposeObject(object);
28 gettimeofday(&tv_end, NULL);
30 elapsed = ((double)(((tv_end.tv_sec * 1000000) + tv_end.tv_usec)
31 - ((tv_start.tv_sec * 1000000) + tv_start.tv_usec)))/1000000.;
33 printf
35 "Elapsed time: %f seconds\n"
36 "Number of objects: %d\n"
37 "Objects per second: %f\n"
38 "Seconds per object: %f\n",
39 elapsed, count, (double) count / elapsed, (double) elapsed / count
40 );
42 Test_Deinitialize();
44 return 0;
46 error:
47 printf("Could not initialize Test class!\n");
49 return 20;