instrumentation-infra is an infrastructure for program instrumentation. It builds benchmark programs with custom instrumentation flags (e.g., LLVM passes) and runs them. The design is modular, so it is designed to be extended by users.
The infrastructure uses three high-level concepts to specify benchmarks and build flags:
- A target is a benchmark program (or a collection of programs) that is to be
instrumented. An example is
- An instance specifies how to build a target. An example is
infra.instances.Clangwhich builds targets using the Clang compiler. For SPEC2006, one of the resulting binaries would be called
- Targets and instances can specify dependencies in the form of packages, which are built automatically before the target is built.
The infrastructure provides a number of common targets and their dependencies as packages. It also defines baseline instances for LLVM, along with packages for its build dependencies. There are some utility passes and a source patch for LLVM that lets you develop instrumentation passes in a shared object, without having to link them into the compiler after every rebuild.
A typical use case is a programmer that has implemented some security feature in
an LLVM pass, and wants to apply this pass to real-world benchmarks to measure
its performance impact. They would create an instance that adds the relevant
arguments to CFLAGS, create a setup script that registers this instance in the
infrastructure, and run the setup script with the
to quickly see if things work on the builtin targets (e.g., SPEC).
The easiest way to get started with the framework is to clone and adapt our skeleton repository which creates an example target and instrumentation instance. Consult the API docs for extensive documentation on the functions used. Read the usage guide to find our how to set up your own project otherwise, and for examples of how to invoke build and run commands.