chore(scripts): cover.py records which lifted functions a play session runs, and when #419
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!419
Loading…
Reference in a new issue
No description provided.
Delete branch "madebyjordan/Longshot:feat/coverage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The clang-free cold tier proposed in #362 needs a hot list that covers what play actually runs. Nobody could measure that, because the profiler (
HOS_SAMPLE_ALL) sees only where time goes, not every function that runs once. This adds a tool that records which lifted functions a real play session runs, and when each first ran.What changed
scripts/coverage/cover.py(new).run <game folder>startsbin\longshot.exethe way the launcher's Play does, withcover_dll.cloaded before its entry point, and waits for the game to end (or--seconds).f_<guest address>, viallvm-nm). The DLL is compiled from source with the launcher's llvm-mingw.report <run folder>gives the functions that ran, their share of the host code, and, with--gen(the lifted C) or--csize, their share of the lifted C and of its compile cost.nx2/chunks.py's model (size + size²/350000), scaled by--compiler-sto the whole lifted C's -O1 compiler-seconds. The default is 6,478, measured in nightly-34's first build on a Ryzen 5 5600.--hotadds how much of a session a given hot list covers.covered.txtlists the functions in first-run order.compare <listed run> <played run>: one session's functions treated as a shipped list, and another session played against it. It counts what the second session runs that the list lacks, and when.reportandcomparework on any OS.runis Windows only.scripts/coverage/cover_dll.c(new).int3over the first byte of each listed function.cover.bin(temp file, then rename).tests/test_coverage_report.py(new, any OS) checksreportandcompareon a made-up run folder: counts, the compile-cost model, the marks,covered.txt's order, a hot list's cover and compare's misses. It also checks thatcover_dll.cwrites the headerread_coverreads.tests/test_coverage_run.py(new, Windows,--cc clangfrom llvm-mingw) builds a stand-in game with fourf_functions, two of them called, and runs it under the real DLL. Exactly the two called functions must be marked, in the order they first ran, and the game must end normally.docs/development.md, a row in the commands table.Flags and settings
cover.py --compiler-s <n>(new, a script option)Measurements
A development tool that the game doesn't run, so it's measured by its game-free checks and by one real session.
main:
5e072fc8(2026-11-14)this PR: feat/coverage @
12472833Hardware: Ryzen 5 5600, 16 GB, AMD Radeon RX 6700 XT, Windows 11
Scene: nightly-130 (
0caf0618) as the launcher built it, played by a person for 100 minutes from boot, reaching play at 1:48.Method:
cover.py run <game folder> --gen <a recent main lift's sa/gen> --hot <the shipped hot_order.txt>. The session results are posted on #362 (#362 (comment)).How to reproduce: the command above on any built game folder on Windows. Close the game normally to finish.
5e072fc812472833tests/test_coverage_report.py,tests/test_coverage_run.pytests/run_all.py --jobs 40caf0618; the 6 below)Testing
Tested:
--secondsduring development. The session ran the tool as it was before this PR's last edits:runandreportare the same apart from--compiler-s, which took the place of the fixed 6,478, and the Windows-only parts, which are now kept out of the way on other OSes.test_coverage_run.pyruns the final version end to end.python -I -B tests/run_all.py --jobs 4on this branch.Not tested:
reportandcompareon Linux: they use only the standard library, andtest_coverage_report.pyruns there.runis Windows only, and says so:cover_dll.cis a Windows development DLL, not part of the game, and takes its paths as wide characters (theWcalls), so UTF-8 folder names work.run(for example under the launcher with its own arguments):--argsand--envpass those on, but that wasn't exercised.Needs other testers:
None: a development tool, which players don't run.
Screenshots
Nothing on screen.
Risk and rollback
%LOCALAPPDATA%\LongshotCover\<date-time>) is offsets, names (guest addresses) and times: no game code or data. The--gensizes are read locally and only counts are written.Issues
For #362 (sizing the cold tier's hot list).
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.WIP: chore(scripts): cover.py records which lifted functions a play session runs, and whento chore(scripts): cover.py records which lifted functions a play session runs, and whenView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.