This crate contains common code for eBPF-based measurement of RAPL perf-events. A starting point for this work has been the "bpf-perf" C examples, see this commit in the Linux kernel repository and the description of the feature.
- Install a rust stable toolchain:
rustup install stable
- Install a rust nightly toolchain with the rust-src component:
rustup toolchain install nightly --component rust-src
- Install bpf-linker:
cargo install bpf-linker
- Download our modified version of aya: download the whole repository at the given commit, and place the uncompressed directory next to the root directory of the measurement tool's directory.
- Uncomment the last lines of the root Cargo.toml.
First, build the eBPF program that will be loaded into the kernel.
cargo xtask build-ebpf --release
To perform a release build you can use the --release
flag.
You may also change the target architecture with the --target
flag.
cargo build --features enable_ebpf --release --bin cli_poll_rapl
sudo -E ./target/x86_64-unknown-linux-musl/release/cli_poll_rapl poll ebpf --domains pkg -f 1 -o stdout
Debug tip: remove --release
flags and add environment variable RUST_LOG=debug