I want to test the rate of memcpy on DDR2 of DM6467. I found it is very slow to copy a large data from buffer a to buffer b both of them are allocated in DDR2.Compile the following code and run it on PC (Linux OS), the rate of memcpy is 879M/s. Compile the same code and run it on DM6467, the rate of memcpy is only 76M/s.
Who can tell me the reason?
#define US 1000000
#define BUFSIZE (1024*200)
int main()
{
char *p;
char *a, *b;
double size;
double sec;
int sumTime;
int i;
struct timeval startInitTime;
struct timeval doneInitTime;
a= (char *)malloc(BUFSIZE);
b= (char *)malloc(BUFSIZE);
p = a;
for (i=0;i<BUFSIZE;i++)
{
*(p++) = i;
}
p = a;
gettimeofday(&startInitTime, NULL);
memcpy(b,a,BUFSIZE);
gettimeofday(&doneInitTime, NULL);
sumTime=((doneInitTime.tv_sec - startInitTime.tv_sec) * US + (doneInitTime.tv_usec - startInitTime.tv_usec));
size = (double)BUFSIZE/(1024*1024);
sec = (double)sumTime/1000000;
printf(" rate is %d M/s\n",(int)(size/sec));
free(b);
free(a);
}