Skip to content

Update scrape benchmark to use http requests #6

Update scrape benchmark to use http requests

Update scrape benchmark to use http requests #6

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, edited, synchronize]
defaults:
run:
shell: bash -eux {0}
jobs:
generate_memory_flamegraph:
name: Create flamegraph for scrape_flamegraph
permissions:
checks: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Generate memory flamegraph
run: |
rustc --version
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev pkg-config curl git
sudo apt-get install -y cmake g++ libboost-dev libboost-iostreams-dev libboost-program-options-dev libdw-dev libelf-dev elfutils libunwind-dev zlib1g-dev binutils-dev libiberty-dev libdebuginfod-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-regex-dev
git clone https://github.com/rust-lang/rustc-demangle.git /tmp/rustc-demangle
cd /tmp/rustc-demangle
cargo build -p rustc-demangle-capi --release
mv target/release/librustc_demangle.so /usr/lib
cd "$GITHUB_WORKSPACE"
cargo install rustfilt
git clone https://github.com/brendangregg/FlameGraph.git /tmp/FlameGraph
git clone https://github.com/KDE/heaptrack.git /tmp/heaptrack
cd /tmp/heaptrack
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr/local -DHEAPTRACK_USE_LIBUNWIND=ON -DHEAPTRACK_BUILD_PRINT_TRACES=ON
make -j$(nproc)
make install
cd "$GITHUB_WORKSPACE"
RUSTFLAGS="-C force-frame-pointers=yes -C symbol-mangling-version=v0" CARGO_PROFILE_RELEASE_DEBUG=true cargo build --profile profiling --test flamegraph_test
export TEST_BINARY=$(find target/profiling/deps -name "flamegraph_test-*" -type f -executable | head -1)
export CARGO_MANIFEST_DIR=/projects/lustrefs-exporter && heaptrack --output heaptrack-data "$TEST_BINARY" profile_with_flamegraph
heaptrack_print heaptrack-data.gz -F flamegraph-data.txt
rustfilt < flamegraph-data.txt > demangled-flamegraph.txt
awk '$NF > 1000' demangled-flamegraph.txt > significant_stacks.txt
/tmp/FlameGraph/flamegraph.pl --colors mem --countname allocations < significant_stacks.txt > flamegraph.svg