https://github.com/lanl/byfl
Program analysis tool based on software performance counters
https://github.com/lanl/byfl
Last synced: about 1 year ago
JSON representation
Program analysis tool based on software performance counters
- Host: GitHub
- URL: https://github.com/lanl/byfl
- Owner: lanl
- License: other
- Created: 2012-07-25T00:53:16.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2021-05-13T21:40:09.000Z (about 5 years ago)
- Last Synced: 2024-11-20T13:40:25.051Z (over 1 year ago)
- Language: C++
- Homepage:
- Size: 1.9 MB
- Stars: 56
- Watchers: 22
- Forks: 15
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Byfl: Compiler-based Application Analysis
=========================================
Description
-----------
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:
```C
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](http://icl.cs.utk.edu/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 performs the moral equivalent of transforming the code into the following:
```C
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](http://www.rosecompiler.org/)) as implied by the preceding code sample. Instead, it integrates into the [LLVM compiler infrastructure](http://www.llvm.org/) 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](https://software.intel.com/en-us/articles/pin-a-dynamic-binary-instrumentation-tool) 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).
Installation
------------
Once you've downloaded Byfl, the usual [CMake](https://cmake.org/) build procedure,
```bash
cd Byfl
mkdir build
cd build
cmake ..
make
make install
```
should work, although, depending on your LLVM/Clang installation, you may need to pass `cmake` some configuration options. See [INSTALL.md](https://github.com/lanl/Byfl/blob/master/INSTALL.md) for a more complete explanation.
Documentation
-------------
Byfl documentation is maintained in the [Byfl wiki](https://github.com/lanl/Byfl/wiki) on GitHub.
Copyright and license
---------------------
Triad National Security, LLC (Triad) 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 [LICENSE.md](https://github.com/lanl/Byfl/blob/master/LICENSE.md) for the full text.
Contact
-------
Scott Pakin, [_pakin@lanl.gov_](mailto:pakin@lanl.gov)
A list of [all contributors to Byfl](https://github.com/lanl/Byfl/wiki/contributors) is available online.