changeset 3076:bfc881c0e591

newly allocated memory seems to point to only 1 zero filled 4k page or something so there is a near 100% cache hit rate ... not very realistic, writeing something in the source array fixes that so the benchmark scores are meaningfull now
author michael
date Thu, 22 Nov 2001 19:22:49 +0000
parents 11b02bd1de45
children 99f6db3255aa
files TOOLS/fastmemcpybench.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/TOOLS/fastmemcpybench.c	Thu Nov 22 18:52:25 2001 +0000
+++ b/TOOLS/fastmemcpybench.c	Thu Nov 22 19:22:49 2001 +0000
@@ -95,7 +95,7 @@
   return retval;
 }
 
-unsigned char arr1[ARR_SIZE],arr2[ARR_SIZE];
+unsigned char  __attribute__((aligned(4096)))arr1[ARR_SIZE],arr2[ARR_SIZE];
 
 int main( void )
 {
@@ -107,9 +107,12 @@
   mga_init();
   marr1 = &frame[3];
 #else
-  marr1 = &arr1[3];
+  marr1 = &arr1[0];
 #endif
-  marr2 = &arr2[9];
+  marr2 = &arr2[0];
+
+  for(i=0; i<ARR_SIZE; i++) marr1[i] = marr2[i] = i;
+
   t=GetTimer();
   v1 = read_tsc();
   for(i=0;i<100;i++) memcpy(marr1,marr2,ARR_SIZE-16);