Skip to content

Conversation

romanwu10
Copy link

@romanwu10 romanwu10 commented Jul 19, 2025

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 when use_intra_process_comms is enabled, which is important for users monitoring performance metrics.

Did you use Generative AI?

No.

Additional Information

n/a

@romanwu10 romanwu10 force-pushed the fix-bug-with-topic-statistics-for-intra-process-comms branch from 517782d to dd92601 Compare July 19, 2025 03:11
Copy link
Collaborator

@fujitatomoya fujitatomoya left a 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.

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();
Copy link
Collaborator

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);
Copy link
Collaborator

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.

@romanwu10 romanwu10 force-pushed the fix-bug-with-topic-statistics-for-intra-process-comms branch from b1a9c6b to 7417b0a Compare July 19, 2025 22:27
@romanwu10 romanwu10 requested a review from fujitatomoya July 19, 2025 22:28
@luca-della-vedova
Copy link
Contributor

Hi @romanwu10

You stated in your description that you did not use Generative AI for this PR:

Did you use Generative AI?

No.

However, it seems extremely similar to this PR I noticed on your private repo that explicitly states that it was generated through ChatGPT.
Can you clarify on whether you did or didn't use GenAI for this contribution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use_intra_process_comms bypasses topic statistics computation
3 participants