Run webserver benchmarks with ddprof #5268
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Profiling ASAN Tests | |
on: | |
pull_request: | |
jobs: | |
prof-asan: | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
php-version: [8.3, 8.4] | |
container: | |
image: datadog/dd-trace-ci:php-${{matrix.php-version}}_bookworm-5 | |
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user | |
options: --user root --privileged | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- name: Restore build cache | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build and install profiler | |
run: | | |
set -eux | |
switch-php nts-asan | |
cd profiling | |
export CARGO_TARGET_DIR=/tmp/build-cargo | |
export CC=clang-17 | |
export CFLAGS='-fsanitize=address -fno-omit-frame-pointer' | |
export LDFLAGS='-fsanitize=address -shared-libasan' | |
export RUSTC_LINKER=lld-17 | |
triplet=$(uname -m)-unknown-linux-gnu | |
RUST_NIGHTLY_VERSION="-2025-01-03" | |
rustup component add rust-src --toolchain nightly${RUST_NIGHTLY_VERSION} | |
RUSTFLAGS='-Zsanitizer=address' cargo +nightly${RUST_NIGHTLY_VERSION} build -Zbuild-std --target $triplet --release | |
cp -v "$CARGO_TARGET_DIR/$triplet/release/libdatadog_php_profiling.so" "$(php-config --extension-dir)/datadog-profiling.so" | |
- name: Cache build dependencies | |
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
/tmp/build-cargo/ | |
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run phpt tests | |
run: | | |
set -eux | |
switch-php nts-asan | |
cd profiling/tests | |
cp -v $(php-config --prefix)/lib/php/build/run-tests.php . | |
export DD_PROFILING_OUTPUT_PPROF=/tmp/pprof | |
php run-tests.php --show-diff --asan -d extension=datadog-profiling.so phpt |