2 Copyright © 2003, The AROS Development Team. All rights reserved.
10 #include <exec/types.h>
11 #include <exec/memory.h>
12 #include <proto/exec.h>
16 struct timeval tv_start
,
18 int count
= 100000000;
24 pool
= CreatePool(MEMF_ANY
, 4 * 100, 100);
25 AllocPooled(pool
, 100); // Avoid bad behaviour of FreePooled()
27 gettimeofday(&tv_start
, NULL
);
29 for(i
= 0; i
< count
; i
++)
31 memory
= AllocPooled(pool
, 100);
32 if (memory
) FreePooled(pool
, memory
, 100);
35 gettimeofday(&tv_end
, NULL
);
39 elapsed
= ((double)(((tv_end
.tv_sec
* 1000000) + tv_end
.tv_usec
)
40 - ((tv_start
.tv_sec
* 1000000) + tv_start
.tv_usec
)))/1000000.;
44 "Elapsed time: %f seconds\n"
45 "Number of allocations: %d\n"
46 "Allocations per second: %f\n"
47 "Seconds per allocation: %f\n",
48 elapsed
, count
, (double) count
/ elapsed
, (double) elapsed
/ count