CPU Load

Firmware/software/electronics/mechanics
Post Reply
Max_Kemmeren
Member
Posts: 40
Joined: Wed Jan 20, 2021 4:03 pm

CPU Load

Post by Max_Kemmeren »

Dear all,

I have a question about the CPU. Within my addition to the code I do some matrix calculations and even a 7x7 inversion. As the code does not seem to function properly I need to check if the CPU can handle all the mathematics. Is there a way to check if the CPU is not overloaded?

I have the debug adapter.

Greetings
Max
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: CPU Load

Post by kristoffer »

The easiest way to get a feel for the CPU load is to use the python client. Open the console tab and click the "Task dump" button. You should get something like:

Code: Select all

SYSLOAD: Task dump
SYSLOAD: Load	Stack left	Name
SYSLOAD: 3.37 	183 	Tmr Svc
SYSLOAD: 69.85 	127 	IDLE
SYSLOAD: 1.61 	213 	CRTP-RX
SYSLOAD: 6.80 	155 	SENSORS
SYSLOAD: 0.0 	75 	PWRMGNT
SYSLOAD: 0.0 	115 	PLATFORM-
SYSLOAD: 0.0 	255 	LOG
SYSLOAD: 0.0 	223 	MEM
SYSLOAD: 0.0 	91 	PARAM
SYSLOAD: 0.01 	67 	LH
SYSLOAD: 0.09 	99 	SYSTEM
SYSLOAD: 0.09 	61 	CRTP-TX
SYSLOAD: 7.34 	365 	STABILIZE
SYSLOAD: 4.88 	327 	KALMAN
SYSLOAD: 2.43 	93 	LEDSEQCMD
SYSLOAD: 1.05 	107 	CRTP-SRV
SYSLOAD: 2.42 	176 	SYSLINK
SYSLOAD: 0.0 	114 	USBLINK
SYSLOAD: 0.0 	255 	CMDHL
This is a list of tasks and how much of the CPU time they use, the first column is the the percentage of total CPU time. In this case we can see that the stabalizer loop uses around 7% for instance, and that 70% is unused (IDLE).

Note: the task data is reset after each dump, and the first dump will contain an average from boot time. In most cases you want to dump at least twice, first to reset the data and a second time to get current values.
Max_Kemmeren
Member
Posts: 40
Joined: Wed Jan 20, 2021 4:03 pm

Re: CPU Load

Post by Max_Kemmeren »

Thanks found it, also thanks for explaining the IDLE as my guess already was unused space but a conformation is always nice!
Post Reply