Wednesday, October 18th 2017, 6:38pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

redcoat

Beginner

Date of registration: Sep 1st 2016

Posts: 19

1

Thursday, March 2nd 2017, 12:13pm

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_CREATE_FAILED()
traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
traceTIMER_EXPIRED( pxTimer )
traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )

And Systemview has the API commands (among others):
apiID_XTIMERCREATE
apiID_PVTIMERGETTIMERID
apiID_VTIMERSETTIMERID
apiID_XTIMERISTIMERACTIVE
apiID_XTIMERCREATETIMERTASK
apiID_XTIMERGENERICCOMMAND

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)?

Thanks,

Henry

SEGGER - Johannes

Super Moderator

Date of registration: Aug 31st 2012

Posts: 360

2

Thursday, March 2nd 2017, 6:19pm

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
Johannes

redcoat

Beginner

Date of registration: Sep 1st 2016

Posts: 19

3

Monday, March 6th 2017, 3:08pm

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?

Thanks,

Henry