This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use RTL to calculate time?

I use RTL for LPC214x, and I want to test the time used for my own code, how can I do that with RTL?
Does RTL provide some function like GetTimeCount() in VC++?

Parents
  • No, it really does not.

    The "Easiest" way to do this would be add a u32 counter to the RTX_Config.c file in the os_chk_robin() function. (before the #if (OS_ROBIN == 1). increment this counter every time the os_chk_robin() function is called (which should be called on every OS Timer Tick, the rate you have set up in the RTX_Config.c File.

    u32 osTickCount;
    
    void os_chk_robin(void)
    {
        osTickCount++;
    #if (OS_ROBIN == 1)
    ...
    #endif
    }
    
    u32 getTickCount()
    {
       u32 value;
       tsk_lock();
       value = osTickCount;
       tsk_unlock();
       return value;
    }
    

Reply
  • No, it really does not.

    The "Easiest" way to do this would be add a u32 counter to the RTX_Config.c file in the os_chk_robin() function. (before the #if (OS_ROBIN == 1). increment this counter every time the os_chk_robin() function is called (which should be called on every OS Timer Tick, the rate you have set up in the RTX_Config.c File.

    u32 osTickCount;
    
    void os_chk_robin(void)
    {
        osTickCount++;
    #if (OS_ROBIN == 1)
    ...
    #endif
    }
    
    u32 getTickCount()
    {
       u32 value;
       tsk_lock();
       value = osTickCount;
       tsk_unlock();
       return value;
    }
    

Children
No data