ePAPI: Performance Application Programming Interface for Embedded Platforms

Jeremy Giesen, Enrico Mezzetti, Jaume Abella, Enrique Fernández, Francisco J. Cazorla

TL;DR

This paper introduces ePAPI, a port of the widely-used PAPI performance monitoring interface to the AURIX TC297 embedded platform. This work addresses the critical need for standardized performance analysis tools in embedded systems, enabling more accurate timing characterization and optimization of complex embedded applications.

What Problem Does This Paper Address?

Modern embedded systems, particularly in domains like automotive and avionics, are increasingly adopting complex, high-performance Commercial Off-The-Shelf (COTS) multicore processors. While these platforms offer significant computational power, their architectural complexity hinders traditional Worst-Case Execution Time (WCET) analysis. Performance Monitoring Counters (PMCs) are crucial for gathering detailed execution metrics (like cache misses and memory accesses) needed for debugging, optimization, and timing analysis. However, PMC support varies wildly across different embedded platforms, and accessing them typically requires low-level, platform-specific, and error-prone manipulation. This lack of standardization makes it difficult to develop reusable tools and methodologies for performance analysis in embedded systems. Existing solutions like PAPI are prevalent in mainstream computing but are not readily available for embedded critical processors.

Methods

The authors' primary method was to port the existing PAPI (Performance Application Programming Interface) library to the Infineon AURIX TC297, a representative automotive embedded platform. This involved:

  • Assessing PAPI Compatibility: Evaluating how well the PAPI interface's event model and functionality align with the AURIX TC297's PMC capabilities.
  • Implementing ePAPI: Developing a functionally equivalent, low-overhead implementation of PAPI for the TC297. This involved selecting a subset of PAPI functions and mapping them to the available hardware events on the TC297.
  • Leveraging a Low-Level PMC Library: The low-level aspects of ePAPI were built upon a pre-existing, assembly-based library called PMClib, which provides direct control over the TC297's PMC registers.
  • Validation: Rigorous validation was performed to ensure both the functional correctness and the low overhead of ePAPI. This included:
  • Functional Testing: Verifying that ePAPI's behavior matched the PAPI specification.
  • Overhead Measurement: Comparing the performance impact of using ePAPI's high-level interface against the bare-metal PMClib for various benchmarks. This was done by measuring executed cycles, instructions, and the actual PMC values.

Datasets

Not discussed in the paper. The evaluation used ad-hoc benchmarks designed to trigger specific hardware events on the AURIX TC297.

Key Insights and Ideas

  • The Need for Standardization is Paramount: The paper strongly reinforces that a standardized interface like PAPI is essential for making performance analysis tools reusable and accessible in the diverse embedded landscape.
  • PAPI's Core Concepts Translate Well: Despite the differences in hardware, the fundamental concepts of PAPI (preset and native events, event sets) are applicable to embedded platforms, providing a familiar programming model.
  • Embedded PMC Support is Limited: The AURIX TC297, while a capable platform, has significantly less PMC support compared to mainstream processors. This limitation directly impacts the number of PAPI events that can be mapped, forcing a careful selection process.
  • Low Overhead is Achievable: The authors demonstrate that it's possible to achieve a functionally equivalent PAPI port with minimal overhead on embedded systems, crucial for not interfering with the very performance being measured.
  • Native Events are Key for Embedded Specifics: While preset PAPI events offer cross-platform compatibility, the paper highlights the importance of native events for capturing embedded-specific phenomena like pipeline stalls, which are critical for timing analysis.

Key Results

  • ePAPI Developed and Validated: The paper successfully developed and validated ePAPI, a functionally equivalent and low-overhead implementation of PAPI for the AURIX TC297.
  • Negligible Overhead: The overhead introduced by ePAPI's high-level interface was found to be generally negligible. The difference in executed cycles was typically between 25-28 cycles, and the number of additional instructions was around 11-12, attributed to generic PMC management. The actual event counts showed no significant differences.
  • Subset of PAPI Supported: Due to the TC297's limited PMC support, ePAPI implements a subset of PAPI functions. Specifically, it supports most high-level functions but only a fraction of the low-level ones.

Limitations and Future Work

  • Limited PMC Support on TC297: The primary limitation stems from the AURIX TC297's restricted PMC capabilities, which prevents the full mapping of PAPI's extensive event set. This means some embedded-specific events (like detailed contention characterization on the SRI) cannot be precisely captured.
  • Subset of PAPI Functions: Not all PAPI functions are implemented in ePAPI, particularly those related to component selection, FPU events, and OS-level thread/task monitoring.
  • Future Work:
    • RTOS Integration: Extend ePAPI to support RTOS-based PAPI functions, enabling task- and thread-level PMC monitoring (e.g., with Erika RTOS).
  • Broader Platform Support: Port ePAPI to other embedded platforms, especially those with richer PMC support, to further enhance its cross-platform utility.
  • Addressing PAPI Limitations: Investigate ways to better leverage native events and potentially adapt PAPI's interface to better suit embedded-specific needs.

Summary updated

Abstract

Performance Monitoring Counters (PMCs) have been traditionally used in the mainstream computing domain to perform debugging and optimization of software performance. PMCs are increasingly considered in embedded time-critical domains to collect in-depth information, e.g. cache misses and memory accesses, of software execution time on complex multicore platforms. In main-stream platforms, standardized specifications and applications like the Performance Application Programming Interface (PAPI) and perf have been proposed to deal with variable PMC support across platforms, by providing a shared interface for configuring and collecting traceable events. However, no equivalent solution exists for embedded critical processors for which the user is required to deal with low-level, platform-specific, and error-prone manipulation of PMC registers. In this paper, we address the need for a standardized PMC interface in the embedded domain, especially in view to support timing characterization of embedded platforms. We assess the compatibility of the PAPI interface with the PMC support available on the AURIX TC297, a reference automotive platform, and we implement and validate ePAPI, the first functionally-equivalent and low-overhead implementation of PAPI for the considered embedded platform.
BibTeX
@inproceedings{giesen2019epapi,
  author = {Jeremy Giesen and Enrico Mezzetti and Jaume Abella and Enrique Fernández and Francisco J. Cazorla},
  title = {{ePAPI: Performance Application Programming Interface for Embedded Platforms}},
  booktitle = {WCET},
  year = {2019},
  doi = {10.4230/oasics.wcet.2019.3},
}
Figure