handle return value of read() correctly#44
Open
ishiguroJSK wants to merge 3 commits intotork-a:masterfrom
Open
handle return value of read() correctly#44ishiguroJSK wants to merge 3 commits intotork-a:masterfrom
ishiguroJSK wants to merge 3 commits intotork-a:masterfrom
Conversation
Member
|
@SoichiTaniguchi if you have real hardware device and free time, please check if this works. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I found out this node is using 100% of 1 thread, and then I found this section has the cause of that.
dynpick_driver/src/main.cpp
Lines 100 to 114 in 507cdab
Because this socket is opened as NONBLOCK, and read() returns "0" when there is no new received data (-1 for some error), this section is spinning so rapid unnecessarily like below (I inserted debug print).
I think polling at 10kHz is enough to run dynpick at 1kHz.
With this PR, this node is running with 10~30% of single thread usage.
How about like this implement?