diff options
| author | MoonEyes <ducoinbenjamin@yahoo.fr> | 2026-12-02 00:07:43 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-12-02 00:07:43 +0000 |
| commit | 5d06e4793ea69a58db72e6b05ab8a7f6fd64847c (patch) | |
| tree | 8c16d41764631f1cea97aa5f3f805b2bdcf35634 /scripts | |
| parent | ce08fea0af9be991b2b1fe1a6d3be5f3c9814aa4 (diff) | |
| parent | f4831896242ebadf893fe061b5467673d2970861 (diff) | |
Merge pull request #2967 from aznohonza/tools/cgroup-memory-peak
game_run_summary: record the run cgroup's memory peak
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/run_game_wine.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/run_game_wine.sh b/scripts/run_game_wine.sh index 96daae6d0..55acf853f 100755 --- a/scripts/run_game_wine.sh +++ b/scripts/run_game_wine.sh | |||
| @@ -245,6 +245,8 @@ else | |||
| 245 | fi | 245 | fi |
| 246 | export QT_QPA_PLATFORM=offscreen | 246 | export QT_QPA_PLATFORM=offscreen |
| 247 | DRM_SYSFS=${LEONIDA_DRM_SYSFS_DIR:-/sys/class/drm} | 247 | DRM_SYSFS=${LEONIDA_DRM_SYSFS_DIR:-/sys/class/drm} |
| 248 | CGROUP_SELF=${LEONIDA_SELF_CGROUP_PATH:-/proc/self/cgroup} | ||
| 249 | CGROUP_ROOT=${LEONIDA_CGROUP_ROOT:-/sys/fs/cgroup} | ||
| 248 | if [ -n "$DEVICE" ]; then | 250 | if [ -n "$DEVICE" ]; then |
| 249 | export MESA_VK_DEVICE_SELECT="$DEVICE!" | 251 | export MESA_VK_DEVICE_SELECT="$DEVICE!" |
| 250 | # kwin and Xwayland's glamor on the card that renders, so the present path stays on one device. | 252 | # kwin and Xwayland's glamor on the card that renders, so the present path stays on one device. |
| @@ -325,6 +327,13 @@ wait "$WATCH" 2>/dev/null || true | |||
| 325 | teardown; SESSION_PID= | 327 | teardown; SESSION_PID= |
| 326 | T1=$(date +%s) | 328 | T1=$(date +%s) |
| 327 | 329 | ||
| 330 | # The cgroup's peak memory (cgroup v2, kernel 5.19+): the run's own systemd scope when it has one (the unit | ||
| 331 | # also carries MemoryMax), else the caller's cgroup since it was created. Absent on cgroup v1: no line then. | ||
| 332 | cg_rel=$(sed -n 's/^0:://p' "$CGROUP_SELF" 2>/dev/null || true) | ||
| 333 | if [ -n "$cg_rel" ] && [ -r "$CGROUP_ROOT$cg_rel/memory.peak" ]; then | ||
| 334 | cat "$CGROUP_ROOT$cg_rel/memory.peak" > "$RUN/memory_peak" 2>/dev/null || rm -f "$RUN/memory_peak" | ||
| 335 | fi | ||
| 336 | |||
| 328 | echo "== $(tr '\n' ';' < "$RUN/session.txt" 2>/dev/null | sed 's/;$//')" | 337 | echo "== $(tr '\n' ';' < "$RUN/session.txt" 2>/dev/null | sed 's/;$//')" |
| 329 | if [ ! -f "$RUN/exit_code" ]; then | 338 | if [ ! -f "$RUN/exit_code" ]; then |
| 330 | echo "the run did not start or the session ended early ($((T1 - T0)) s); see $RUN/session.log" >&2 | 339 | echo "the run did not start or the session ended early ($((T1 - T0)) s); see $RUN/session.log" >&2 |