NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Runtime Function Instrumentation with EZTrace

Charles Aulagnon, Damien Martin-Guillerez, François Rué, François Trahay

Summary

EZTrace introduces a new coarse-grain instrumentation technique that allows developers to trace statically-linked functions with significantly lower overhead than traditional fine-grained tools like PIN or DynInst. By focusing specifically on function entry and exit points, the researchers created a lightweight, portable mechanism that simplifies performance analysis for complex high-performance computing (HPC) applications.

The Challenge of HPC Optimization

Optimizing modern supercomputer applications involves managing NUMA architectures, hierarchical caches, and hybrid programming models (such as mixing MPI with OpenMP). To identify bottlenecks, developers require "execution traces"—detailed logs of when key functions start and end.

Standard interception methods like LD_PRELOAD are effective for shared libraries but fail when functions are statically linked or defined within the program itself. Conversely, fine-grained binary instrumentation tools like PIN or DynInst rewrite machine code at a granular level. While powerful, these tools introduce significant execution overhead and require complex logic to handle every possible function exit point, such as returns and jumps.

Coarse-Grain Instrumentation Methodology

The authors propose a "coarse-grain" approach for the EZTrace framework. Rather than instrumenting every instruction, EZTrace focuses exclusively on function boundaries.

  1. The Trampoline: At program startup, EZTrace uses the ptrace() system call to pause the application. It identifies the target function and replaces its initial opcodes with a "trampoline"—a jump to an EZTrace wrapper function.
  2. The Replay Section: The original instructions overwritten by the trampoline are moved to a dedicated "replay" section in memory.
  3. The Wrapper: The EZTrace wrapper records the "entry" event, then executes the original function by jumping to the replay section. Once the function completes and returns to the wrapper, the wrapper records the "exit" event and returns control to the main application.
Figure 3: The EZTrace coarse-grained instrumentation mechanism using a replay section.

This method mimics the simplicity of a C-style wrapper, allowing local variables to persist from entry to exit, while operating on raw binaries without requiring source code.

Performance Evaluation

The researchers evaluated EZTrace using both microbenchmarks (repeatedly calling an empty function) and a real-world Molecular Dynamics (MD) simulation using four OpenMP threads, generating nearly 8 million trace events.

Key Results

Evaluation shows that EZTrace is significantly leaner than its competitors:

  • Raw Interception: In static library tests, EZTrace added only 12.3 ns of overhead per call, compared to 20.2 ns for PIN and 28.8 ns for DynInst.
  • Trace Recording: When writing events to a file, EZTrace was approximately 5x faster than PIN and DynInst.
  • Application Performance: On the Molecular Dynamics simulation, EZTrace added only 227 ns per event of overhead, while PIN and DynInst added 341 ns and 413 ns, respectively.
Figure 4: Comparison of trace recording overhead (ns/event) across different instrumentation tools.

Insights and Future Work

The primary insight of this research is that coarse-grain instrumentation is sufficient for performance tracing. By sacrificing opcode-level analysis, EZTrace achieves massive speed gains and improved portability. Because it only manages entry points and basic jumps, the architecture-specific code is minimal (less than 300 lines), facilitating easier ports to architectures like ARM.

While currently focused on Linux and Intel-based CPUs, the authors noted that the underlying theory is applicable to other operating systems like macOS and FreeBSD. Future work aims to expand architecture support and refine the tool for even broader HPC application environments.

Summary updated

BibTeX
@inproceedings{aulagnon2012runtime,
  author = {Charles Aulagnon and Damien Martin-Guillerez and François Rué and François Trahay},
  title = {{Runtime Function Instrumentation with EZTrace}},
  booktitle = {Euro-Par Workshops},
  year = {2012},
  doi = {10.1007/978-3-642-36949-0\_45},
}
Figure