mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Apply More Core::RunAsCPUThread
In places where applicable, Core::RunAsCPUThread has replaced Core::SetState workarounds to pause and resume emulation for thread-sensitive operations. - void Core::SaveScreenShot() - void Core::SaveScreenShot(std::string_view name) - void JitInterface::GetProfileResults(Profiler::ProfileStats *prof_stats) - void MainWindow::OnExportRecording()
This commit is contained in:
@ -131,26 +131,22 @@ void GetProfileResults(Profiler::ProfileStats* prof_stats)
|
||||
prof_stats->timecost_sum = 0;
|
||||
prof_stats->block_stats.clear();
|
||||
|
||||
Core::State old_state = Core::GetState();
|
||||
if (old_state == Core::State::Running)
|
||||
Core::SetState(Core::State::Paused);
|
||||
Core::RunAsCPUThread([&prof_stats] {
|
||||
QueryPerformanceFrequency((LARGE_INTEGER*)&prof_stats->countsPerSec);
|
||||
g_jit->GetBlockCache()->RunOnBlocks([&prof_stats](const JitBlock& block) {
|
||||
const auto& data = block.profile_data;
|
||||
u64 cost = data.downcountCounter;
|
||||
u64 timecost = data.ticCounter;
|
||||
// Todo: tweak.
|
||||
if (data.runCount >= 1)
|
||||
prof_stats->block_stats.emplace_back(block.effectiveAddress, cost, timecost, data.runCount,
|
||||
block.codeSize);
|
||||
prof_stats->cost_sum += cost;
|
||||
prof_stats->timecost_sum += timecost;
|
||||
});
|
||||
|
||||
QueryPerformanceFrequency((LARGE_INTEGER*)&prof_stats->countsPerSec);
|
||||
g_jit->GetBlockCache()->RunOnBlocks([&prof_stats](const JitBlock& block) {
|
||||
const auto& data = block.profile_data;
|
||||
u64 cost = data.downcountCounter;
|
||||
u64 timecost = data.ticCounter;
|
||||
// Todo: tweak.
|
||||
if (data.runCount >= 1)
|
||||
prof_stats->block_stats.emplace_back(block.effectiveAddress, cost, timecost, data.runCount,
|
||||
block.codeSize);
|
||||
prof_stats->cost_sum += cost;
|
||||
prof_stats->timecost_sum += timecost;
|
||||
sort(prof_stats->block_stats.begin(), prof_stats->block_stats.end());
|
||||
});
|
||||
|
||||
sort(prof_stats->block_stats.begin(), prof_stats->block_stats.end());
|
||||
if (old_state == Core::State::Running)
|
||||
Core::SetState(Core::State::Running);
|
||||
}
|
||||
|
||||
int GetHostCode(u32* address, const u8** code, u32* code_size)
|
||||
|
Reference in New Issue
Block a user