Abstract
Modern safety-critical real-time systems require precise timing verification, often relying on Hardware Performance Monitors (HPMs). However, standard HPMs lack task-level awareness, conflating a task's activity with background noise from interrupts and concurrent cores. This paper presents TAP (Task-Aware Profiling), a framework that integrates lightweight hooks into the operating system to provide clean, task-specific hardware metrics. Implemented on the Infineon AURIX TC397 with the ERIKA Enterprise RTOS, TAP demonstrates near-perfect noise filtering with negligible overhead, enabling accurate system-level profiling for automotive applications.
The Challenge of Task-Level Profiling
In safety-critical embedded systems, such as those used in automotive braking or steering, meeting strict timing deadlines is paramount. Engineers utilize Hardware Performance Monitors (HPMs)—on-chip counters that track events like cache misses and memory stalls—to verify system behavior.
However, a significant "noise" problem persists. HPMs operate at the hardware level and are agnostic to software abstractions like "tasks." When a task is interrupted by the OS or delayed by memory requests from a neighboring core, the HPM continues counting indiscriminately. This makes it difficult to isolate events caused by the task under analysis from background system activity.
The TAP Framework
TAP (Task-Aware Profiling) bridges the gap between hardware counters and software tasks through a multi-layered approach:
- Lightweight API: Developers can define specific "monitoring regions" within their code using simple start and stop functions.
- RTOS Integration: The framework extends the Task Control Block (TCB) of the ERIKA Enterprise RTOS to store task-specific HPM configurations and results.
- Context-Aware Hooks: Assembly-level hooks are inserted into the OS's interrupt handlers and scheduler. These hooks ensure that counters are paused during interrupts or preemption and restored when the task resumes.
- Lazy Management: To minimize overhead, TAP only reconfigures hardware registers when a task switch necessitates a change in the metrics being tracked.
Implementation and Evaluation
The system was implemented on the Infineon AURIX TC397, a multicore processor standard in the automotive industry. Evaluation involved both synthetic memory-intensive tasks and automotive validation kernels mimicking real-world workloads.
Key Results
- Noise Filtering: In scenarios where a task was preempted multiple times by "noisy" neighbors, TAP successfully filtered out external interference. The resulting HPM counts matched "solo" execution profiles almost perfectly.
- Low Overhead: TAP adds only 28 cycles of overhead for standard interrupts. Even in complex task-switching scenarios, the overhead remains a negligible fraction of the millions of cycles typically required for automotive tasks.
- System-Level Visibility: Unlike standard core-local profilers, TAP accurately tracks off-core events, such as shared memory bus requests, while correctly attributing them to the originating task.
Conclusion
TAP provides a robust solution for precise hardware profiling in complex, integrated real-time systems. By making hardware counters "task-aware," it enables engineers to perform the high-fidelity timing verification required for modern safety-critical applications. Future work may explore using TAP's real-time data to actively regulate "hog" tasks that consume excessive system bandwidth.
Summary updated