mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-24 12:15:30 +00:00
General: Setup yuzu threads' microprofile, naming and registry.
This commit is contained in:
parent
a5c58a25ef
commit
dc58058203
|
@ -2,14 +2,14 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "core/core_timing.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/microprofile.h"
|
||||||
|
#include "core/core_timing.h"
|
||||||
#include "core/core_timing_util.h"
|
#include "core/core_timing_util.h"
|
||||||
|
|
||||||
namespace Core::Timing {
|
namespace Core::Timing {
|
||||||
|
@ -44,6 +44,7 @@ CoreTiming::~CoreTiming() = default;
|
||||||
|
|
||||||
void CoreTiming::ThreadEntry(CoreTiming& instance) {
|
void CoreTiming::ThreadEntry(CoreTiming& instance) {
|
||||||
std::string name = "yuzu:HostTiming";
|
std::string name = "yuzu:HostTiming";
|
||||||
|
MicroProfileOnThreadCreate(name.c_str());
|
||||||
Common::SetCurrentThreadName(name.c_str());
|
Common::SetCurrentThreadName(name.c_str());
|
||||||
instance.on_thread_init();
|
instance.on_thread_init();
|
||||||
instance.ThreadLoop();
|
instance.ThreadLoop();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/fiber.h"
|
#include "common/fiber.h"
|
||||||
|
#include "common/microprofile.h"
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "core/arm/exclusive_monitor.h"
|
#include "core/arm/exclusive_monitor.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
@ -36,6 +37,7 @@ void CpuManager::Shutdown() {
|
||||||
Pause(false);
|
Pause(false);
|
||||||
for (std::size_t core = 0; core < Core::Hardware::NUM_CPU_CORES; core++) {
|
for (std::size_t core = 0; core < Core::Hardware::NUM_CPU_CORES; core++) {
|
||||||
core_data[core].host_thread->join();
|
core_data[core].host_thread->join();
|
||||||
|
core_data[core].host_thread.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +82,7 @@ void CpuManager::RunGuestThread() {
|
||||||
auto& physical_core = kernel.CurrentPhysicalCore();
|
auto& physical_core = kernel.CurrentPhysicalCore();
|
||||||
if (!physical_core.IsInterrupted()) {
|
if (!physical_core.IsInterrupted()) {
|
||||||
physical_core.Idle();
|
physical_core.Idle();
|
||||||
//physical_core.Run();
|
// physical_core.Run();
|
||||||
}
|
}
|
||||||
auto& scheduler = physical_core.Scheduler();
|
auto& scheduler = physical_core.Scheduler();
|
||||||
scheduler.TryDoContextSwitch();
|
scheduler.TryDoContextSwitch();
|
||||||
|
@ -159,6 +161,7 @@ void CpuManager::RunThread(std::size_t core) {
|
||||||
/// Initialization
|
/// Initialization
|
||||||
system.RegisterCoreThread(core);
|
system.RegisterCoreThread(core);
|
||||||
std::string name = "yuzu:CoreHostThread_" + std::to_string(core);
|
std::string name = "yuzu:CoreHostThread_" + std::to_string(core);
|
||||||
|
MicroProfileOnThreadCreate(name.c_str());
|
||||||
Common::SetCurrentThreadName(name.c_str());
|
Common::SetCurrentThreadName(name.c_str());
|
||||||
auto& data = core_data[core];
|
auto& data = core_data[core];
|
||||||
data.enter_barrier = std::make_unique<Common::Event>();
|
data.enter_barrier = std::make_unique<Common::Event>();
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
|
#include "common/thread.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
|
@ -18,7 +19,10 @@ namespace VideoCommon::GPUThread {
|
||||||
static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
|
static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
|
||||||
Core::Frontend::GraphicsContext& context, Tegra::DmaPusher& dma_pusher,
|
Core::Frontend::GraphicsContext& context, Tegra::DmaPusher& dma_pusher,
|
||||||
SynchState& state) {
|
SynchState& state) {
|
||||||
MicroProfileOnThreadCreate("GpuThread");
|
std::string name = "yuzu:GPU";
|
||||||
|
MicroProfileOnThreadCreate(name.c_str());
|
||||||
|
Common::SetCurrentThreadName(name.c_str());
|
||||||
|
system.RegisterHostThread();
|
||||||
|
|
||||||
// Wait for first GPU command before acquiring the window context
|
// Wait for first GPU command before acquiring the window context
|
||||||
while (state.queue.Empty())
|
while (state.queue.Empty())
|
||||||
|
|
|
@ -44,7 +44,9 @@ EmuThread::EmuThread() = default;
|
||||||
EmuThread::~EmuThread() = default;
|
EmuThread::~EmuThread() = default;
|
||||||
|
|
||||||
void EmuThread::run() {
|
void EmuThread::run() {
|
||||||
MicroProfileOnThreadCreate("EmuThread");
|
std::string name = "yuzu:EmuControlThread";
|
||||||
|
MicroProfileOnThreadCreate(name.c_str());
|
||||||
|
Common::SetCurrentThreadName(name.c_str());
|
||||||
|
|
||||||
// Main process has been loaded. Make the context current to this thread and begin GPU and CPU
|
// Main process has been loaded. Make the context current to this thread and begin GPU and CPU
|
||||||
// execution.
|
// execution.
|
||||||
|
|
|
@ -925,6 +925,8 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
||||||
nullptr, // E-Commerce
|
nullptr, // E-Commerce
|
||||||
});
|
});
|
||||||
|
|
||||||
|
system.RegisterHostThread();
|
||||||
|
|
||||||
const Core::System::ResultStatus result{system.Load(*render_window, filename.toStdString())};
|
const Core::System::ResultStatus result{system.Load(*render_window, filename.toStdString())};
|
||||||
|
|
||||||
const auto drd_callout =
|
const auto drd_callout =
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -237,8 +238,9 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
std::thread render_thread([&emu_window] { emu_window->Present(); });
|
std::thread render_thread([&emu_window] { emu_window->Present(); });
|
||||||
system.Run();
|
system.Run();
|
||||||
while (emu_window->IsOpen())
|
while (emu_window->IsOpen()) {
|
||||||
;
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
}
|
||||||
system.Pause();
|
system.Pause();
|
||||||
render_thread.join();
|
render_thread.join();
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -256,8 +257,9 @@ int main(int argc, char** argv) {
|
||||||
system.Renderer().Rasterizer().LoadDiskResources();
|
system.Renderer().Rasterizer().LoadDiskResources();
|
||||||
|
|
||||||
system.Run();
|
system.Run();
|
||||||
while (!finished)
|
while (!finished) {
|
||||||
;
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
}
|
||||||
system.Pause();
|
system.Pause();
|
||||||
|
|
||||||
detached_tasks.WaitForAllTasks();
|
detached_tasks.WaitForAllTasks();
|
||||||
|
|
Loading…
Reference in a new issue