New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JitCache: Software Profiling Restoration #12691
JitCache: Software Profiling Restoration #12691
Conversation
82f8be8
to
1f18c2f
Compare
Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
Outdated
Show resolved
Hide resolved
dcc402a
to
599f3d0
Compare
Rekindle software JIT profiling with a std::chrono conversion and a config connection.
599f3d0
to
94712ea
Compare
Just realized that, while it is possible to enable profiling without the debugging interface on desktop, it isn't possible to write the JIT block log dump in that situation. This limits profiling the JIT on desktop to just when other debugging features are also being put into recompiled code (mainly BranchWatch, but also some differences in JitAsm) . It might be worth looking into this limitation in the future. |
Software JIT profiling unceremoniously had its beginning in 2008, with a monolithic commit practically sneaking it in (ff0a613) and a follow-up commit to grant it life (0ba3948). Over the years, it was improved to support POSIX platforms (#1408) and followed the development of new JITs (#1224) (#1559) (#2429). Unfortunately, in the present day software JIT profiling has been left inaccessible on all fronts.
Last seen: June 29, 2018
In May 2015, an Android interface for software JIT profiling was added, but to my knowledge, was never used (#2394). In June 2018, DolphinWX was removed, leaving software JIT profiling inaccessible to desktop users (#6819). In April 2022, the code for software JIT profiling was repurposed for the Code Diff Tool (#8732). In March 2024, the Code Diff Tool was replaced by the Branch Watch Tool, leaving software JIT profiling once again unused (#12359).
I learned about software JIT profiling from my development of the aforementioned Branch Watch Tool and made it my mission to revive this dormant debugging feature of Dolphin's JITs. But I wasn't satisfied with simply hooking up old code with new code. With care, I have renovated software JIT profiling to use the chrono library to cut down on cross-platform complexity. From simple testing, there appears to be no discernible difference in performance between using
std::chrono::steady_clock
and using platform-native libraries such asQueryPerformanceCounter
andclock_gettime
. The MSVC STL steady_clock is even reportedly a wrapper for QueryPerformanceCounter. Still, if you would like to compare for yourself, simply change the following line to initialize theprofile_blocks
member as true and measure the max emulation speed before and after:dolphin/Source/Core/Core/PowerPC/JitCommon/JitBase.h
Line 89 in 116da3a
Software JIT profiling is a useful tool for understanding what parts of the JIT are eating up the most resources. It is true that the JITs support platform-specific profiling tools like Intel VTune and OProfile, but a built-in cross-platform alternative has its own merits. For that reason, I choose to rekindle this feature rather than extinguish it.