timing.c

来自「tornado2.2开发」· C语言 代码 · 共 40 行

C
40
字号
#include "vxWorks.h"
#include "timexLib.h"
#include "taskLib.h"
#include "stdio.h"

#define ITERATIONS 10

static int printit(void)
{
    int i;
    for (i=0;i<ITERATIONS;i++)
    {
        logMsg("hello,I am printit(task %d) and i=%d.\n",
            taskIdSelf(),i,0,0,0,0);
    }
    return 0;
}

void s1_time()
{
    FUNCPTR function_ptr=printit;
    timexN(function_ptr,0,0,0,0,0,0,0,0);
}

static void task_print(void)
{
    printf("hello,I am task %d.\n",taskIdSelf());
}

void s2_tasks(void)
{
    int i,taskId;
    for (i=0;i<ITERATIONS;i++)
    {
        taskId = taskSpawn("task_print",90-i,0x100,2000,
             task_print,0,0,0,0,0,0,0,0,0,0);
    }
    printf("\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?