Fix run-benchmarks script referencing variables before they are defined

This commit is contained in:
Hugo Locurcio
2025-07-01 17:21:07 +02:00
parent ba30c2346e
commit 8c78452842

View File

@@ -194,37 +194,51 @@ $GODOT_RELEASE --audio-driver Dummy --gpu-index 1 -- --run-benchmarks --include-
$GODOT_RELEASE --audio-driver Dummy --gpu-index 0 -- --run-benchmarks --include-benchmarks="rendering/*" --save-json="/tmp/intel.md" --json-results-prefix="intel"
$GODOT_RELEASE --audio-driver Dummy --gpu-index 2 -- --run-benchmarks --include-benchmarks="rendering/*" --save-json="/tmp/nvidia.md" --json-results-prefix="nvidia"
# Strip debugging symbols for fair binary size comparison.
# Do this after Godot is run so we can have useful crash backtraces
# if the engine crashes while running benchmarks.
strip "$GODOT_DEBUG" "$GODOT_RELEASE"
BINARY_SIZE_DEBUG="$(stat --printf="%s" "$GODOT_DEBUG")"
BINARY_SIZE_RELEASE="$(stat --printf="%s" "$GODOT_RELEASE")"
echo "Appending extra benchmarks."
EXTRA_JSON=$(cat << EOF
"benchmarks": [
{
"category": "Extra/Size",
"name": "Binary Size",
"results": {"cpu_debug": {"size_bytes":$BINARY_SIZE_DEBUG}, "cpu_release": {"size_bytes": $BINARY_SIZE_RELEASE}}
}, {
"results": { "cpu_debug": { "size_bytes": $BINARY_SIZE_DEBUG}, "cpu_release": { "size_bytes": $BINARY_SIZE_RELEASE } }
},
{
"category": "Extra/Build Time",
"name": "Build Time",
"results": {"cpu_debug": {"time":$TIME_TO_BUILD_DEBUG}, "cpu_release": {"time": $TIME_TO_BUILD_RELEASE}}
}, {
"results": { "cpu_debug": { "time": $TIME_TO_BUILD_DEBUG}, "cpu_release": { "time": $TIME_TO_BUILD_RELEASE } }
},
{
"category": "Extra/Build Memory Use",
"name": "Build Peak Memory Use",
"results": {"cpu_debug": {"ram_bytes":$PEAK_MEMORY_BUILD_DEBUG}, "cpu_release": {"ram_bytes": $PEAK_MEMORY_BUILD_RELEASE}}
}, {
"results": { "cpu_debug": { "ram_bytes": $PEAK_MEMORY_BUILD_DEBUG}, "cpu_release": { "ram_bytes": $PEAK_MEMORY_BUILD_RELEASE } }
},
{
"category": "Extra/Startup Time",
"name": "Startup + Shutdown Time",
"results": {"cpu_debug": {"time":$TIME_TO_STARTUP_SHUTDOWN_DEBUG}, "cpu_release": {"time": $TIME_TO_STARTUP_SHUTDOWN_RELEASE}}
}, {
"results": { "cpu_debug": { "time": $TIME_TO_STARTUP_SHUTDOWN_DEBUG}, "cpu_release": { "time": $TIME_TO_STARTUP_SHUTDOWN_RELEASE } }
},
{
"category": "Extra/Startup Time",
"name": "Startup Time With Shader Cache",
"results": {"cpu_debug": {"time":$TIME_TO_STARTUP_SHADER_CACHE}, "cpu_release": {"time": $TIME_TO_STARTUP_SHADER_CACHE}}
}, {
"results": { "cpu_debug": { "time": $TIME_TO_STARTUP_SHADER_CACHE}, "cpu_release": { "time": $TIME_TO_STARTUP_SHADER_CACHE } }
},
{
"category": "Extra/Startup Time",
"name": "Startup Time Without Shader Cache",
"results": {"cpu_debug": {"time":$TIME_TO_STARTUP_NO_SHADER_CACHE}, "cpu_release": {"time": $TIME_TO_STARTUP_NO_SHADER_CACHE}}
}, {
"results": { "cpu_debug": { "time": $TIME_TO_STARTUP_NO_SHADER_CACHE}, "cpu_release": { "time": $TIME_TO_STARTUP_NO_SHADER_CACHE } }
},
{
"category": "Extra/Memory Use",
"name": "Startup + Shutdown Peak Memory Use",
"results": {"cpu_debug": {"ram_bytes":$PEAK_MEMORY_STARTUP_SHUTDOWN_DEBUG}, "cpu_release": {"ram_bytes": $PEAK_MEMORY_STARTUP_SHUTDOWN_RELEASE}}
"results": { "cpu_debug": { "ram_bytes": $PEAK_MEMORY_STARTUP_SHUTDOWN_DEBUG}, "cpu_release": { "ram_bytes": $PEAK_MEMORY_STARTUP_SHUTDOWN_RELEASE } }
}
]
EOF
@@ -244,14 +258,6 @@ $GODOT_DEBUG --headless --path "$DIR" --script merge_json.gd -- /tmp/cpu_debug.m
OUTPUT_PATH="/tmp/godot-benchmarks-results/${DATE}_${COMMIT_HASH}.md"
rm -f "$OUTPUT_PATH"
# Strip debugging symbols for fair binary size comparison.
# Do this after Godot is run so we can have useful crash backtraces
# if the engine crashes while running benchmarks.
strip "$GODOT_DEBUG" "$GODOT_RELEASE"
BINARY_SIZE_DEBUG="$(stat --printf="%s" "$GODOT_DEBUG")"
BINARY_SIZE_RELEASE="$(stat --printf="%s" "$GODOT_RELEASE")"
# Build website files after running all benchmarks, so that benchmarks
# appear on the web interface.
echo "Pushing results to godot-benchmarks repository."