aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/physical_core.cpp
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-28 16:44:24 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-28 16:44:24 -0400
commitcc3d73762a41dba370aadd3468cb510dcbc2b74d (patch)
tree32629e503c2cd1d64ce2353c76fb02585ce1d1cb /src/core/hle/kernel/physical_core.cpp
parent82a5b520bc6dc4a77acca9b3ddd0bc577ada5676 (diff)
Performance diagnostics and small wins for title 1
- eden-cli: SDL called SDL_AppIterate back to back, keeping a host core at 100% polling input; run the main callbacks at 240 Hz. - EDEN_NX2_IDLE_SPIN_US: optional spin before an idle core blocks (measured: no gain on title 1, so off by default). - EDEN_NX2_SVC_TRACE=<first>:<last>: trace SVCs (with thread ids) for a range of presents only. - MME DMA reads flush GPU-written memory first (never triggered on title 1, kept for correctness); render-enable override histogram instead of the first-400 log. Measured on title 1's title screen (RTX 4070 Laptop): GPU ~20% busy, the six emulated cores ~0.9 host cores in total, Eden's GPU thread 45-70% busy and largely waiting: on host fences for semaphore acquires (GPU accuracy High delays every release to host completion), on ASTC upload Finish(), and in a 1 ms poll sleep. gpu_accuracy=Low: ~12.5 -> ~16 fps.
Diffstat (limited to 'src/core/hle/kernel/physical_core.cpp')
-rw-r--r--src/core/hle/kernel/physical_core.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index c5236c64e3..c3ae7629aa 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -4,6 +4,9 @@
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <chrono>
+#include <cstdlib>
+#include <thread>
#include "common/scope_exit.h"
#include "common/settings.h"
#include "core/core.h"
@@ -222,8 +225,22 @@ void PhysicalCore::LogBacktrace(KernelCore& kernel) {
}
void PhysicalCore::Idle() {
+ // Guest job systems hand work between cores many times per frame; blocking at once adds the
+ // host's thread wake-up latency to every handoff. EDEN_NX2_IDLE_SPIN_US=<n>: poll for that
+ // many microseconds before blocking.
+ static const auto spin = std::chrono::microseconds{[] {
+ const char* text = std::getenv("EDEN_NX2_IDLE_SPIN_US");
+ return text ? std::strtoll(text, nullptr, 10) : 0LL;
+ }()};
+ if (spin.count() > 0) {
+ const auto deadline = std::chrono::steady_clock::now() + spin;
+ while (!m_is_interrupted.load(std::memory_order_acquire) &&
+ std::chrono::steady_clock::now() < deadline) {
+ std::this_thread::yield();
+ }
+ }
std::unique_lock lk{m_guard};
- m_on_interrupt.wait(lk, [this] { return m_is_interrupted; });
+ m_on_interrupt.wait(lk, [this] { return m_is_interrupted.load(); });
}
bool PhysicalCore::IsInterrupted() const {