-
Notifications
You must be signed in to change notification settings - Fork 43
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
Shared Memory on C++ API #363
Open
yellowhatter
wants to merge
19
commits into
ros2:rolling
Choose a base branch
from
ZettaScaleLabs:dev/1.0.0-cpp-shm
base: rolling
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f59f93a
C++ SHM
yellowhatter 449ae80
fix default shm msg size threshold
yellowhatter 5a5fa3a
code format fix
yellowhatter 80e2326
add lost tracepoints
yellowhatter fd9e715
code format
yellowhatter 8b2284f
remove unnecessry flags from zenoh-cpp vendor
yellowhatter 048e158
review fixes
yellowhatter 6a20e70
codestyle fixes
yellowhatter 6591885
Change 2023 -> 2024 in copyright
yellowhatter f12358c
Remove obsolete comment from default config
yellowhatter 4d9f122
include <cstddef>
yellowhatter 4fd8bce
Merge commit '2429bf27c798af7be0b759bea1d770152b0f5042'
yellowhatter bfc2983
style fix
yellowhatter dfbfec1
bugfixed zenoh
yellowhatter 1d8a5e5
fix: Update VCS_VERSION for zenoh_cpp_vendor to latest commit (#52)
imstevenpmwork d01c019
Merge commit '0ef1d11cfa09fb6d409706c48a8e471bb72fef68'
yellowhatter fe89b2c
bump zenoh
yellowhatter 131cac9
- non-blocking allocation for SHM
yellowhatter 89735b1
change defaulkt shm size to 16mb to fit big topics
yellowhatter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2024 Open Source Robotics Foundation, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifdef RMW_ZENOH_BUILD_WITH_SHARED_MEMORY | ||
|
||
#include <stdexcept> | ||
|
||
#include "shm_context.hpp" | ||
|
||
namespace rmw_zenoh_cpp | ||
{ | ||
///============================================================================= | ||
ShmContext::ShmContext(size_t alloc_size, size_t msgsize_threshold) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in |
||
: // Create Layout for provider's memory | ||
// Provider's alignment is 1 (=2^0) bytes as we are going to make only 1-byte aligned allocations | ||
// TODO(yellowhatter): use zenoh_shm_message_size_threshold as base for alignment | ||
shm_provider(zenoh::PosixShmProvider(zenoh::MemoryLayout(alloc_size, zenoh::AllocAlignment {0}))), | ||
msgsize_threshold(msgsize_threshold) | ||
{} | ||
} // namespace rmw_zenoh_cpp | ||
|
||
#endif |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I will say that I'm not a huge fan of wrapping this in a
#ifdef
this way. When we release it on the buildfarm, we can only choose one define here, so we may as well just unconditionally add it.In other words, if we think this feature is stable enough to use, we should just always build it in. If it is not yet stable enough to use, then we shouldn't merge the PR until we are confident in it.
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.
This define is not about the stability but about binary size. SHM is relatively big subsystem of Zenoh with additional dependencies (and it will get even larger in the future) and some (yet small) wire, computation and memory overhead. We have shared-memory feature conditionally compiled through the whole bunch of our projects: zenoh -> zenoh-c -> zenoh-cpp, so supporting this in zenoh_rmw makes sense for users who care about binary size. You can release RMW with
RMW_ZENOH_BUILD_WITH_SHARED_MEMORY=true
(which istrue
by default), but there still will be an option for users to make custom build without SHM.