Skip to content

Commit

Permalink
build: shrink profiling artifacts
Browse files Browse the repository at this point in the history
ci: parameterized ZTS/NTS for build_profiler task
  • Loading branch information
morrisonlevi committed Apr 8, 2024
1 parent c067f72 commit 889d636
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 33 deletions.
42 changes: 18 additions & 24 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,13 @@ commands:
parameters:
prefix:
type: string
triplet:
type: string
flavour:
type: string
steps:
- run:
name: Build Profiler NTS
name: Build Profiler << parameters.flavour >>
command: |
if [ -d '/opt/rh/devtoolset-7' ] ; then
set +eo pipefail
Expand All @@ -570,33 +574,17 @@ commands:
fi
set -u
prefix="<< parameters.prefix >>"
triplet="<< parameters.triplet >>"
flavour="<< parameters.flavour >>"
mkdir -vp "${prefix}"
command -v switch-php && switch-php "${PHP_VERSION}"
command -v switch-php && switch-php "${PHP_VERSION}${flavour}"
cd profiling
echo "${CARGO_TARGET_DIR}"
cargo build --release
touch build.rs # make sure `build.rs` gets executed after `switch-php` call
RUSTC_BOOTSTRAP=1 cargo rustc -p datadog-php-profiling --release --target "${triplet}" -Z build-std=panic_abort,core,std,alloc
cd -
cp -v "${CARGO_TARGET_DIR}/release/libdatadog_php_profiling.so" "${prefix}/datadog-profiling.so"
objcopy --compress-debug-sections "${prefix}/datadog-profiling.so"
- run:
name: Build Profiler ZTS
command: |
if [ -d '/opt/rh/devtoolset-7' ] ; then
set +eo pipefail
source scl_source enable devtoolset-7
set -eo pipefail
fi
set -u
prefix="<< parameters.prefix >>"
mkdir -vp "${prefix}"
command -v switch-php && switch-php "${PHP_VERSION}-zts"
cd profiling
echo "${CARGO_TARGET_DIR}"
touch build.rs #make sure `build.rs` gets executed after `switch-php` call
cargo build --release
cd -
cp -v "${CARGO_TARGET_DIR}/release/libdatadog_php_profiling.so" "${prefix}/datadog-profiling-zts.so"
objcopy --compress-debug-sections "${prefix}/datadog-profiling-zts.so"
cp -v "${CARGO_TARGET_DIR}/${triplet}/release/libdatadog_php_profiling.so" "${prefix}/datadog-profiling${flavour}.so"
objcopy --compress-debug-sections "${prefix}/datadog-profiling${flavour}.so"
executors:
with_agent:
Expand Down Expand Up @@ -2883,6 +2871,12 @@ jobs:
- <<: *STEP_APPEND_BUILD_ID
- build_profiler:
prefix: datadog-profiling/<< parameters.triplet >>/lib/php/<< parameters.abi_no >>
triplet: << parameters.triplet >>
flavour: ""
- build_profiler:
prefix: datadog-profiling/<< parameters.triplet >>/lib/php/<< parameters.abi_no >>
triplet: << parameters.triplet >>
flavour: "-zts"
- persist_to_workspace:
root: .
paths:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prof_asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
export LDFLAGS='-fsanitize=address'
export RUSTC_LINKER=lld-16
triplet=$(uname -m)-unknown-linux-gnu
RUSTFLAGS='-Zsanitizer=address' cargo +nightly-2023-05-03 build -Zbuild-std --target $triplet --release
RUSTFLAGS='-Zsanitizer=address' cargo +nightly-2023-05-03 build -Zbuild-std="panic_abort,core,alloc,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
Expand Down
10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ license = "Apache-2.0"
debug = 2 # full debug info

[profile.release]
debug = 1
lto = "thin"
codegen-units = 1
debug = "line-tables-only"
incremental = false
lto = "fat"
panic = "abort"

[profile.tracer-release]
debug = 1 # line tables only
lto = true
codegen-units = 1
panic = "abort"
inherits = "release"
1 change: 1 addition & 0 deletions dockerfiles/ci/alpine_compile_extension/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN set -eux; \
RUN apk add --no-cache llvm16-libs clang16-dev lld llvm16
RUN apk add --no-cache rust-stdlib
RUN apk add --no-cache cargo
RUN apk add --no-cache rust-src
RUN apk add --no-cache clang git protoc unzip

FROM base
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/ci/buster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ RUN mkdir -p -v "${CARGO_HOME}" "${RUSTUP_HOME}" \
&& printf '%s %s' "$RUST_SHA256" "$FILENAME" | sha256sum --check --status \
&& tar -xf "$FILENAME" \
&& cd ${FILENAME%.tar.gz} \
&& ./install.sh --components="rustc,cargo,clippy-preview,rustfmt-preview,rust-std-${MARCH}-unknown-linux-gnu" \
&& ./install.sh --components="rustc,cargo,clippy,rustfmt,rust-src,rust-std-${MARCH}-unknown-linux-gnu" \
&& cd - \
&& rm -fr "$FILENAME" "${FILENAME%.tar.gz}" \
&& rm -rfv /tmp/*
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/ci/centos/7/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ RUN source scl_source enable devtoolset-7 \
printf '%s %s' "$RUST_SHA256" "$FILENAME" | sha256sum --check --status && \
tar -xf "$FILENAME" \
&& cd ${FILENAME%.tar.gz} \
&& ./install.sh --components="rustc,cargo,clippy-preview,rustfmt-preview,rust-std-${MARCH}-unknown-linux-gnu" \
&& ./install.sh --components="rustc,cargo,clippy,rustfmt,rust-std-${MARCH}-unknown-linux-gnu,rust-src" \
&& cd - \
&& rm -fr "$FILENAME" "${FILENAME%.tar.gz}"

Expand Down

0 comments on commit 889d636

Please sign in to comment.