-
Notifications
You must be signed in to change notification settings - Fork 468
Fix bug with topic statistics for intra process comms #2913
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
base: rolling
Are you sure you want to change the base?
Fix bug with topic statistics for intra process comms #2913
Conversation
517782d
to
dd92601
Compare
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.
thanks for creating PR. a couple of comments.
- did you try to build with your local environment, it seems build is failing. see https://build.ros2.org/job/Rpr__rclcpp__ubuntu_noble_amd64/718/console
- test would be idea to make sure the statistics works okay. could you also add the test case with intra-process communication for
test_subscription_topic_statistics.cpp
?
if (subscription_topic_statistics_) { | ||
now = std::chrono::system_clock::now(); | ||
auto nanos = std::chrono::time_point_cast<std::chrono::nanoseconds>(now); | ||
msg_info.source_timestamp = nanos.time_since_epoch().count(); |
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.
as we know, we do not have message info from rmw implementation with intra-process communication.
if we do this, the message age statistics will be always 0 because msg_info.source_timestamp
is equal to time
.
i understand we can generate the statistics with this change, but is this really useful for user application? i am not even sure about this. instead of generating fake statistics, maybe warning once that tells intra-process communication does not provide age statistics would be better for the user application? or maybe it is always age is zero?
if (subscription_topic_statistics_) { | ||
const auto nanos = std::chrono::time_point_cast<std::chrono::nanoseconds>(now); | ||
const auto time = rclcpp::Time(nanos.time_since_epoch().count()); | ||
subscription_topic_statistics_->handle_message(msg_info, time); |
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.
at least for period statistics, this can enables it to calculate intra and inter-process communication messages all together. i think that is the right thing to do.
Signed-off-by: Roman Wu <[email protected]>
Signed-off-by: Roman Wu <[email protected]>
Signed-off-by: Roman Wu <[email protected]>
b1a9c6b
to
7417b0a
Compare
Hi @romanwu10 You stated in your description that you did not use Generative AI for this PR:
However, it seems extremely similar to this PR I noticed on your private repo that explicitly states that it was generated through ChatGPT. |
Description
Fixes #2911
Is this user-facing behavior change?
Yes, this patch updates
SubscriptionIntraProcess
to pass along the topic statistics pointer and call the statistics handler during intra-process message deliveries. This ensures that topic statistics—such as message age and publishing period—are still computed whenuse_intra_process_comms
is enabled, which is important for users monitoring performance metrics.Did you use Generative AI?
No.
Additional Information
n/a