Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real time task statistics in the uxTaskGetSystemState() #1120

Closed
RomkaE opened this issue Aug 15, 2024 · 3 comments
Closed

Real time task statistics in the uxTaskGetSystemState() #1120

RomkaE opened this issue Aug 15, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@RomkaE
Copy link

RomkaE commented Aug 15, 2024

Problem: Statistics collection API provide only AVERAGE statistics since kernel startup and don't calculate real time statistics.

Hi guys,
I would like to start a discussion on this issue and make changes to the Kernel to expand the API for collecting real time task statistics.

Example 1: the task was blocked for 10 minutes, and on event woke up for 1 second and worked for 500ms. The current implementation calculates statistics as 100x0.5/10x60 = 0.083(3)%. In integer representation it is equal to 0. But real time statistics for the last second is equal 50%, or for the last 10 seconds is equal 5%.

Example 2: one task is created only for initialization. For 5 seconds the task used 100% of CPU time, after initialization the task is deleted. In this case the sum of statistics of the remaining tasks (including the IDLE task) is less than 100%.

I found a couple of topics with similar discussions but in a different context:
Issue #307
Forum: How to reset vTaskGetRunTimeStats?

I've been using task statistics collection in every my projects with FreeRTOS to analyze and optimize CPU performance and memory consumption. I use uxTaskGetSystemState() and my own implementation of formatted output via UART.
To calculate real time statistics I use the following changes: commit f7ac81d
But these changes cause other statistic APIs to not work correctly. And I understand that I can't create a pull request with such changes.

And the last point as an argument in favor of real time statistics: couple screenshots from production project with real time statistics
sys-monitor
core0_chart

In the screenshots, the statistics update time is 1 sec. The screenshots show peak loads on the processor. With average statistics calculations, the peak load is not visible.

@RomkaE RomkaE added the enhancement New feature or request label Aug 15, 2024
@cookpate
Copy link
Member

Thanks for the insight!

@amazonKamath
Copy link
Member

@RomkaE Thanks for the opening the issue here, but in order to get community feedback and involvement, we would request you to create this as a forum post and close the github enhancement issue here. Thank you.

@RomkaE
Copy link
Author

RomkaE commented Aug 16, 2024

@amazonKamath ok. Thanks.

@RomkaE RomkaE closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants