This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EVM6678读取txt文件时间问题



大家好,

我用EVM6678L读txt文件,文件里面是4800个浮点数,大小为50K字节,读取文件用的时钟周期为19543907。我用时钟周期数除以时钟频率1G Hz,得到的时间应该是19个毫秒多一点,可是实际的运行时间远大于这个时间,我记了一下时间实际大概运行了40秒。请问这是什么原因?我的测试代码如下:

#include<stdio.h>
#include<stdlib.h>
#include "float.h"
#include <c6x.h>

void main()
{
 float a[4800];
 int i;
 FILE *fid;
 unsigned long long t1,t2;
    TSCL=0;
    TSCH=0;
    t1=_itoll(TSCH,TSCL);
 if((fid=fopen("p.txt","r"))==NULL)
 {
     printf("Cannot open pfile!\n");
     exit(0);
 }
 for(i=0;i<4800;i++)
 {
     fscanf(fid,"%f",&a[i]);
 }
 fclose(fid);
 t2=_itoll(TSCH,TSCL);
 printf("Done\n");
 printf("run_cycle=%lld\n",t2-t1);
}