Files
darling-lol/tools/build-riot-host-vdso-clock-check.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

26 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Build the host-only vDSO clock check against Darling's actual clock source."""
from pathlib import Path
import subprocess
project = Path(__file__).resolve().parent.parent
folder = project / "build/logs/vdso-clock"
headers = project / "build/darling-src/src/external/xnu/darling/src/libsystem_kernel/emulation/include"
sdk = project / "build/darling-src/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
alias = folder / "include/darling/emulation"
alias.parent.mkdir(parents=True, exist_ok=True)
if not alias.exists():
alias.symlink_to(headers, target_is_directory=True)
if alias.resolve() != headers.resolve():
raise RuntimeError("Unexpected host-test header alias")
# The real source includes <elfcalls.h>; copy just that one SDK header instead of
# adding the whole macOS SDK to the host include path.
bridge = folder / "include/elfcalls.h"
bridge.write_bytes((sdk / "elfcalls.h").read_bytes())
source = project / "build/darling-src/src/external/xnu/darling/src/libsystem_kernel/emulation/src/linux_premigration/ext/clock_gettime.c"
binary = folder / "host-vdso-clock-check"
subprocess.run(["cc", "-std=gnu11", "-O2", "-pthread", "-I", str(folder / "include"),
str(project / "tools/riot-host-vdso-clock-check.c"), str(source),
"-ldl", "-o", str(binary)], check=True)
print("Built", binary)