Minor updates
All checks were successful
eden-license / license-header (pull_request) Successful in 17s

This commit is contained in:
Gamer64 2025-08-02 16:39:51 +02:00 committed by crueter
parent c4254acbd4
commit 605190e914
6 changed files with 16 additions and 8 deletions

View file

@ -956,19 +956,17 @@ void System::RegisterHostThread() {
impl->kernel.RegisterHostThread(); impl->kernel.RegisterHostThread();
} }
void System::EnterCPUProfile() {
#if MICROPROFILE_ENABLED #if MICROPROFILE_ENABLED
void System::EnterCPUProfile() {
std::size_t core = impl->kernel.GetCurrentHostThreadID(); std::size_t core = impl->kernel.GetCurrentHostThreadID();
impl->dynarmic_ticks[core] = MicroProfileEnter(impl->microprofile_cpu[core]); impl->dynarmic_ticks[core] = MicroProfileEnter(impl->microprofile_cpu[core]);
#endif
} }
void System::ExitCPUProfile() { void System::ExitCPUProfile() {
#if MICROPROFILE_ENABLED
std::size_t core = impl->kernel.GetCurrentHostThreadID(); std::size_t core = impl->kernel.GetCurrentHostThreadID();
MicroProfileLeave(impl->microprofile_cpu[core], impl->dynarmic_ticks[core]); MicroProfileLeave(impl->microprofile_cpu[core], impl->dynarmic_ticks[core]);
#endif
} }
#endif
bool System::IsMulticore() const { bool System::IsMulticore() const {
return impl->is_multicore; return impl->is_multicore;

View file

@ -396,11 +396,13 @@ public:
/// Register a host thread as an auxiliary thread. /// Register a host thread as an auxiliary thread.
void RegisterHostThread(); void RegisterHostThread();
#if MICROPROFILE_ENABLED
/// Enter CPU Microprofile /// Enter CPU Microprofile
void EnterCPUProfile(); void EnterCPUProfile();
/// Exit CPU Microprofile /// Exit CPU Microprofile
void ExitCPUProfile(); void ExitCPUProfile();
#endif
/// Tells if system is running on multicore. /// Tells if system is running on multicore.
[[nodiscard]] bool IsMulticore() const; [[nodiscard]] bool IsMulticore() const;

View file

@ -1278,17 +1278,15 @@ void KernelCore::ExceptionalExitApplication() {
SuspendEmulation(true); SuspendEmulation(true);
} }
void KernelCore::EnterSVCProfile() {
#if MICROPROFILE_ENABLED #if MICROPROFILE_ENABLED
void KernelCore::EnterSVCProfile() {
impl->svc_ticks[CurrentPhysicalCoreIndex()] = MicroProfileEnter(MICROPROFILE_TOKEN(Kernel_SVC)); impl->svc_ticks[CurrentPhysicalCoreIndex()] = MicroProfileEnter(MICROPROFILE_TOKEN(Kernel_SVC));
#endif
} }
void KernelCore::ExitSVCProfile() { void KernelCore::ExitSVCProfile() {
#if MICROPROFILE_ENABLED
MicroProfileLeave(MICROPROFILE_TOKEN(Kernel_SVC), impl->svc_ticks[CurrentPhysicalCoreIndex()]); MicroProfileLeave(MICROPROFILE_TOKEN(Kernel_SVC), impl->svc_ticks[CurrentPhysicalCoreIndex()]);
#endif
} }
#endif
Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() { Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() {
return impl->slab_resource_counts; return impl->slab_resource_counts;

View file

@ -271,9 +271,11 @@ public:
bool IsShuttingDown() const; bool IsShuttingDown() const;
#if MICROPROFILE_ENABLED
void EnterSVCProfile(); void EnterSVCProfile();
void ExitSVCProfile(); void ExitSVCProfile();
#endif
/// Workaround for single-core mode when preempting threads while idle. /// Workaround for single-core mode when preempting threads while idle.
bool IsPhantomModeForSingleCore() const; bool IsPhantomModeForSingleCore() const;

View file

@ -27,7 +27,9 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
interface->Initialize(); interface->Initialize();
const auto EnterContext = [&]() { const auto EnterContext = [&]() {
#if MICROPROFILE_ENABLED
system.EnterCPUProfile(); system.EnterCPUProfile();
#endif
// Lock the core context. // Lock the core context.
std::scoped_lock lk{m_guard}; std::scoped_lock lk{m_guard};
@ -59,7 +61,9 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
m_arm_interface = nullptr; m_arm_interface = nullptr;
m_current_thread = nullptr; m_current_thread = nullptr;
#if MICROPROFILE_ENABLED
system.ExitCPUProfile(); system.ExitCPUProfile();
#endif
}; };
while (true) { while (true) {

View file

@ -4428,7 +4428,9 @@ void Call(Core::System& system, u32 imm) {
std::array<uint64_t, 8> args; std::array<uint64_t, 8> args;
kernel.CurrentPhysicalCore().SaveSvcArguments(process, args); kernel.CurrentPhysicalCore().SaveSvcArguments(process, args);
#if MICROPROFILE_ENABLED
kernel.EnterSVCProfile(); kernel.EnterSVCProfile();
#endif
if (process.Is64Bit()) { if (process.Is64Bit()) {
Call64(system, imm, args); Call64(system, imm, args);
@ -4436,7 +4438,9 @@ void Call(Core::System& system, u32 imm) {
Call32(system, imm, args); Call32(system, imm, args);
} }
#if MICROPROFILE_ENABLED
kernel.ExitSVCProfile(); kernel.ExitSVCProfile();
#endif
kernel.CurrentPhysicalCore().LoadSvcArguments(process, args); kernel.CurrentPhysicalCore().LoadSvcArguments(process, args);
} }