Can anyone tell me exactly what the Task List display is looking for in FreeRTOS? The runtime percentages won't come up - just a warning to enable configGENERATE_RUN_TIME_STATS, which is.
I verified that ulRunTimeCounter is present and incrementing in the each TCB, and ulTaskSwitchedInTime is incrementing.
My systick is 1ms, and my portGET_RUN_TIME_COUNTER_VALUE() is ten times that (100us).
All the other task stats are legit, but I think the Runtime calculation is looking for something it can't find, or something is out of line.
And, it did work before when I had a variable I incremented in an ISR, but since then I moved to using StopWatch() as an interface, it stopped.
portGET_RUN_TIME_COUNTER_VALUE() actually calls StopWatch_Start(). This seems like less overhead (no ISR required)
Solved! Go to Solution.
In Addition to that:
check your linker map file if the ulTotalRunTime has not been removed.
The FreeRTOS port I'm using works high high optimization settings too, e.g. has the following added:
If you are using 'plain vanilla' FreeRTOS such cases might not be covered.
Erich
I just realized who I'm conversing with. :smileywink:
I'll explain my reasoning for what I did. It seemed more efficient to use the 32 bit timer, with a prescaler to get it at 10kHz. That way I don't need an ISR incrementing a variable that gets read, I can just read the timer counter directly and let it continuously up tick.
And with the LPC code, there's already this functionality in stopwatch.h/.c - you just need to adjust the prescale value in that code.
Hi Chris,
:-)
I agree: using that timer in such a way is a smart thing. I'm less concerned about the interrupt overhead as in general collecting runtime statistics adds some overhead too, and if I disable it I can get rid of the timer overhead too. The only thing to be aware of is that after around 5 days the 32bit 10 kHz counter will overflow: this is not handled in FreeRTOS.
Erich
I wondered if that might be it - ulTotalRunTime is optimized out. ulTaskSwitchedInTime is there...
Placing: __attribute__((used)) above the declaration solved it!
Hi Chris,
see Tutorial: Using Runtime Statistics with Amazon FreeRTOS V10 | MCU on Eclipse or FreeRTOS Task Runtime Statistics for NXP i.MX RT1064 | MCU on Eclipse .
Basically you need to setup a timer for the most detailed information. The above describes as well a way to use the tick counter instead.
I hope this helps,
Erich
I read those about twenty times. It describes the basic setup and portGET_RUN_TIME_COUNTER_VALUE() . I have that working. I can verify that the counters in the TCBs work (ulRunTineCounter).
What I don't know is exactly what variables and what calculations MCUXpresso uses to generate the stats it displays. It has to be looking at specific variables and running some calculations on that. There doesn't seem to be any published information on that.
The view reads that ulRunTimeCounter value in the TCB and displays the percentage of this in the view (making a sum of all task values and then calculates the percentage based on that. Could you post a screenshot of what you see?
I think you might have missed a setting or so.
Or can you use one of the examples I have posted on GitHub referenced in these articles?
Erich
In Addition to that:
check your linker map file if the ulTotalRunTime has not been removed.
The FreeRTOS port I'm using works high high optimization settings too, e.g. has the following added:
If you are using 'plain vanilla' FreeRTOS such cases might not be covered.
Erich
Hello @ErichStyger,
I'm experiencing a similar problem using the latest MCUXpresso IDE version (v11.10.0).
I'm using an RT1160 custom board and I'm able to correctly measure task ulRunTimeCounter and ulTotalRunTime variables:
However, in the IDE runtime stats viewer, I'm unable to visualize runtime percentages.
Am I missing something here? Do you know why the percentages are not being displayed?
Would you please send us support information? After you reproduce the described behavior, terminate debug session, then go to Help => MCUXpresso IDE Save Info for Support, export the zip zile and attach it here.
Related to FreeRTOS Task Aware Debug views, we've done some changes to accommodate FreeRTOS v11 with its SMP support (most of the task-related data structure are quite different compared to v10). Not sure what FreeRTOS version are you using though. Anyway, I'll double-check your use case on my side and get back with the analysis result.
Thank you,
Adrian
Hi Adrian,
The IDE support information you requested is attached to this message.
When I created this project, I was using SDK MIMXRT1160-EVK v2.13.0, and I believe the FreeRTOS version at that time was 10.5 (I'm not entirely sure about this). Currently, I've updated the SDK version to v2.16.0, which uses FreeRTOS v11.0, but I haven't updated my SDK components, so I'm pretty sure I'm still using FreeRTOS v10.5 or something similar.
Thank you for your support. I hope this helps.
Best regards,
Enrico
I also confirm the issue. Unfortunately, "ulTotalRunTime" is incorrectly read in non-SMP context. But this affects only the actual percentage shown in the Runtime view. We'll make sure this'll get fixed in the next release.
12:59:27.833 ERROR: [VariableReader] -data-evaluate-expression ulTotalRunTime[0]
12:59:27.833 ERROR: [VariableReader] Error message from debugger back end:
12:59:27.833 ERROR: [VariableReader] cannot subscript something of type `unsigned int' java.lang.Exception: cannot subscript something of type `unsigned int'
12:59:27.833 ERROR: [TaskFactory] ulTotalRunTime not available
Thank you,
Adrian
Sure.