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.

dsp 程序运行时间测量的误差



本人最近在做6678上做一个算法的移植测试,测了估计算法的性能,所以需要测量每一段程序的运行时间,目前采用了两种方法来测量运行时间,

目前存在的问题是 用手机秒表计时 和 dsp程序计时 时间会相差比较大。不如程序跑出来的时间是10s  秒表计时可能接近50s;

目前自己的理解是,

用秒表计算 总时间=程序运行时间+仿真器与pc通信时间;

用程序跑    总时间=程序运行时间 (用程序跑自动去掉了仿真器与pc通信所消耗的时间);

不知道这样理解是否正确?请TI的工程师帮忙解答;

现将两种测运行时间的算法贴出

方法一 在sys/bios 系统下
1、在cfg文件中配置
//校准时间
var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
2、源码中
头文件
#include <xdc/runtime/Types.h>
#include <xdc/runtime/Timestamp.h>

Types_FreqHz freq;
Uint32 start;
Timestamp_getFreq(&freq);
start = Timestamp_get32();
//运行算法

//
printf("sufan time %f ms\n", ((double)(Timestamp_get32()-start)/(double)freq.lo)*1000);

方法二 采用TSCL TSCH 文件

1、复制 “vllfft”的tsc_h.asm 到工程目录
2、源码中
void TSC_enable();
unsigned long long TSC_read();

double SUFAN_Time;
unsigned long long timerstart;
unsigned long long timerstop;

TSC_enable();
timerstart=0.0;
timerstart=TSC_read();
//运行算法

//

SUFAN_Time = 0.0;
timerstop=TSC_read();
SUFAN_Time= (double)(time->timerstop - time->timerstart)/1000000.0;
printf(" %f ms\n", SUFAN_Time);