-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
extensive cpu on every parameter change #12992
Comments
Where do you see |
after printing the parameters that being searched after another parameter is beeing called I can see 177 searches for parameters. (some are double search from different modules) |
Great, so the next step is to track down the offending modules and either store the |
I can do that, at least some... Just wanted to be sure it can be consider as something to fix before I implement a fix |
Yes, virtually all param_set: 6 events, 27us elapsed, 4.50us avg, min 2us max 13us 84.218us rms
param_get: 1142 events, 6547us elapsed, 5.73us avg, min 2us max 572us 68.706us rms
param_find: 116 events, 651us elapsed, 5.61us avg, min 2us max 143us 48.639us rms
param_export: 1 events, 45960us elapsed, 45960.00us avg, min 45960us max 45960us infus rms |
also
|
With #13000 merged what's left? |
@dagar @julianoes
There might be others parameters, but its a bit hard to find them among the long list, the best is to solve one by one and find the problematic cases. |
In general, do you see cases that we really need param_find() by param name? do you see cases that code will need to search parameter and it won't be found? |
Only a few, and those should be the exception that would ultimately be replaced architecturally. For example, commander shouldn't be dependent on any vehicle specific parameters. PX4 should be modular to the point it can be stripped down (customized) for a single vehicle type. |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
Describe the bug
On every parameter change there is extensive cpu use that can be reduce.
The reason is that on every parameter change there is a parameter_update.msg uorb.
some modules uses that as trigger to update their parameter.
some modules doesn't cache the handler of the required parameter. so they search it by param_find()
but param_find() is a bit heavy, it does a binary search of the name of the parameter on the list of all of the parameters.
I think that moving modules to the c++ param wrapper is advised.
The text was updated successfully, but these errors were encountered: