Otpvondoiats opened a new pull request, #18256: URL: https://github.com/apache/nuttx/pull/18256
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary es adds a comprehensive sensor monitoring and debug logging framework to improve observability and troubleshooting capabilities for sensor drivers in multi-core RPMSG scenarios. Motivation Debugging sensor issues in production systems, especially in multi-core environments with RPMSG communication, is challenging due to: Limited visibility into sensor state transitions Difficulty tracking data flow between cores Lack of per-topic logging granularity Hard to diagnose timing and synchronization issues This patch introduces a flexible, topic-specific logging framework that allows runtime monitoring of sensor operations without requiring recompilation. ## Impact - Users Enhanced Debugging: Runtime visibility into sensor operations without code changes Selective Monitoring: Enable logging only for specific topics of interest Performance Diagnosis: Identify bottlenecks and timing issues Production Support: Debug issues in deployed systems with minimal overhead - Development Faster Troubleshooting: Quickly identify root causes of sensor issues Better Testing: Comprehensive logs help verify correct behavior RPMSG Debug: Clear visibility into multi-core communication Code Quality: Standardized logging approach across sensor framework - Build Process Optional Feature: Controlled by CONFIG_SENSORS_MONITOR config option Zero Overhead: When disabled, macros compile to nothing (no runtime cost) Minimal Size: Small code size increase when enabled (~2KB) - Performance Negligible Impact: Logging only active for monitored topics Efficient Macros: Compile-time conditionals eliminate runtime checks when disabled Controlled Output: Per-topic log levels prevent log spam - Compatibility Backward Compatible: No API changes, purely additive Configurable: Can be completely disabled for production if needed Flexible: Log levels adjustable per topic at runtime ## Testing ~~~ uorb_listener -n 10 algo_off_body0 [22/01/26 05:46:11.422119] [185] [ap] sensor_open: [topic: algo_off_body0] user address: 0x19bee650, role type: 2, user generation: 0, upper generation: 1, nsubscribers: 4, nadvertisers: 0, persist: 1 [22/01/26 05:46:11.424378] [185] [ap] sensor_close: [topic: algo_off_body0] user address: 0x19bee650, close subscriber: 3, close advertiser:0 [22/01/26 05:46:11.425965] [185] [ap] sensor_open: [topic: algo_off_body0] user address: 0x19e32dd0, role type: 0, user generation: 0, upper generation: 1, nsubscribers: 3, nadvertisers: 0, persist: 1 [22/01/26 05:46:11.428101] [185] [ap] sensor_close: [topic: algo_off_body0] user address: 0x19e32dd0, close subscriber: 3, close advertiser:0 Mointor objects num:1 object_name:algo_off_body, object_instance:0 [22/01/26 05:46:11.429871] [185] [ap] sensor_open: [topic: algo_off_body0] user address: 0x19e32e10, role type: 2, user generation: 0, upper generation: 1, nsubscribers: 4, nadvertisers: 0, persist: 1 [22/01/26 05:46:11.432739] [185] [ap] sensor_do_samples: [topic: algo_off_body0] do sample interval:1, user.generation:1, ret:16 [22/01/26 05:46:11.434143] [185] [ap] sensor_read: [topic: algo_off_body0] the number of read event is:1 algo_off_body(now:6532014587):timestamp:1769054261561,is_wrist:1 Waited for 5 seconds without a message. Giving up. err:2 [22/01/26 05:46:16.441528] [185] [ap] sensor_close: [topic: algo_off_body0] user address: 0x19e32e10, close subscriber: 3, close advertiser:0 Object name:algo_off_body0, recieved:1 Total number of received Message:1/10 ~~~ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
