#!/usr/bin/env bash # Reproduces the main flagship recording: start a profile-settings recording, # drive real load, take a mid-flight snapshot to a DIFFERENT file (never the # recording's own destination -- see docs/output/09-dump-duplication-bug.txt # for what goes wrong if you do), then stop with its own filename. # # Usage: scripts/capture-jfr.sh set -euo pipefail cd "$(dirname "$0")/.." PID="${1:?usage: capture-jfr.sh }" mkdir -p recordings jcmd "$PID" JFR.start name=live settings=profile maxsize=256m scripts/load.sh cpu scripts/load.sh alloc scripts/load.sh lock jcmd "$PID" JFR.dump name=live filename="$(pwd)/recordings/mid-flight-snapshot.jfr" scripts/load.sh orders jcmd "$PID" JFR.stop name=live filename="$(pwd)/recordings/live-demo.jfr" echo "wrote recordings/live-demo.jfr and recordings/mid-flight-snapshot.jfr"