PrismLauncher/logic/profiler/BaseProfiler.cpp

50 lines
789 B
C++
Raw Normal View History

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