Collect entities when a new node entity is added/removed#5
Merged
MartinCornelis2 merged 2 commits intonobleo:nobleo/feature/static_executorfrom Mar 11, 2020
Conversation
added 2 commits
March 3, 2020 18:29
wait_set_.size_of_* is always different than '0' if we are inside the for loop Signed-off-by: Mauro <mpasserino@irobot.com>
Now we check ONLY node guard_conditions_ Some possible guard conditions to be triggered HERE are: 1. Ctrl+C guard condition 2. Executor interrupt_guard_condition_ 3. Node guard_conditions_ 4. Waitables guard conditions 5. ..more The previous approach was only checking if NOT (1 & 2), so if a Waitable was triggered, it would re-collect all entities, even if no new node entity was added. This was the case of the intra process manager, who relies on waitables. Every time a subscriber got a message, all the entities were collected. Signed-off-by: Mauro <mpasserino@irobot.com>
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.
The static executor has a list which contains executables like timers, subscribers and waitables belonging to nodes registered in the executor.
This list should be rebuilt each time a new entity is added/removed to/from a node, so the static executor checks for guard conditions being triggered in order to re-collect entities.
Some possible guard conditions to be checked by the static executor are:
The previous approach was only checking if NOT (1 & 2), so if a waitable guard condition was triggered it would re-collect all entities, even if no new node entities were added/removed.
This is the case of the intra process manager, which relies on waitables. Every time a subscriber gets a message, all the entities would be re-collected in the executable list. This could happen hundreds of times per second, having a noticeable impact on the CPU performance and in the ROS2 system (high latencies, lost messages).
With the new approach the executable list is rebuilt only when a new node entity is added/removed to/from a node, by checking for triggered guard conditions belonging to nodes registered in the executor.
Below, the benchmark [1] performances for the standard, static and modified static executor on a Rasperry Pi Model A+ (RPi 1), single core @700Mhz
Using:
The gain in CPU performance is about ~13% compared to the StaticSingleThreadedExecutor, and 32% compared to the SingleThreadedExecutor.
@alsora
@dgoel
[1] https://github.com/irobot-ros/ros2-performance/tree/master/performances/benchmark