diff options
-rw-r--r-- | logic/profiler/BaseProfiler.cpp | 10 | ||||
-rw-r--r-- | logic/profiler/JVisualVM.cpp | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/logic/profiler/BaseProfiler.cpp b/logic/profiler/BaseProfiler.cpp index 7934f6b4..94891fc4 100644 --- a/logic/profiler/BaseProfiler.cpp +++ b/logic/profiler/BaseProfiler.cpp @@ -1,6 +1,9 @@ #include "BaseProfiler.h" #include <QProcess> +#ifdef Q_OS_WIN +#include <windows.h> +#endif BaseProfiler::BaseProfiler(OneSixInstance *instance, QObject *parent) : QObject(parent), m_instance(instance) @@ -18,10 +21,11 @@ void BaseProfiler::beginProfiling(MinecraftProcess *process) qint64 BaseProfiler::pid(QProcess *process) { -#ifdef Q_OS_UNIX - return process->pid(); +#ifdef Q_OS_WIN + struct _PROCESS_INFORMATION *procinfo = process->pid(); + return procinfo->dwProcessId; #else - return (qint64)process->pid(); + return process->pid(); #endif } diff --git a/logic/profiler/JVisualVM.cpp b/logic/profiler/JVisualVM.cpp index ef46890a..a1aa6951 100644 --- a/logic/profiler/JVisualVM.cpp +++ b/logic/profiler/JVisualVM.cpp @@ -14,7 +14,7 @@ JVisualVM::JVisualVM(OneSixInstance *instance, QObject *parent) : BaseProfiler(i void JVisualVM::beginProfilingImpl(MinecraftProcess *process) { QProcess *profiler = new QProcess(this); - profiler->setArguments(QStringList() << "--openpid" << QString::number(process->pid())); + profiler->setArguments(QStringList() << "--openpid" << QString::number(pid(process))); profiler->setProgram("jvisualvm"); connect(profiler, &QProcess::started, [this]() { emit readyToLaunch(tr("JVisualVM started")); }); |