Something went wrong. Try again.
Backend environment for match hosting for lance.blue
Something went wrong. Try again.
Shell
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#!/usr/bin/env bash# Density benchmark: N concurrent games in one JVM, sampling memory.## MM_HOME extracted MegaMek release# JAVA_HOME a JDK# MM_JAR defaults to the stock jar; point at the patched one to compare## ./tests/bench.sh --games 8 --settle-round 3 --csv /tmp/out.csv# python3 tests/summarize.py /tmp/out.csv## Not part of ./test.sh - it takes minutes and wants a quiet machine. It answers# a question about the product (how many matches fit on a box) rather than# gating a change.## NOTE: this needs a JDK and an extracted MegaMek release, neither of which# exists outside the Docker build now that the host build is gone. Run it inside# a build stage, e.g.## docker build --target arena -t arena-build .# docker run --rm arena-build /src/tests/bench.sh --games 2## See TODO.md - giving it a first-class way to run is outstanding.## The numbers it produced for the spike: ~730MB RSS per concurrent match, flat# across heap cap and match size, with CPU well short of the constraint.set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"ROOT="$(cd "$HERE/.." && pwd)": "${MM_HOME:?MM_HOME is required}": "${JAVA_HOME:?JAVA_HOME is required}"
HEAP="${HEAP:-6g}"MM_JAR="${MM_JAR:-$MM_HOME/MegaMek.jar}"CLASSES="${CLASSES:-/tmp/bench-classes}"
[ -d "$CLASSES" ] || OUT="$CLASSES" "$HERE/build.sh"
CP="$CLASSES:$MM_JAR"for jar in "$MM_HOME"/lib/*.jar; do CP="$CP:$jar"; done
# MegaMek resolves data/ relative to the working directory.cd "$MM_HOME"
exec "$JAVA_HOME/bin/java" \ -Xmx"$HEAP" \ -Dlog4j2.configurationFile="$ROOT/megamek/log4j2-quiet.xml" \ -Dsentry.dsn="" \ --add-opens java.base/java.util=ALL-UNNAMED \ --add-opens java.base/java.util.concurrent=ALL-UNNAMED \ -classpath "$CP" \ bench.MMBench "$@"