drivers/sensors: add sensor monitor debug log. part 7 #18256
Merged
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.
Summary
This patch series 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
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
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
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)
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
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