Repository navigation
Conversation
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoShow averaged task rates and loads in the CLI
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
The first run after a task is enabled measures the time since it last ran, so a task enabled minutes after boot showed 0 Hz in tasks for many runs. That run now starts the average at the task's desired period instead.
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #12117 251 targets built. Find your board's
|
What this fixes
tasksprints a task's rate as 1 / its latest interval, and its load as the average execution time times that rate. A task that reschedules itself runs at uneven intervals, so a single interval says little: with #12063 the BARO task on a BMP280 runs a few times per measurement cycle (a forced-mode write, then short polls while the read is in flight), and twelve samples oftaskson a Holybro Kakute H7 Mini read 43 Hz and 0.6 % five times and 1934 to 2000 Hz and 5.5 % seven times, for the same steady behaviour. The total load at the bottom of the table jumps with it.What I changed
The scheduler keeps a moving sum of each task's interval over 32 runs, next to the moving sum of its execution time it already keeps, and
taskscomputes the rate from that average.getTaskDeltaTime()and everything the scheduler decides on still use the latest interval. The sum is 32 bits and sits in the gap aftertaskLatestDeltaTime, socfTask_tdoes not grow;cfTaskInfo_t.latestDeltaTime, read only bytasks, becomesaverageDeltaTime.Testing
Holybro Kakute H7 Mini, BMP280, #12063 merged in, twelve samples of
tasks100 s after boot: BARO reads 64 to 65 Hz and 0.6 % in all twelve (before: 43 or about 2000 Hz, as above). Other tasks read as before (PID about 1995 Hz, GYRO 3184 Hz, GPS 49 Hz, SYSTEM 9 Hz).A task's first run after it is enabled, at boot or later, measures the time since it last ran, which can be minutes. That run starts the average at the task's desired period instead, and the average reaches the measured interval within about 100 runs (10 s for a 10 Hz task). On the same Kakute without #12063, with the barometer set to a sensor it does not have and turned on through HITL 181 s after boot (
readMspSimulatorValues()enablesTASK_BARO), the BARO row read 0, 1, 5, 16 and 19 Hz at 1, 3, 6, 10 and 20 s before this, and 20 Hz at 1 s and 19 Hz from 3 s on with it. Seven seconds after boot, SYSTEM, RX, BATTERY and GPS read 7, 44, 34 and 34 Hz before, and 10, 49, 49 and 49 Hz with it.Cost against maintenance-10.x: RAM unchanged on MATEKF405, MATEKF722SE, KAKUTEF7, KAKUTEF7HDV, KAKUTEH7MINI and the H743; flash +40 to +290 B; the update runs in
scheduler(), which grows by 28 B. ITCM grows by 24 B on MATEKF722SE and KAKUTEH7MINI, and by 64 B on KAKUTEF7 and KAKUTEF7HDV (16232 to 16296 of 16384 B), 36 of them ingyroFilter(), which LTO lays out differently. With #12063 also merged, KAKUTEF7HDV goes 32 B past its ITCM unless #12118, which takesafatfs_poll()out ofscheduler(), is merged first; with all three it links at 15 448 B.