summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authormitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-04-05 16:24:56 -0700
committermitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-04-09 13:43:32 -0700
commit6dad5cee6526026dee3f28c0086c85ebe983bc3f (patch)
tree27c5e62ad8b070dfb3a48843e62e74327a3cfe59 /Source
parent30c63fa4a618f7629f22079247dbd7536e7e4187 (diff)
DolphinQt: Access Software JIT Profiling
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinQt/MenuBar.cpp40
-rw-r--r--Source/Core/DolphinQt/MenuBar.h3
2 files changed, 43 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp
index 70e2ad7648..03e5346e4e 100644
--- a/Source/Core/DolphinQt/MenuBar.cpp
+++ b/Source/Core/DolphinQt/MenuBar.cpp
@@ -15,9 +15,12 @@
#include <QMap>
#include <QUrl>
+#include <fmt/format.h>
+
#include "Common/Align.h"
#include "Common/CommonPaths.h"
#include "Common/FileUtil.h"
+#include "Common/IOFile.h"
#include "Common/StringUtil.h"
#include "Core/AchievementManager.h"
@@ -150,6 +153,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
!Core::System::GetInstance().GetMovie().IsPlayingInput());
// JIT
+ const bool jit_exists = Core::System::GetInstance().GetJitInterface().GetCore() != nullptr;
m_jit_interpreter_core->setEnabled(running);
m_jit_block_linking->setEnabled(!running);
m_jit_disable_cache->setEnabled(!running);
@@ -158,6 +162,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
m_jit_clear_cache->setEnabled(running);
m_jit_log_coverage->setEnabled(!running);
m_jit_search_instruction->setEnabled(running);
+ m_jit_write_cache_log_dump->setEnabled(running && jit_exists);
// Symbols
m_symbols->setEnabled(running);
@@ -198,6 +203,30 @@ void MenuBar::OnDebugModeToggled(bool enabled)
}
}
+void MenuBar::OnWriteJitBlockLogDump()
+{
+ const std::string filename = fmt::format("{}{}.txt", File::GetUserPath(D_DUMPDEBUG_JITBLOCKS_IDX),
+ SConfig::GetInstance().GetGameID());
+ File::IOFile f(filename, "w");
+ if (!f)
+ {
+ ModalMessageBox::warning(
+ this, tr("Error"),
+ tr("Failed to open \"%1\" for writing.").arg(QString::fromStdString(filename)));
+ return;
+ }
+ auto& system = Core::System::GetInstance();
+ system.GetJitInterface().JitBlockLogDump(Core::CPUThreadGuard{system}, f.GetHandle());
+ if (static bool ignore = false; ignore == false)
+ {
+ const int button_pressed = ModalMessageBox::information(
+ this, tr("Success"), tr("Wrote to \"%1\".").arg(QString::fromStdString(filename)),
+ QMessageBox::Ok | QMessageBox::Ignore);
+ if (button_pressed == QMessageBox::Ignore)
+ ignore = true;
+ }
+}
+
void MenuBar::AddFileMenu()
{
QMenu* file_menu = addMenu(tr("&File"));
@@ -892,6 +921,17 @@ void MenuBar::AddJITMenu()
m_jit->addSeparator();
+ m_jit_profile_blocks = m_jit->addAction(tr("Enable JIT Block Profiling"));
+ m_jit_profile_blocks->setCheckable(true);
+ m_jit_profile_blocks->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_ENABLE_PROFILING));
+ connect(m_jit_profile_blocks, &QAction::toggled, [](bool enabled) {
+ Config::SetBaseOrCurrent(Config::MAIN_DEBUG_JIT_ENABLE_PROFILING, enabled);
+ });
+ m_jit_write_cache_log_dump =
+ m_jit->addAction(tr("Write JIT Block Log Dump"), this, &MenuBar::OnWriteJitBlockLogDump);
+
+ m_jit->addSeparator();
+
m_jit_off = m_jit->addAction(tr("JIT Off (JIT Core)"));
m_jit_off->setCheckable(true);
m_jit_off->setChecked(Config::Get(Config::MAIN_DEBUG_JIT_OFF));
diff --git a/Source/Core/DolphinQt/MenuBar.h b/Source/Core/DolphinQt/MenuBar.h
index c8a1f6311a..b6620291d2 100644
--- a/Source/Core/DolphinQt/MenuBar.h
+++ b/Source/Core/DolphinQt/MenuBar.h
@@ -185,6 +185,7 @@ private:
void OnRecordingStatusChanged(bool recording);
void OnReadOnlyModeChanged(bool read_only);
void OnDebugModeToggled(bool enabled);
+ void OnWriteJitBlockLogDump();
QString GetSignatureSelector() const;
@@ -268,6 +269,8 @@ private:
QAction* m_jit_clear_cache;
QAction* m_jit_log_coverage;
QAction* m_jit_search_instruction;
+ QAction* m_jit_profile_blocks;
+ QAction* m_jit_write_cache_log_dump;
QAction* m_jit_off;
QAction* m_jit_loadstore_off;
QAction* m_jit_loadstore_lbzx_off;