Files
darling-lol/tools/riot_build_gate.py
T
lucannez64andClaude Opus 5.5 4370f375cd Cut Darling overhead in League fights and add passive match capture
Game process (ARAM Hexgate: 84 -> 127 FPS average, slowest stretches ~110):
- Local pthread mutexes, condition variables and Mach semaphores are on by
  default in the game process only, with /tmp/rclol-no-local-* opt-outs.
  The main thread's darlingserver waits fell from 1.36 to 0.10 ms per frame.
- Local semaphores: the count and the slot generation change in one
  compare-exchange, a destroy leaves a negative marker, the table is reset
  after fork, and names the table did not create go to the server.
- Metal: drop identical re-binds (keyed on the Indium object, depth-stencil
  retained), pass blit resources by reference, and stop resetting vertex
  descriptors twice.
- Core isolation of the main thread is opt-in (/tmp/rclol-core-isolation);
  it lowered FPS in its only match.
- Optimized libc/libc++/Foundation overlays, AVX2 string primitives, real CPU
  topology and their installers and offline checks.

Tools and docs:
- tools/riot-match-capture: passive /proc sampler, user-space IP profiler and
  reports, plus a comparison against the game's netstats.
- tools/riot-lsem-model and tools/riot-metal-bind-model: host models that
  extract the shipped code and check it.
- tools/install-riot-metal-pair.sh installs Metal and Indium together.
- Status, setup, testing and troubleshooting docs updated with the measured
  matches and the switch table; manifest file counts match the patches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 16:48:34 +02:00

47 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Stop background compilation while a League game is running.
The user measures FPS in real matches, and a compile job on this six-core
machine would skew the result. Only /proc/<pid>/cmdline is read: no signal is
sent, nothing is attached to, and no process is started or stopped. The match
is on the exact argv element of the game binary, so the gate's own command line
does not match.
"""
import sys
import time
from pathlib import Path
GAME_EXECUTABLE = "Contents/MacOS/LeagueofLegends"
def game_running():
for entry in Path("/proc").iterdir():
if not entry.name.isdigit():
continue
try:
command_line = (entry / "cmdline").read_bytes()
except OSError:
continue
for argument in command_line.split(b"\0"):
if argument.endswith(b"/" + GAME_EXECUTABLE.encode()):
return True
return False
def wait_until_free(poll_seconds=20):
"""Block until no game process is left, reporting each wait."""
if not game_running():
return
print("A League game is running; waiting for it to exit before compiling.", flush=True)
while game_running():
time.sleep(poll_seconds)
print("No game process left; compiling.", flush=True)
if __name__ == "__main__":
if game_running():
print("game running")
sys.exit(0)
print("no game process")
sys.exit(1)