Hi,
I am working in Battery management project and there is a request to find out the CPU utilization by individual tasks and also CPU load analysis. In the present scenario RTI interrupt is configured at 1ms for OS scheduling. As task run time will be less than 10 or 100 micro seconds, so i thought to use the API (Autonomous periodic interrupt) at 1 micro second to find the task timing on CPU which is NOT a right method. So please let me know, if we can monitor any controller registers or please suggest any methods to find the CPU load and individual tasks run time
Hello Radek,
Thanks for info. But my use case is different, where i have to find CPU utilization by the individual tasks. Say i have 4 tasks which are called at 10ms, 100ms, 200ms, 500ms frequency. So i have to calculate CPU utilization by each task also i have to find CPU utilization by the ISR also. Please let me know your thoughts (or ideas ) and also details of timers (or counters ) in the MM9Z1_638 controller to be used to accomplish the same
Thanks in advance
Hi Krishna,
Thank you for clarification.
Ok, you don’t need to know how much you CPU power remains, but you want to inspect the whole task management. You probably need some Task Awareness. Something like https://mcuoneclipse.com/2016/07/06/freertos-kernel-awareness-for-eclipse-from-nxp/
or
https://mcuoneclipse.com/2016/06/13/adding-freertos-thread-awareness-to-gdb-and-eclipse/
or
,but at CW and S12Z.
Did you already tray any of similar tools? I suppose that there must be some relative wide area of available tools, but I am not sure with S12Z toolchain compatibility.
I suppose that some solution which will periodically read RTOS kernel data and stack trough BDM interface and analyze it on PC side is the most logical and least intrusive method for that debugging.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Krishna,
I am afraid that the “the API (Autonomous periodic interrupt) at 1 micro second” is not the right idea.
For the CPU load analysis, we typically use the idle task with the lowest priority between tasks.
This task does nothing (just simple endless loop) or simply counts a counter.
You could periodically read this counter and see how much it counts per unit time. If the difference from the last check will be 0, the CPU load is 100%. The value for 0% CPU load depends on idle task code, counter size and length of the periodic check. You could simply measure it when you block all your task except idle task and task who check the counter value.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------