Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
26 lines
1.3 KiB
Bash
Executable File
26 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# What does the switch cost on a machine that used to get Serial? 1 CPU, 2 GB, three runs each.
|
|
# Timing is indicative only: one shared machine, one process per run. Read the SHAPE, not the digits.
|
|
# ./scripts/g1-cost.sh -> docs/output/04-g1-cost-1cpu.txt (4000 batches, ~6-8 s per run)
|
|
# BATCHES=400 OUTNAME=05-g1-cost-1cpu-short.txt ./scripts/g1-cost.sh (a short-lived process, e.g. a CI job)
|
|
set -euo pipefail
|
|
source "$(dirname "$0")/env.sh"
|
|
BUILD="$ROOT/build/g1"; mkdir -p "$BUILD"
|
|
"$JDK27/bin/javac" --release 26 -d "$BUILD" "$ROOT"/g1-container/src/*.java
|
|
RUNS="${RUNS:-3}"; BATCHES="${BATCHES:-4000}"; OUTNAME="${OUTNAME:-04-g1-cost-1cpu.txt}"
|
|
{
|
|
echo "# Allocation workload, 1 CPU / 2 GB container, $BATCHES batches x 50,000 objects, $RUNS runs per configuration (indicative, not a benchmark)"
|
|
echo "# 'default' means nobody passed a collector flag."
|
|
echo
|
|
for cfg in "$IMG26|" "$IMG27|" "$IMG27|-XX:+UseSerialGC"; do
|
|
img="${cfg%%|*}"; flag="${cfg##*|}"
|
|
for i in $(seq 1 "$RUNS"); do
|
|
echo "=== $img ${flag:-default} run $i"
|
|
docker run --rm --cpus=1 --memory=2g -v "$BUILD:/app:ro" "$img" \
|
|
java $flag -cp /app Workload "$BATCHES" | grep -v -E '^allocated'
|
|
done
|
|
echo
|
|
done
|
|
} > "$OUT/$OUTNAME" 2>&1
|
|
cat "$OUT/$OUTNAME"
|