学习Tony论坛里面的几个小程序,vxWorks起航了
1 学习测试一个程序运行的时间2009年3月19日
源代码
![]()
Code
1
#include "vxWorks.h"
2
#include "timexLib.h"
3
#include "stdio.h"
4![]()
5
#define ITERATIONS 200
6![]()
7
int printit(void)
8![]()
![]()
{
9
int i;
10
for(i=0;i<ITERATIONS;i++)
11![]()
{
12
logMsg("Hello, I am printit(task %d) and i=%d.\n",taskIdSelf(),i,0,0,0,0);
13
}
14
return 0;
15
}
16![]()
17
void s1_time()
18![]()
![]()
{
19
FUNCPTR function_ptr=printit;
20
timex(function_ptr,0,0,0,0,0,0,0,0);
21
}
VMware 下运行的结果如图所示:
可以看到,我的机器上程序执行了700ms左右。