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

mavlink main return main loop delay proper size #7829

Merged
merged 1 commit into from
Aug 20, 2017

Conversation

dagar
Copy link
Member

@dagar dagar commented Aug 20, 2017

Going back to @pavel-kirienko's NuttX profiling one thing he found was > 1% of total system time was spent on this line in mavlink. #6829 (comment)
image

This turned out to be get_main_loop_delay() returning a 64 bit integer, although the loop delay itself is an unsigned int. Simply fixing the return type to match the data reduces cpu by 1-2%.

Before

 185 mavlink_if0                 19839 10.658  1736/ 2380 100 (100)  w:sig 
 186 mavlink_rcv_if0               763  0.429  1608/ 2140 175 (175)  w:sem 
 190 mavlink_if1                  4878  2.646  1656/ 2420 100 (100)  READY 
 191 mavlink_rcv_if1               757  0.429  1320/ 2140 175 (175)  w:sem 
 206 mavlink_if2                 13381  7.081  1720/ 2364 100 (100)  w:sig 
 207 mavlink_rcv_if2               769  0.357  1504/ 2140 175 (175)  w:sem 
 247 mavlink_if3                 12008  6.151  1648/ 2388 100 (100)  READY 
 248 mavlink_rcv_if3               777  0.429  1320/ 2140 175 (175)  w:sem 

After

 185 mavlink_if0                 10836  9.942  1736/ 2380 100 (100)  READY 
 186 mavlink_rcv_if0               449  0.432  1496/ 2140 175 (175)  w:sem 
 190 mavlink_if1                  2623  2.377  1656/ 2420 100 (100)  w:sig 
 191 mavlink_rcv_if1               443  0.432  1320/ 2140 175 (175)  w:sem 
 206 mavlink_if2                  7237  6.556  1720/ 2364 100 (100)  w:sig 
 207 mavlink_rcv_if2               451  0.432  1320/ 2140 175 (175)  w:sem 
 247 mavlink_if3                  6264  5.475  1664/ 2388 100 (100)  w:sig 
 248 mavlink_rcv_if3               447  0.432  1464/ 2140 175 (175)  w:sem 

@dagar dagar requested a review from LorenzMeier August 20, 2017 21:23
@TSC21
Copy link
Member

TSC21 commented Aug 20, 2017

How simple things can just ruin performance! Nice one @dagar

@LorenzMeier LorenzMeier merged commit 1e42d52 into PX4:master Aug 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants