summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--logic/profiler/BaseProfiler.cpp11
-rw-r--r--logic/profiler/BaseProfiler.h3
-rw-r--r--logic/profiler/JProfiler.cpp2
3 files changed, 15 insertions, 1 deletions
diff --git a/logic/profiler/BaseProfiler.cpp b/logic/profiler/BaseProfiler.cpp
index 788e9614..7934f6b4 100644
--- a/logic/profiler/BaseProfiler.cpp
+++ b/logic/profiler/BaseProfiler.cpp
@@ -1,5 +1,7 @@
#include "BaseProfiler.h"
+#include <QProcess>
+
BaseProfiler::BaseProfiler(OneSixInstance *instance, QObject *parent)
: QObject(parent), m_instance(instance)
{
@@ -14,6 +16,15 @@ void BaseProfiler::beginProfiling(MinecraftProcess *process)
beginProfilingImpl(process);
}
+qint64 BaseProfiler::pid(QProcess *process)
+{
+#ifdef Q_OS_UNIX
+ return process->pid();
+#else
+ return (qint64)process->pid();
+#endif
+}
+
BaseProfilerFactory::~BaseProfilerFactory()
{
}
diff --git a/logic/profiler/BaseProfiler.h b/logic/profiler/BaseProfiler.h
index 2986c8e1..e7bc4c2d 100644
--- a/logic/profiler/BaseProfiler.h
+++ b/logic/profiler/BaseProfiler.h
@@ -5,6 +5,7 @@
class OneSixInstance;
class SettingsObject;
class MinecraftProcess;
+class QProcess;
class BaseProfiler : public QObject
{
@@ -22,6 +23,8 @@ protected:
virtual void beginProfilingImpl(MinecraftProcess *process) = 0;
+ qint64 pid(QProcess *process);
+
signals:
void readyToLaunch(const QString &message);
};
diff --git a/logic/profiler/JProfiler.cpp b/logic/profiler/JProfiler.cpp
index aa6a866a..eddf46d9 100644
--- a/logic/profiler/JProfiler.cpp
+++ b/logic/profiler/JProfiler.cpp
@@ -16,7 +16,7 @@ void JProfiler::beginProfilingImpl(MinecraftProcess *process)
{
int port = MMC->settings()->get("JProfilerPort").toInt();
QProcess *profiler = new QProcess(this);
- profiler->setArguments(QStringList() << "-d" << QString::number(process->pid()) << "--gui"
+ profiler->setArguments(QStringList() << "-d" << QString::number(pid(process)) << "--gui"
<< "-p" << QString::number(port));
profiler->setProgram(QDir(MMC->settings()->get("JProfilerPath").toString())
.absoluteFilePath("bin/jpenable"));