diff --git a/.github/chainguard/async-profiler-build.ci.sts.yaml b/.github/chainguard/async-profiler-build.ci.sts.yaml index 339ec1a03..8d3254f6f 100644 --- a/.github/chainguard/async-profiler-build.ci.sts.yaml +++ b/.github/chainguard/async-profiler-build.ci.sts.yaml @@ -1,7 +1,7 @@ -# Allow java-profiler GitLab CI to publish reports and manage issues +# Allow java-profiler and benchmarking-platform GitLab CI to post reports issuer: https://gitlab.ddbuild.io -subject_pattern: "project_path:DataDog/java-profiler:ref_type:branch:ref:.*" +subject_pattern: "project_path:(DataDog/java-profiler|DataDog/apm-reliability/benchmarking-platform):ref_type:branch:ref:.*" permissions: contents: write diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83ce0def5..b0c73be46 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,7 @@ stages: - integration-test - reliability - benchmarks + - post-benchmarks - fuzz - notify diff --git a/.gitlab/benchmarks/.gitlab-ci.yml b/.gitlab/benchmarks/.gitlab-ci.yml index 960383af6..d1782cea4 100644 --- a/.gitlab/benchmarks/.gitlab-ci.yml +++ b/.gitlab/benchmarks/.gitlab-ci.yml @@ -2,13 +2,11 @@ variables: PREPARE_IMAGE: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:latest DD_OCTO_STS_IMAGE: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1 -.benchmark_job: - extends: .deploy-sa +# Bridge job: triggers the BP pipeline and blocks until it completes. +# Bridge jobs cannot appear in other jobs' needs: — downstream jobs use +# stage ordering (post-benchmarks stage runs after benchmarks stage). +benchmarks-trigger: stage: benchmarks - timeout: 6h - variables: - ITERATIONS: "${BENCHMARK_ITERATIONS:-1}" - MODES: "${BENCHMARK_MODES:-cpu,wall,alloc,memleak}" needs: - job: get-versions artifacts: true @@ -24,113 +22,47 @@ variables: - if: '$CI_PIPELINE_SOURCE == "web"' when: manual allow_failure: true - # Run automatically and non-blocking on any other source (push/trigger/api/ - # etc.) — mirrors the integration-test rules. The before_script CANCELLED - # gate skips branches with no open PR. + # Run automatically and non-blocking on any other source (push/trigger/api/etc.) - when: on_success allow_failure: true - script: | - # setup the env - export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :) - export CANDIDATE_VERSION=${CURRENT_VERSION} - export BASELINE_VERSION=${PREVIOUS_VERSION} - export PLATFORM_DIR=".benchmarks/platform" - - # check for missing candidate version - if [ -z "${CANDIDATE_VERSION}" ]; then echo "Missing candidate version. Skipping."; exit 0; fi - - # fetch the common platform scripts - git -c url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf="https://github.com/DataDog/" \ - clone --branch dd-trace-go https://github.com/DataDog/benchmarking-platform ${PLATFORM_DIR} - - # apply the specific step scripts - cp -r .gitlab/benchmarks/steps/* ${PLATFORM_DIR}/steps/ - chmod a+x ${PLATFORM_DIR}/steps/* - - # check for mode validity - ${PLATFORM_DIR}/steps/check_modes.sh - if [ "$(cat .job_status)" == "SKIP" ]; then exit 0; fi - - # run benchmarks - ${PLATFORM_DIR}/steps/capture-hardware-software-info.sh - ${PLATFORM_DIR}/steps/run-benchmarks.sh - ${PLATFORM_DIR}/steps/analyze-results.sh - ${PLATFORM_DIR}/steps/upload-results-to-s3.sh - parallel: - matrix: - - RUN_MODE: ["cpu", "wall", "alloc", "memleak", "cpu,wall", "memleak,alloc", "cpu,wall,alloc,memleak"] - artifacts: - when: always - name: "reports" - paths: - - reports/ - expire_in: 3 months - -benchmarks-candidate-amd64: - extends: .benchmark_job - tags: ["arch:amd64"] - image: $BENCHMARK_IMAGE_AMD64 - -benchmarks-candidate-aarch64: - extends: .benchmark_job - tags: ["arch:arm64"] - image: $BENCHMARK_IMAGE_ARM64 variables: - KUBERNETES_MEMORY_REQUEST: 200Gi - KUBERNETES_MEMORY_LIMIT: 200Gi + CANDIDATE_VERSION: "${CURRENT_VERSION}" + BASELINE_VERSION: "${PREVIOUS_VERSION}" + BENCHMARK_ITERATIONS: "${BENCHMARK_ITERATIONS:-5}" + BENCHMARK_MODES: "${BENCHMARK_MODES:-cpu,wall,alloc,memleak}" + DDPROF_COMMIT_SHA: "${CI_COMMIT_SHA}" + DDPROF_COMMIT_BRANCH: "${CI_COMMIT_BRANCH}" + UPSTREAM_PROJECT_NAME: "java-profiler" + UPSTREAM_BRANCH: "${CI_PIPELINE_ID}" + UPSTREAM_PIPELINE_ID: "${CI_PIPELINE_ID}" + trigger: + project: DataDog/apm-reliability/benchmarking-platform + branch: java-profiler + strategy: depend -post-benchmarks-pr-comment: - extends: .retry-config - stage: benchmarks - tags: ["arch:arm64"] - image: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1 - id_tokens: - DDOCTOSTS_ID_TOKEN: - aud: dd-octo-sts - needs: - - job: prepare:start - artifacts: true - - job: benchmarks-candidate-amd64 - artifacts: true - - job: benchmarks-candidate-aarch64 - artifacts: true - rules: - - if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null' - when: never - - if: '$CI_PIPELINE_SOURCE == "schedule"' - when: never - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - # Always run when the candidate jobs ran, regardless of source, so results - # are posted back to the PR. - - when: always - timeout: 5m - script: - - .gitlab/benchmarks/post-pr-comment.sh reports - allow_failure: true publish-benchmark-gh-pages: - stage: benchmarks + stage: post-benchmarks tags: ["arch:arm64"] image: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1 id_tokens: DDOCTOSTS_ID_TOKEN: aud: dd-octo-sts - needs: - - job: benchmarks-candidate-amd64 - artifacts: true - - job: benchmarks-candidate-aarch64 - artifacts: true + # Serialize concurrent GH Pages pushes. publish-gh-pages.sh uses + # 'git push --force'; two concurrent pushes race and the slower one + # silently discards the faster one's history update. + resource_group: gh-pages-publish rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' when: never - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "main"' when: always - timeout: 10m + timeout: 15m script: - - ./.gitlab/benchmarks/publish-gh-pages.sh + - mkdir -p reports + - .gitlab/benchmarks/download-s3-reports.sh reports + - ./.gitlab/benchmarks/publish-gh-pages.sh reports allow_failure: true include: - local: .gitlab/common.yml - - local: .gitlab/benchmarks/images.yml diff --git a/.gitlab/benchmarks/download-s3-reports.sh b/.gitlab/benchmarks/download-s3-reports.sh new file mode 100755 index 000000000..762062e7c --- /dev/null +++ b/.gitlab/benchmarks/download-s3-reports.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +# Downloads result JSONs from the BP downstream pipeline via the GitLab CI API. +# +# Requires only curl and python3 (stdlib) — no aws CLI, pip, or boto3 needed. +# BP jobs already store artifacts in GitLab; this fetches them directly from +# the downstream pipeline triggered by benchmarks-trigger. +set -uo pipefail # intentionally no -e: we handle errors explicitly + +DEST="${1:-reports}" +mkdir -p "${DEST}" + +TMPDIR_LOCAL=$(mktemp -d) +trap 'rm -rf "${TMPDIR_LOCAL}"' EXIT + +# ── helper: curl with explicit HTTP status checking ────────────────────────── +# Usage: api_get +# Returns 0 on 2xx, prints diagnostics and returns 1 otherwise. +api_get() { + local url="$1" out="$2" + local http_code + http_code=$(curl -s -o "${out}" -w "%{http_code}" \ + --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "${url}") + if [[ "${http_code}" != 2* ]]; then + echo " API ${url##*/}: HTTP ${http_code} — $(cat "${out}" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('message','?'))" 2>/dev/null || echo 'see above')" + return 1 + fi + return 0 +} + +# ── 1. find the benchmarks-trigger bridge ──────────────────────────────────── +BRIDGES_FILE="${TMPDIR_LOCAL}/bridges.json" +echo "Querying bridges for pipeline ${CI_PIPELINE_ID}…" +if ! api_get \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/bridges" \ + "${BRIDGES_FILE}"; then + echo "Cannot read pipeline bridges (job token may lack Reporter access) — skipping download" + exit 0 +fi + +read -r BP_PROJECT_ID DOWNSTREAM_PIPELINE_ID < <(python3 - "${BRIDGES_FILE}" <<'PYEOF' +import json, sys +with open(sys.argv[1]) as f: + bridges = json.load(f) +for b in bridges: + if b.get("name") == "benchmarks-trigger": + dp = b.get("downstream_pipeline") or {} + if dp.get("id") and dp.get("project_id"): + print(dp["project_id"], dp["id"]) + sys.exit(0) +print("", "") +PYEOF +) + +if [ -z "${DOWNSTREAM_PIPELINE_ID:-}" ]; then + echo "benchmarks-trigger bridge not found or did not run — skipping download" + exit 0 +fi +echo "BP downstream pipeline: project=${BP_PROJECT_ID} pipeline=${DOWNSTREAM_PIPELINE_ID}" + +# ── 2. list jobs in the downstream pipeline ────────────────────────────────── +JOBS_FILE="${TMPDIR_LOCAL}/jobs.json" +echo "Listing BP pipeline jobs…" +if ! api_get \ + "${CI_API_V4_URL}/projects/${BP_PROJECT_ID}/pipelines/${DOWNSTREAM_PIPELINE_ID}/jobs?per_page=100" \ + "${JOBS_FILE}"; then + echo "Cannot list BP pipeline jobs — skipping download" + exit 0 +fi + +JOB_IDS=$(python3 -c " +import json +with open('${JOBS_FILE}') as f: + print(' '.join(str(j['id']) for j in json.load(f))) +") + +# ── 3. download result_*.json from each job's artifact zip ─────────────────── +DOWNLOADED=0 +for JOB_ID in ${JOB_IDS}; do + ART_ZIP="${TMPDIR_LOCAL}/art_${JOB_ID}.zip" + ART_STATUS=$(curl -s -o "${ART_ZIP}" -w "%{http_code}" \ + --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \ + "${CI_API_V4_URL}/projects/${BP_PROJECT_ID}/jobs/${JOB_ID}/artifacts" 2>/dev/null) + if [[ "${ART_STATUS}" == 2* ]]; then + # -j: junk paths (strip artifacts/ prefix), -q: quiet, -o: overwrite + if unzip -q -j "${ART_ZIP}" "artifacts/result_*.json" -d "${DEST}/" 2>/dev/null; then + DOWNLOADED=$((DOWNLOADED + 1)) + fi + fi +done + +RESULT_COUNT=$(find "${DEST}" -name "result_*.json" | wc -l) +echo "result_*.json files: ${RESULT_COUNT} (from ${DOWNLOADED} BP job(s))" + +if [ "${RESULT_COUNT}" -eq 0 ]; then + echo "WARNING: no result JSONs found — BP jobs may not have run or produced artifacts yet" + exit 1 +fi diff --git a/.gitlab/benchmarks/post-pr-comment.sh b/.gitlab/benchmarks/post-pr-comment.sh deleted file mode 100755 index de410dff9..000000000 --- a/.gitlab/benchmarks/post-pr-comment.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# Post aggregated benchmark comparison results as a single PR comment. -# -# Expects all per-cell comparison-baseline-vs-candidate_*.md reports to be -# present under REPORTS_DIR (default: reports/). -# -# Required env: -# DDPROF_COMMIT_BRANCH – branch name used to locate the open PR -# Optional env: -# CI_PIPELINE_URL, DDPROF_COMMIT_SHA - -set -euo pipefail - -REPORTS_DIR="${1:-reports}" -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -# Aggregate all per-cell reports into a single comment body -SECTIONS="" -for md in "${REPORTS_DIR}"/comparison-baseline-vs-candidate_*.md; do - [ -f "${md}" ] || continue - label=$(basename "${md}" .md | sed 's/comparison-baseline-vs-candidate_//') - SECTIONS="${SECTIONS} -
${label} - -$(cat "${md}") - -
-" -done - -if [ -z "${SECTIONS}" ]; then - echo "No benchmark reports found under ${REPORTS_DIR} — skipping comment" - exit 0 -fi - -BODY_FILE=$(mktemp) -trap 'rm -f "${BODY_FILE}"' EXIT -cat > "${BODY_FILE}" </dev/null 2>&1 && pwd )" - -source ${DIR}/config-benchmark-analyzer.sh - -BASELINE_JSON=$(find $ARTIFACTS_DIR -name 'baseline*.json' 2>/dev/null) -CANDIDATE_JSON=$(find $ARTIFACTS_DIR -name 'candidate*.json' 2>/dev/null) - -# Append $SUFFIX for unique names to match the configurations -ARCH=`uname -m` -SUFFIX=$(echo "$RUN_MODE" | tr ',' '_') -SUFFIX=${ARCH}_${SUFFIX} - -benchmark_analyzer analyze \ - --format=html \ - --outpath="$ARTIFACTS_DIR/baseline-analysis_${SUFFIX}.html" \ - "${BASELINE_JSON}" - -benchmark_analyzer analyze \ - --format=html \ - --outpath="$ARTIFACTS_DIR/candidate-analysis_${SUFFIX}.html" \ - "${CANDIDATE_JSON}" - -benchmark_analyzer compare pairwise \ - --baseline='{"config":"baseline"}' \ - --candidate='{"config":"candidate"}' \ - --format=html \ - --outpath="$ARTIFACTS_DIR/comparison-baseline-vs-candidate_${SUFFIX}.html" \ - "${BASELINE_JSON}" "${CANDIDATE_JSON}" - -benchmark_analyzer compare pairwise \ - --baseline='{"config":"baseline"}' \ - --candidate='{"config":"candidate"}' \ - --format=md \ - --outpath="$ARTIFACTS_DIR/comparison-baseline-vs-candidate_${SUFFIX}.md" \ - "${BASELINE_JSON}" "${CANDIDATE_JSON}" diff --git a/.gitlab/benchmarks/steps/check_modes.sh b/.gitlab/benchmarks/steps/check_modes.sh deleted file mode 100755 index 1ca131de6..000000000 --- a/.gitlab/benchmarks/steps/check_modes.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -echo "Checking the requested modes [${MODES:=cpu,wall,alloc,memleak}] in [$RUN_MODE] ..." -RESULT="SKIP" -for MODE in ${MODES//,/$IFS}; do - echo ":: $MODE -< $RUN_MODE" - if [[ $RUN_MODE =~ .*?$MODE.* ]]; then - RESULT="CONTINUE" - break - fi -done -echo $RESULT > .job_status -if [ "$RESULT" == "SKIP" ]; then - echo "Skipping run for mode set: [$RUN_MODE]. It does not include any mode from ${MODES}." -fi \ No newline at end of file diff --git a/.gitlab/benchmarks/steps/config-benchmark-analyzer.sh b/.gitlab/benchmarks/steps/config-benchmark-analyzer.sh deleted file mode 100755 index 963472bc7..000000000 --- a/.gitlab/benchmarks/steps/config-benchmark-analyzer.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -export UNCONFIDENCE_THRESHOLD=1.5 -export DISABLE_NHST=1 -export CI_TYPE=theoretical -export MD_REPORT_ONLY_CHANGES=1 diff --git a/.gitlab/benchmarks/steps/mem_watch.sh b/.gitlab/benchmarks/steps/mem_watch.sh deleted file mode 100755 index 6b4e7e66d..000000000 --- a/.gitlab/benchmarks/steps/mem_watch.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash -set +x -ctl_file=$1 -out=$2 -while [ -f $ctl_file ]; do - pid=$(ps ax | grep 'java' | grep "${ctl_file}" | grep -v 'grep' | grep -v 'time' | sed -e 's/^[[:space:]]*//' | cut -f1 -d' ') - if [ -n "${pid}" ]; then - rss="$(cat /proc/${pid}/smaps_rollup | grep 'Rss:' | cut -f2 -d':' | sed -e 's/^[[:space:]]*//' | cut -f1 -d' ' 2>/dev/null)" - if [ -n "$rss" ]; then - echo "mem: $rss" | tee -a $out - fi - fi - sleep 5 -done \ No newline at end of file diff --git a/.gitlab/benchmarks/steps/run-benchmarks.sh b/.gitlab/benchmarks/steps/run-benchmarks.sh deleted file mode 100755 index 0e0f08d5e..000000000 --- a/.gitlab/benchmarks/steps/run-benchmarks.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail -HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -mkdir -p "${ARTIFACTS_DIR}" || : - -LATEST_VERSION="" # initially empty -retries=0 -if [ -z "$CANDIDATE_VERSION" ] || [ -z "$BASELINE_VERSION" ]; then - echo "Retrieving the latest released version ..." - while [ -z "$LATEST_VERSION" ] && [ $retries -lt 5 ]; do - # default to the latest released version - LATEST_VERSION=$(curl -s https://api.github.com/repos/DataDog/java-profiler/releases/latest | grep "tag_name" | cut -f2 -d: | sed -e "s#\"v_##g" | sed -e "s#\",##g" | sed -e "s# ##g") - if [ -z "$LATEST_VERSION" ]; then - echo "Can not retrieve the baseline version from Github. Waiting 10s ..." - sleep 10 - fi - retries=$((retries+1)) - done - if [ -z "$LATEST_VERSION" ]; then - echo "Unable to resolve the latest released version!" - exit 1 - fi -fi -CANDIDATE_VERSION=${CANDIDATE_VERSION:=$LATEST_VERSION} -BASELINE_VERSION=${BASELINE_VERSION:=$LATEST_VERSION} -RUN_MODE=${RUN_MODE:=cpu,wall} -MODES=${RUN_MODE} - -SUFFIX=$(echo "$MODES" | tr ',' '_') - -echo "Setting baseline to: $BASELINE_VERSION" -echo "Setting candidate version to: $CANDIDATE_VERSION" - -"${HERE}"/run_benchmark.sh --iterations ${BENCHMARK_ITERATIONS:-5} --version $CANDIDATE_VERSION --output $ARTIFACTS_DIR/candidate-$SUFFIX.json --modes "${RUN_MODE}" --config candidate - -if [ "$BASELINE_VERSION" != "$CANDIDATE_VERSION" ]; then - # run comparison against the baseline version, same profiling modes - "${HERE}"/run_benchmark.sh --iterations ${BENCHMARK_ITERATIONS:-5} --version $BASELINE_VERSION --output $ARTIFACTS_DIR/baseline-$SUFFIX.json --modes "${RUN_MODE}" --config baseline -else - # run comparison against the same version but with profiling disabled - "${HERE}"/run_benchmark.sh --iterations ${BENCHMARK_ITERATIONS:-5} --version $CANDIDATE_VERSION --output $ARTIFACTS_DIR/baseline-$SUFFIX.json --modes "" --config baseline -fi - diff --git a/.gitlab/benchmarks/steps/run_benchmark.sh b/.gitlab/benchmarks/steps/run_benchmark.sh deleted file mode 100755 index 5f8960d2c..000000000 --- a/.gitlab/benchmarks/steps/run_benchmark.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash - -# Install SDKMAN and JDK -export SDKMAN_DIR="/usr/local/sdkman" && curl -s "https://get.sdkman.io" | bash -source /usr/local/sdkman/bin/sdkman-init.sh -sdk install java 11.0.28-tem - -export JAVA_HOME=`sdk home java 11.0.28-tem` - -function usage() { - echo "./run_benchmark.sh --iterations (default 10) --version --output --modes (default 'cpu,wall') --config [candidate|baseline]" - echo "Modes are encoded as comma separated list of modes. Supported modes are: cpu, wall and alloc" -} - -HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -ITERATIONS=5 -MODES="cpu,wall" -while [ $# -gt 0 ]; do - case "$1" in - "--iterations") ITERATIONS=$2; shift; shift;; - "--version") VERSION=$2; shift; shift;; - "--output") JSON_OUTPUT=$2; shift; shift;; - "--modes") MODES=$2; shift; shift;; - "--config") CONFIG=$2; shift; shift;; - "--help") - usage - exit 0 - ;; - *) usage; exit 1;; - esac -done - -if [ -z "$VERSION" ] || [ -z "$JSON_OUTPUT" ] || [ -z "$CONFIG" ]; then - usage - exit 1 -fi - -JFR_DIR="${ARTIFACTS_DIR}/jfr" -TXT_OUTPUT="$JSON_OUTPUT.txt" - -mkdir -p $JFR_DIR - -CPU="off" -WALL="off" -ALLOC="off" -MEMLEAK="off" -for MODE in ${MODES//,/$IFS}; do - if [ "$MODE" == "cpu" ]; then - CPU_ARG="cpu=10m" - CPU="on" - elif [ "$MODE" == "wall" ]; then - WALL_ARG="wall=10m" - WALL="on" - elif [ "$MODE" == "alloc" ]; then - ALLOC_ARG="alloc=262144" - ALLOC="on" - elif [ "$MODE" == "memleak" ]; then - MEMLEAK_ARG="memleak=262144" - MEMLEAK="on" - fi -done - -mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \ - -DrepoUrl=https://central.sonatype.com/repository/maven-snapshots/ \ - -Dartifact=com.datadoghq:ddprof:$VERSION - -mkdir -p /var/lib/datadog/$VERSION -rm -rf /var/lib/datadog/$VERSION/* - - -# The directory contains platform specific profiling library -ARCH=`uname -m` -ARCH_DIR="" -if [ "$ARCH" == "x86_64" ]; then - ARCH_DIR=linux-x64 -elif [ "$ARCH" == "aarch64" ]; then - ARCH_DIR=linux-arm64 -fi - -unzip -q -d /var/lib/datadog/$VERSION /root/.m2/repository/com/datadoghq/ddprof/$VERSION/ddprof-$VERSION.jar -AGENT_LIB=$(find /var/lib/datadog/$VERSION -name 'libjavaProfiler.so' | fgrep ${ARCH_DIR}/) - -ls -la /var/lib/datadog/$VERSION/* -echo $AGENT_LIB - -JAVA_VERSION=$(cat $JAVA_HOME/release | fgrep 'JAVA_VERSION=' | cut -f2 -d'=') -if [ -z "$JAVA_VERSION" ]; then - JAVA_VERSION=$(cat $JAVA_HOME/release | fgrep 'JVM_VERSION=' | cut -f2 -d'=') -fi - -for test_item in 'dotty|-r 10' 'finagle-http|-r 4' 'finagle-chirper|-r 4' 'page-rank|-r 3' 'future-genetic|-r 5' 'akka-uct|-r 2' 'movie-lens|-r 3' 'scala-doku|-r 4' 'chi-square|-r 6' 'fj-kmeans|-r 15' 'dec-tree|-r 15' 'naive-bayes|-r 15' 'als|-r 10' 'par-mnemonics|-r 5' 'scala-kmeans|-r 60' 'philosophers|-r 2' 'log-regression|-r 30' 'gauss-mix|-r 8' 'mnemonics|-r 4' ; do - test=$(echo $test_item | cut -f1 -d'|') - param=$(echo $test_item | cut -f2 -d'|') - - echo "==== renaissance:$test (cpu=$CPU, wall=$WALL, alloc=$ALLOC, memleak=$MEMLEAK)" | tee -a $TXT_OUTPUT - echo "== config: $CONFIG" | tee -a $TXT_OUTPUT - echo "== ddprof: $VERSION" | tee -a $TXT_OUTPUT - echo "== java: $JAVA_VERSION" | tee -a $TXT_OUTPUT - - chmod a+x "${HERE}"/mem_watch.sh - for i in $( seq 1 $ITERATIONS ); do - if [ ! -z "$MODES" ]; then - AGENT_ARG="-agentpath:${AGENT_LIB}=start,jfr=7,file=${JFR_DIR}/${CONFIG}_${test}_${i}.jfr,jstackdepth=512,cstack=dwarf,safemode=0,$CPU_ARG,$WALL_ARG,$ALLOC_ARG,$MEMLEAK_ARG" - fi - - CONTROL_FILE=".running_${CONFIG}_${test}_${i}" - touch $CONTROL_FILE - "${HERE}"/mem_watch.sh $CONTROL_FILE $TXT_OUTPUT & - TIME=$(/usr/bin/time -f "# %e" java -Xms1g -Xmx1g -XX:+AlwaysPreTouch -Dctl=$CONTROL_FILE $AGENT_ARG -jar /var/lib/benchmarks/renaissance.jar $test $param 2>&1 | fgrep '#' | cut -f2 -d' ') - rm -f $CONTROL_FILE - - echo "time: $TIME" | tee -a $TXT_OUTPUT - done -done - -benchmark_analyzer convert \ - --framework=JavaProfilerRenaissance \ - --extra_params="{\"iterations\": \"${ITERATIONS}\", \"modes\": \"${MODES}\"}" \ - --outpath="$JSON_OUTPUT" \ - $TXT_OUTPUT