Program analysis tool based on software performance counters
C++ M4 Shell Makefile Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Byfl: Compiler-based Application Analysis


Byfl helps application developers understand code performance in a hardware-independent way. The idea is that it instruments your code at compile time then gathers and reports data at run time. For example, suppose you wanted to know how many bytes are accessed by the following C code:

double array[100000][100];
volatile double sum = 0.0;

for (int row=0; row<100000; row++)
  sum += array[row][0];

Reading the hardware performance counters (e.g., using PAPI) can be misleading. The performance counters on most processors tally not the number of bytes but rather the number of cache-line accesses. Because the array is stored in row-major order, each access to array will presumably reference a different cache line while each access to sum will presumably reference the same cache line.

Byfl does the equivalent of transforming the code into the following:

unsigned long int bytes accessed = 0;
double array[100000][100];
volatile double sum = 0.0;

for (int row=0; row<100000; row++) {
  sum += array[row][0];
  bytes_accessed += 3*sizeof(double);

In the above, one can consider the bytes_accessed variable as a "software performance counter," as it is maintained entirely by software.

In practice, however, Byfl doesn't do source-to-source transformations (unlike, for example, ROSE) as implied by the preceding code sample. Instead, it integrates into the LLVM compiler infrastructure as an LLVM compiler pass. Because Byfl instruments code in LLVM's intermediate representation (IR), not native machine code, it outputs the same counter values regardless of target architecture. In contrast, binary-instrumentation tools such as Pin may tally operations differently on different platforms.

The name "Byfl" comes from "bytes/flops". The very first version of the code counted only bytes and floating-point operations (flops).


There are eight "release" branches of Byfl on GitHub:

  • master, corresponding to LLVM trunk (often not up to date; best to avoid)
  • llvm-5.0, corresponding to LLVM 5.0.x releases
  • llvm-4.0, corresponding to LLVM 4.0.x releases
  • llvm-3.9, corresponding to LLVM 3.9.x releases
  • llvm-3.8, corresponding to LLVM 3.8.x releases
  • llvm-3.7, corresponding to LLVM 3.7.x releases
  • llvm-3.6, corresponding to LLVM 3.6.x releases
  • llvm-3.5, corresponding to LLVM 3.5.x releases

Be sure to download the Byfl branch that corresponds to your installed LLVM version. (Run llvm-config --version to check.) Then, the usual

make install

procedure should work. See for a more complete explanation.


Byfl documentation is maintained in the Byfl wiki on GitHub.

Copyright and license

Los Alamos National Security, LLC (LANS) owns the copyright to Byfl, which it identifies internally as LA-CC-12-039. The license is BSD-ish with a "modifications must be indicated" clause. See for the full text.


Scott Pakin,

A list of all contributors to Byfl is available online.