FreeRTOS timer profiling

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • FreeRTOS timer profiling

    First let me say that SystemView is an excellent product well executed.
    In our system (FreeRTOS v9.0.0 with Systemview 2.42) we have a lot of timers that perform different tasks, but we only see the timer daemon task in system view. It would be really useful to see which timer is running (ideally the timer name).

    FreeRTOS provides the following timer trace hooks:
    traceTIMER_CREATE( pxNewTimer )
    traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
    traceTIMER_EXPIRED( pxTimer )
    traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )

    And Systemview has the API commands (among others):

    The first question is where can I find the documentation for the API commands (esp. arguments they take)?
    Secondly, how to send the correct commands so that systemView can tell me which timer is executing (based on the traceTIMER_EXPIRED( pxTimer ) hook probably)?


  • Hi,

    You are right, currently SystemView shows only one context for all software timers and the timer ID is only displayed in the Timer Enter event.
    We will see if we can improve this to display each timer in a separate context, with ID or name like interrupts.

    The SystemView API is described in the SystemView User Manual.
    Which SystemView API function is called by which FreeRTOS trace hooks, can be found in the SystemView FreeRTOS interface files.

    The SystemView functions for timer execution are:
    void SEGGER_SYSVIEW_RecordEnterTimer (U32 TimerId);
    void SEGGER_SYSVIEW_RecordExitTimer (void);

    Best regards
  • Hi Johannes,

    For my purposes, a separate context for each timer is probably too much info (if each context is one line in the GUI): all I want to know is when a timer service is running, and its name (ideally): one context line is OK since timers can't pre-empt each other.

    I've achieved some of this by:
    1. adding 2 new profiler hooks in freertos' timer module: traceTIMER_ENTER( pxTimer ) and traceTIMER_EXIT() that are called just before and after a call to the timer's pxCallbackFunction.
    2. mapping those new hooks to RecordEnterTimer and RecordExitTimer.

    That looks right in systemview, so now I can see how many timers are called by the timer daemon task, and their ID (and also when the daemon isn't running any callback functions).

    The only issue left is identifying which timer is which (the IDs change every time). Is there any way to use the NameResource function to resolve the timer ID to the name, or any other method?