Part Number:TDA2EX17EVM
Tool/software: Linux
In our project, the performance consumption is mainly on writing data, and it is found that the writing speed of l2 is very slow. Moreover, we did a simple test, writing data to a fixed address of l2 and continuously writing the same amount of data on a certain size of l2 block, the performance is quite different.Is that normal? Any good guidance?(our test code is shown below.)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <c6x.h>
#define N_BYTEALIGN8 8
extern int Vps_printf(const char *format, ...);
typedef struct
{
unsigned char *pMem;
int nMemLen;
}TI_MEM;
void *TI_GetMem8(TI_MEM *pMemory, int nLen)
{
int nByteAlign = N_BYTEALIGN8;
void* pRet;
pMemory->nMemLen -= ((nByteAlign - ((unsigned int)(pMemory->pMem) & (nByteAlign - 1))) &(nByteAlign - 1));
pMemory->pMem += ((nByteAlign - ((unsigned int)(pMemory->pMem) & (nByteAlign - 1))) &(nByteAlign - 1));
pRet = pMemory->pMem;
pMemory->pMem += nLen;
pMemory->nMemLen -= nLen;
return pRet;
}
int ArcNEATEng_Test(unsigned char* pMemL2) {
int ret = 0;
int i, j, k;
TI_MEM L2TMP;
L2TMP.pMem = pMemL2;
L2TMP.nMemLen = 200 * 1024;
if (L2TMP.nMemLen < 0)
{
Vps_printf("ArcNEATEng_Forward memory, required is provided\n");
return;
}
unsigned char *pInputBufL2 = (unsigned char*)TI_GetMem8(&L2TMP, sizeof(unsigned char)* 100 * 1024);
{
unsigned long long WH_time[10];
double WH_cost[10];
TSCH = 0;
TSCL = 0;
WH_time[0] = _itoll(TSCH, TSCL);
for(i = 0; i < 1024; ++i)
{
unsigned char *pInputL2 = pInputBufL2;
for(j = 0;j < 100*1024; j += 8)
{
int out1 = j;int out2 = j;int out3 = j;int out4 = j;
int out5 = j;int out6 = j;int out7 = j;int out8 = j;
*pInputL2 = (unsigned char)(out1);
*pInputL2 = (unsigned char)(out2);
*pInputL2 = (unsigned char)(out3);
*pInputL2 = (unsigned char)(out4);
*pInputL2 = (unsigned char)(out5);
*pInputL2 = (unsigned char)(out6);
*pInputL2 = (unsigned char)(out7);
*pInputL2 = (unsigned char)(out8);
}
}
WH_time[1] = _itoll(TSCH, TSCL);
WH_cost[0] = (double)(WH_time[1] - WH_time[0]) / 750000;
Vps_printf("Write L2 1-add %f ms\n", WH_cost[0]);
}
{
unsigned long long WH_time[10];
double WH_cost[10];
TSCH = 0;
TSCL = 0;
WH_time[0] = _itoll(TSCH, TSCL);
for(i = 0; i < 1024; ++i)
{
unsigned char *pInputL2 = pInputBufL2;
for(j = 0;j < 100*1024; j += 8)
{
int out1 = j;int out2 = j;int out3 = j;int out4 = j;
int out5 = j;int out6 = j;int out7 = j;int out8 = j;
*(pInputL2++) = (unsigned char)(out1);
*(pInputL2++) = (unsigned char)(out2);
*(pInputL2++) = (unsigned char)(out3);
*(pInputL2++) = (unsigned char)(out4);
*(pInputL2++) = (unsigned char)(out5);
*(pInputL2++) = (unsigned char)(out6);
*(pInputL2++) = (unsigned char)(out7);
*(pInputL2++) = (unsigned char)(out8);
}
}
WH_time[1] = _itoll(TSCH, TSCL);
WH_cost[0] = (double)(WH_time[1] - WH_time[0]) / 750000;
Vps_printf("Write L2 adds %f ms\n", WH_cost[0]);
}
return ret;
}