Ensure all lines that should be omitted from public includes are marked
[AROS.git] / test / benchmarks / exec / allocvec.c
blob9c4f617a586c7ccbdebdd41506dfdd8082eb1926
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <sys/time.h>
7 #include <stdio.h>
8 #include <string.h>
10 #include <exec/types.h>
11 #include <exec/memory.h>
12 #include <proto/exec.h>
14 int main()
16 struct timeval tv_start,
17 tv_end;
18 int count = 10000000;
19 double elapsed = 0.0;
20 int i;
21 APTR memory;
23 gettimeofday(&tv_start, NULL);
25 for(i = 0; i < count; i++)
27 memory = AllocVec(100, MEMF_ANY);
28 if (memory) FreeVec(memory);
31 gettimeofday(&tv_end, NULL);
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 allocations: %d\n"
40 "Allocations per second: %f\n"
41 "Seconds per allocation: %f\n",
42 elapsed, count, (double) count / elapsed, (double) elapsed / count
45 return 0;