-
Notifications
You must be signed in to change notification settings - Fork 275
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
Optimize render updates and use of thread mutexes in Sensors system #1938
Conversation
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
…t, update scene tree only when there are sensor or event subscribers Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall approach looks good, I'm going to allocate a little more time to review this afternoon as this is pretty tricky logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally got to think about this one enough, and I'm happy with the approach. Thanks for tackling this tricky bit of logic!
Codecov Report
@@ Coverage Diff @@
## gz-sim7 #1938 +/- ##
===========================================
- Coverage 64.68% 64.51% -0.18%
===========================================
Files 343 347 +4
Lines 27430 27872 +442
===========================================
+ Hits 17743 17981 +238
- Misses 9687 9891 +204
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@iche033 do you have any plans to backport this to fortress? |
yes I'll backport this to fortress |
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Marked as draft to debug test failuresFixed🦟 Bug fix
Related to: gazebosim/gz-sensors#332
Summary
While profiling the sensors system, I noticed that it spends a quite bit of time
RenderUtil
calls inside theUpdate
function should be thread-safe (protected by mutex inside RenderUtil).scene->PreRender()
,scene->PostRender
,renderUtil.Update()
) when there are no sensor or render event subscribersThis PR optimizes the threading and render updates in the sensors system by:
removingreducing the scope of therenderMutex
lock inSensors::Update
function* use a separate mutex for the render condition variable to reduce places that need to lock therenderMutex
Test results
Here are the RTF changes that I got from running different worlds (i7 3.4GHz 32GB RAM, NVIDIA GeForce GTX 1070 8GB VRAM). I added a best fit line to the RTF values. There is an improvement in RTF and noticeably less jitter.
sensors_demo.sdf
world (with lidar visualization on)Before
After
profile_lidar.sdf
world (5 lidars inside Depot model. All lidars are subscribed)Before
After
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.