Browse Source

Add more microprofile checks

Thanks yuzu for spamming microprofile
pull/179/head
Gamer64 8 months ago
committed by crueter
parent
commit
0afce53e5f
  1. 8
      src/core/core.cpp
  2. 4
      src/core/core_timing.cpp
  3. 4
      src/core/cpu_manager.cpp
  4. 2
      src/yuzu_cmd/yuzu.cpp

8
src/core/core.cpp

@ -289,10 +289,12 @@ struct System::Impl {
exit_locked = false; exit_locked = false;
exit_requested = false; exit_requested = false;
#if MICROPROFILE_ENABLED
microprofile_cpu[0] = MICROPROFILE_TOKEN(ARM_CPU0); microprofile_cpu[0] = MICROPROFILE_TOKEN(ARM_CPU0);
microprofile_cpu[1] = MICROPROFILE_TOKEN(ARM_CPU1); microprofile_cpu[1] = MICROPROFILE_TOKEN(ARM_CPU1);
microprofile_cpu[2] = MICROPROFILE_TOKEN(ARM_CPU2); microprofile_cpu[2] = MICROPROFILE_TOKEN(ARM_CPU2);
microprofile_cpu[3] = MICROPROFILE_TOKEN(ARM_CPU3); microprofile_cpu[3] = MICROPROFILE_TOKEN(ARM_CPU3);
#endif
if (Settings::values.enable_renderdoc_hotkey) { if (Settings::values.enable_renderdoc_hotkey) {
renderdoc_api = std::make_unique<Tools::RenderdocAPI>(); renderdoc_api = std::make_unique<Tools::RenderdocAPI>();
@ -573,7 +575,9 @@ struct System::Impl {
std::stop_source stop_event; std::stop_source stop_event;
std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{};
#if MICROPROFILE_ENABLED
std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_cpu{}; std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_cpu{};
#endif
std::array<Core::GPUDirtyMemoryManager, Core::Hardware::NUM_CPU_CORES> std::array<Core::GPUDirtyMemoryManager, Core::Hardware::NUM_CPU_CORES>
gpu_dirty_memory_managers; gpu_dirty_memory_managers;
@ -953,13 +957,17 @@ void System::RegisterHostThread() {
} }
void System::EnterCPUProfile() { void System::EnterCPUProfile() {
#if MICROPROFILE_ENABLED
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
} }
bool System::IsMulticore() const { bool System::IsMulticore() const {

4
src/core/core_timing.cpp

@ -56,12 +56,16 @@ CoreTiming::~CoreTiming() {
void CoreTiming::ThreadEntry(CoreTiming& instance) { void CoreTiming::ThreadEntry(CoreTiming& instance) {
static constexpr char name[] = "HostTiming"; static constexpr char name[] = "HostTiming";
#if MICROPROFILE_ENABLED
MicroProfileOnThreadCreate(name); MicroProfileOnThreadCreate(name);
#endif
Common::SetCurrentThreadName(name); Common::SetCurrentThreadName(name);
Common::SetCurrentThreadPriority(Common::ThreadPriority::High); Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
instance.on_thread_init(); instance.on_thread_init();
instance.ThreadLoop(); instance.ThreadLoop();
#if MICROPROFILE_ENABLED
MicroProfileOnThreadExit(); MicroProfileOnThreadExit();
#endif
} }
void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) { void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) {

4
src/core/cpu_manager.cpp

@ -192,7 +192,9 @@ void CpuManager::RunThread(std::stop_token token, std::size_t core) {
} else { } else {
name = "CPUThread"; name = "CPUThread";
} }
#if MICROPROFILE_ENABLED
MicroProfileOnThreadCreate(name.c_str()); MicroProfileOnThreadCreate(name.c_str());
#endif
Common::SetCurrentThreadName(name.c_str()); Common::SetCurrentThreadName(name.c_str());
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
auto& data = core_data[core]; auto& data = core_data[core];
@ -201,7 +203,9 @@ void CpuManager::RunThread(std::stop_token token, std::size_t core) {
// Cleanup // Cleanup
SCOPE_EXIT { SCOPE_EXIT {
data.host_context->Exit(); data.host_context->Exit();
#if MICROPROFILE_ENABLED
MicroProfileOnThreadExit(); MicroProfileOnThreadExit();
#endif
}; };
// Running // Running

2
src/yuzu_cmd/yuzu.cpp

@ -335,10 +335,12 @@ int main(int argc, char** argv) {
LocalFree(argv_w); LocalFree(argv_w);
#endif #endif
#if MICROPROFILE_ENABLED
MicroProfileOnThreadCreate("EmuThread"); MicroProfileOnThreadCreate("EmuThread");
SCOPE_EXIT { SCOPE_EXIT {
MicroProfileShutdown(); MicroProfileShutdown();
}; };
#endif
Common::ConfigureNvidiaEnvironmentFlags(); Common::ConfigureNvidiaEnvironmentFlags();

Loading…
Cancel
Save