summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-25 16:12:46 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:09 +0200
commitdc580582034fb5937aa53176fdaa4bd0fc4acce8 (patch)
tree6d351a6c3a76fee0a9bc1ab546d07c0583a9d9cd
parentCPU_Manager: remove debugging code. (diff)
downloadyuzu-dc580582034fb5937aa53176fdaa4bd0fc4acce8.tar
yuzu-dc580582034fb5937aa53176fdaa4bd0fc4acce8.tar.gz
yuzu-dc580582034fb5937aa53176fdaa4bd0fc4acce8.tar.bz2
yuzu-dc580582034fb5937aa53176fdaa4bd0fc4acce8.tar.lz
yuzu-dc580582034fb5937aa53176fdaa4bd0fc4acce8.tar.xz
yuzu-dc580582034fb5937aa53176fdaa4bd0fc4acce8.tar.zst
yuzu-dc580582034fb5937aa53176fdaa4bd0fc4acce8.zip
-rw-r--r--src/core/core_timing.cpp5
-rw-r--r--src/core/cpu_manager.cpp5
-rw-r--r--src/video_core/gpu_thread.cpp6
-rw-r--r--src/yuzu/bootmanager.cpp4
-rw-r--r--src/yuzu/main.cpp2
-rw-r--r--src/yuzu_cmd/yuzu.cpp6
-rw-r--r--src/yuzu_tester/yuzu.cpp6
7 files changed, 25 insertions, 9 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index a3ce69790..cc32a853b 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -2,14 +2,14 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "core/core_timing.h"
-
#include <algorithm>
#include <mutex>
#include <string>
#include <tuple>
#include "common/assert.h"
+#include "common/microprofile.h"
+#include "core/core_timing.h"
#include "core/core_timing_util.h"
namespace Core::Timing {
@@ -44,6 +44,7 @@ CoreTiming::~CoreTiming() = default;
void CoreTiming::ThreadEntry(CoreTiming& instance) {
std::string name = "yuzu:HostTiming";
+ MicroProfileOnThreadCreate(name.c_str());
Common::SetCurrentThreadName(name.c_str());
instance.on_thread_init();
instance.ThreadLoop();
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index ff2fe8ead..9b9337131 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include "common/fiber.h"
+#include "common/microprofile.h"
#include "common/thread.h"
#include "core/arm/exclusive_monitor.h"
#include "core/core.h"
@@ -36,6 +37,7 @@ void CpuManager::Shutdown() {
Pause(false);
for (std::size_t core = 0; core < Core::Hardware::NUM_CPU_CORES; core++) {
core_data[core].host_thread->join();
+ core_data[core].host_thread.reset();
}
}
@@ -80,7 +82,7 @@ void CpuManager::RunGuestThread() {
auto& physical_core = kernel.CurrentPhysicalCore();
if (!physical_core.IsInterrupted()) {
physical_core.Idle();
- //physical_core.Run();
+ // physical_core.Run();
}
auto& scheduler = physical_core.Scheduler();
scheduler.TryDoContextSwitch();
@@ -159,6 +161,7 @@ void CpuManager::RunThread(std::size_t core) {
/// Initialization
system.RegisterCoreThread(core);
std::string name = "yuzu:CoreHostThread_" + std::to_string(core);
+ MicroProfileOnThreadCreate(name.c_str());
Common::SetCurrentThreadName(name.c_str());
auto& data = core_data[core];
data.enter_barrier = std::make_unique<Common::Event>();
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index c3bb4fe06..323185bfc 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -4,6 +4,7 @@
#include "common/assert.h"
#include "common/microprofile.h"
+#include "common/thread.h"
#include "core/core.h"
#include "core/frontend/emu_window.h"
#include "core/settings.h"
@@ -18,7 +19,10 @@ namespace VideoCommon::GPUThread {
static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
Core::Frontend::GraphicsContext& context, Tegra::DmaPusher& dma_pusher,
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
while (state.queue.Empty())
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 9ceb6c8d7..468dde782 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -44,7 +44,9 @@ EmuThread::EmuThread() = default;
EmuThread::~EmuThread() = default;
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
// execution.
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index ba69139e5..de0c7fe8c 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -925,6 +925,8 @@ bool GMainWindow::LoadROM(const QString& filename) {
nullptr, // E-Commerce
});
+ system.RegisterHostThread();
+
const Core::System::ResultStatus result{system.Load(*render_window, filename.toStdString())};
const auto drd_callout =
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 38ffdfbd3..e6c6a839d 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <chrono>
#include <iostream>
#include <memory>
#include <string>
@@ -237,8 +238,9 @@ int main(int argc, char** argv) {
std::thread render_thread([&emu_window] { emu_window->Present(); });
system.Run();
- while (emu_window->IsOpen())
- ;
+ while (emu_window->IsOpen()) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
system.Pause();
render_thread.join();
diff --git a/src/yuzu_tester/yuzu.cpp b/src/yuzu_tester/yuzu.cpp
index d62686dd2..083667baf 100644
--- a/src/yuzu_tester/yuzu.cpp
+++ b/src/yuzu_tester/yuzu.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <chrono>
#include <iostream>
#include <memory>
#include <string>
@@ -256,8 +257,9 @@ int main(int argc, char** argv) {
system.Renderer().Rasterizer().LoadDiskResources();
system.Run();
- while (!finished)
- ;
+ while (!finished) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
system.Pause();
detached_tasks.WaitForAllTasks();