pollymc/logic/profiler/BaseProfiler.cpp

52 lines
860 B
C++
Raw Normal View History

#include "BaseProfiler.h"
2014-02-15 22:45:41 +05:30
#include <QProcess>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
2014-02-15 22:45:41 +05:30
BaseProfiler::BaseProfiler(BaseInstance *instance, QObject *parent)
: QObject(parent), m_instance(instance)
{
}
BaseProfiler::~BaseProfiler()
{
}
void BaseProfiler::beginProfiling(MinecraftProcess *process)
{
beginProfilingImpl(process);
}
void BaseProfiler::abortProfiling()
{
2014-02-16 14:00:38 +05:30
abortProfilingImpl();
}
void BaseProfiler::abortProfilingImpl()
{
if (!m_profilerProcess)
{
return;
}
m_profilerProcess->terminate();
m_profilerProcess->deleteLater();
2014-02-16 14:00:38 +05:30
m_profilerProcess = 0;
emit abortLaunch(tr("Profiler aborted"));
}
2014-02-15 22:45:41 +05:30
qint64 BaseProfiler::pid(QProcess *process)
{
#ifdef Q_OS_WIN
struct _PROCESS_INFORMATION *procinfo = process->pid();
return procinfo->dwProcessId;
2014-02-15 22:45:41 +05:30
#else
return process->pid();
2014-02-15 22:45:41 +05:30
#endif
}
BaseProfilerFactory::~BaseProfilerFactory()
{
}