项目中任务超时如何精确定位呢!我们一般分软件超时和硬件超时两种:
首先,我们先优先排除是否是硬件超时的问题,这个时候我们把所有的软件任务停一下,然后再手动倒换一下,如果还是超时就可以说这是硬件问题,否则就是软件问题,如果是软件问题我们就按照下面的方法来定位吧!
1,我们在开发过程中很多时候需要轮询调用一个函数,我们在vxworkx里面将这一操作称之为任务,而在项目中我们又将任务分为3种,low_gather,high_gather,real_gather:
而low_gather则是50ms轮询一次(即是10tick,1tick = 5ms),而high_gather和real_gather则是5ms轮询一次(1tick),这就引出了我今天需要写的问题,任务超时。
typedef int (*test_fun)(void) TEST_FUN;
TEST_FUN g_function ;
unsigned int g_tick = 0;
void test_fun()
{
printf(“test fun fun = %s,line = %d\n”);
}
void reg_function()
{
g_function = test_fun;
}
void unreg_function()
{
g_function = NULL;
}
void low_gather()
{
if(g_tick- tick > 10) //50ms
{
printf("lowgather diff = %d\n&#