fix(scripts): profile_report.py on Windows counts waits as running time and leaves the renderer's names mangled #1337
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
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/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#1337
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
What happens
scripts/profile_report.pymisreads a Windows profile from the profiling mode (#1279,HOS_PROFILE=1) in two ways. Found on the first Windows run of the mode (main @8e9cfc3a, Windows 11, Ryzen 9 3900X, RTX 3080 / NVIDIA 621.14,--maps <game folder>):Waits count as running time.
prof.waiting(scripts/prof.py) calls a sample a wait when its innermost frame of Longshot's ends with one ofWAIT_FRAMES. On Windows:ntdllundersleep_away(host/hos_thread.c) is not in the list;longshot_vk:_ZN5mkwvk12_GLOBAL__N_14waitEyy), soendswithnever matches a wait there.So the report's "hottest" on each thread leads with waiting:
sead::MainThread"running 49 %", hottestmkwvk::(anonymous)::wait6.7 % andsleep_away5.7 %; the Presentation Thread's hottest is__libcpp_condvar_timedwait, 7.8 %. Stutter attribution ("running far more in stutters") is skewed the same way.The renderer's names stay mangled (
_ZN5mkwvk12guarded_copyEPvPKvy):prof.demanglereads MSVC's?name@ns@@names only, and llvm-mingw'slongshot_vk.mapholds Itanium ones.Suggested fix
prof.waiting: on a Windows sample, a leaf in the system's own modules (ntdll.dll,KERNELBASE.dll,KERNEL32.DLL,win32u.dll) under a frame of Longshot's is a wait (a system call: sleeping, waiting, yielding), unless a known running frame says otherwise; and addsleep_away.prof.load_symbols: demangle the Itanium names of a Windows map once at load, with the toolchain'sllvm-cxxfiltwhen it is there (the Linux path already getsnm -C's names).A tools-only fix; the game is untouched. A PR follows. The game's crash on the same run is #383 (the sampler's unguarded stack walk).
🤖 Generated with Claude Code
Possibly related, for context: