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

load_mon: increase cpuload update rate, get corresponding time safetly, and misc cleanup #15342

Merged
merged 4 commits into from
Jul 16, 2020

Conversation

dagar
Copy link
Member

@dagar dagar commented Jul 15, 2020

  • increase rate from 1 Hz to 3.3 Hz (every 300 ms)
  • cpu load calculation grab timestamp with runtime in a critical section
  • task stack only check one task per cycle (but cycle at a higher rate)
  • decrease available FD threshold 3 -> 2
  • minor cleanup (split out header)

 - increase rate
 - cpu load calculation grab timestamp atomically
 - only check one task per cycle (but cycle at a higher rate)
 - decrease available FD threshold
 - minor cleanup
@dagar
Copy link
Member Author

dagar commented Jul 15, 2020

I increased the rate slightly because I wanted to have a bit more detail in the logs.

@dagar dagar requested a review from julianoes July 15, 2020 21:04
@dagar dagar changed the title load_mon: increase cpuload rate, get corresponding time safetly, and misc cleanup load_mon: increase cpuload update rate, get corresponding time safetly, and misc cleanup Jul 15, 2020

// Found task low on file descriptors, report and exit. Continue here in next cycle.
if (fds_free < FDS_LOW_WARNING_THRESHOLD) {
PX4_WARN("%s low on FDs! (%i FDs left)", task_stack_info.task_name, fds_free);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These warnings will now appear 3 times per second and spam the log quite a bit, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These warnings will now appear 3 times per second and spam the log quite a bit, right?

Only in the worst case if running the max number of tasks (32 or 64) and every one of them was either low on stack or FDs.

Overall it's kind of a lateral move. Currently in master it cycles at 1 Hz, but each iteration checks 2 tasks, and if a task entry (an array of CONFIG_MAX_TASKS) is empty it jumps forward. Now it runs slightly faster for the sake of cpuload measurement, but it's doing less work per iteration checking tasks.

src/modules/load_mon/LoadMon.cpp Outdated Show resolved Hide resolved
@dagar dagar merged commit 8020d64 into master Jul 16, 2020
@dagar dagar deleted the pr-load_mon_updates branch July 16, 2020 19:11
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants