A Tool for Dynamic Instrumentation of Programs Running on Intel(r)
Pin is a software instrumentation tool for Linux executables. It allows code written in C or C++ to be injected at arbitrary points in an application. The injected code is used to observe the behavior of the program, and can be used to write branch predictors, profilers, memory leak detectors, etc. Its robust design and simple user model makes it easy to do studies that span workstation applications to complex server applications like commercial databases. Currently supported platforms include Xscale, IA-32, EM64T, and Itanium microprocessors.
Pin is implemented with a Just-in-Time compiler that dynamically translates and instruments every instruction that the application executes. Using dynamic compilation for instrumentation provides a straightforward solution for instrumenting code that is mixed with data, shared libraries, and injecting instrumentation into an already running process.
Pin is in use at Intel to develop software quality tools, analyze compiler performance, and collect instruction traces for microprocessor performance modeling. ISVs use Pin for internal tools. University researchers use pin as an education tool in compiler and computer architecture classes and as a research tool for fault tolerance, prefetching, and power reduction studies.
In this presentation, we introduce the Pin API and show how to write some simple Pintools. We also describe the implementation of Pin and present some data on the performance of instrumentation.