Profiler: works under Wine (no thread cycle counter, unnamed system functions, inlined calls without their path) #959
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/960"
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?
Imported from fxceless/victory-fork. Originally posted by UwUCammie on 2026-11-25T13:49:51Z.
What was wrong
Under Wine
VICTORY_PROFILE=1wrote a report with every number at zero: 328,651 looks, all of them counted as failed, no stack taken and an empty.foldedfile. Three things in Wine's libraries differ from Windows:QueryThreadCycleTimeis a stub that fails for every thread. A look took the failure for "the thread ended" and returned before taking the stack.ntdll.dll+0x..., so no wait was recognised as one.lock,wait,wait_on_address), where Windows gives the whole path. The language's runtime was then taken for code of ours, and a wait was given towait_on_addressinstead of the function that waited.What the change does
GetThreadTimes) from one scan to the next, and the report says in its header that "on cpu" is not known.exports_of: a bounded read of the loaded image's export directory, forwarders left out).library/std/src/sync/mutex.rsisstd::sync::mutex,crates/victory-gpu/src/draw.rsisvictory_gpu::draw. Files anywhere else are left as they are.Where the counter answers and the names come with their paths, as on Windows, none of the three paths is taken.
How it was tested
RX 7900 XT, RADV (Mesa 26.3.1), Wine 11.22 with vkd3d-proton from GE-Proton11-14.
cargo test -p victory-gpu --features diagnostics --locked profile::under Wine: 10 passed, 1 ignored (the measurement). Before the changetime_goes_to_the_function_that_spent_itandthe_sampler_finds_threads_and_writes_its_filesfailed there. One assertion of the first is now made only where the counter exists (a waiting thread is not suspended again): without the counter nothing says a thread has not run.a_source_file_says_whose_inlined_code_it_isis new.cargo clippy -p victory-gpu --features diagnostics --all-targets --locked: the same 5 warnings with and without the change, none inprofile.rs.VICTORY_PROFILE_HZ=250:and the tables name the waits (
ntdll!NtWaitForSingleObject,ntdll!NtWaitForAlertByThreadId) and the system calls (ntdll!NtReadVirtualMemory,ntdll!NtWriteVirtualMemory,ntdll!NtProtectVirtualMemory).A look costs more under Wine (suspending a thread and reading its registers are requests to the wineserver, about 78 us on average here), so 250 looks a second is a better rate there than the default 1,000.
Not tested: native Windows. I have no Windows machine; a run of the profiler tests there by someone who has would be welcome.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.