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>
14 #define BUFFERSIZE (10*1024*1024) // 10 MB
15 #define FUNCTION memset
19 struct timeval tv_start
,
22 UBYTE patterns
[] = { 0x15, 0x25, 0x65, 0x42 };
27 buffer
= AllocVec(BUFFERSIZE
, MEMF_ANY
);
29 gettimeofday(&tv_start
, NULL
);
31 for(i
= 0; i
< count
; i
++)
33 FUNCTION(buffer
, 0, BUFFERSIZE
);
36 gettimeofday(&tv_end
, NULL
);
38 elapsed
= ((double)(((tv_end
.tv_sec
* 1000000) + tv_end
.tv_usec
)
39 - ((tv_start
.tv_sec
* 1000000) + tv_start
.tv_usec
)))/1000000.;
45 "Elapsed time: %f seconds\n"
46 "Number of bytes: %f\n"
47 "Bytes per second: %f\n",
48 elapsed
, (double) count
* BUFFERSIZE
,
49 (double) count
* BUFFERSIZE
/ elapsed
52 gettimeofday(&tv_start
, NULL
);
54 for(i
= 0; i
< count
; i
++)
56 FUNCTION(buffer
, patterns
[i
% sizeof(patterns
)], BUFFERSIZE
);
59 gettimeofday(&tv_end
, NULL
);
61 elapsed
= ((double)(((tv_end
.tv_sec
* 1000000) + tv_end
.tv_usec
)
62 - ((tv_start
.tv_sec
* 1000000) + tv_start
.tv_usec
)))/1000000.;
66 "Filling memory with pattern\n"
67 "---------------------------\n"
68 "Elapsed time: %f seconds\n"
69 "Number of bytes: %f\n"
70 "Bytes per second: %f\n",
71 elapsed
, (double) count
* BUFFERSIZE
,
72 (double) count
* BUFFERSIZE
/ elapsed