pollymc/logic/profiler/BaseProfiler.cpp

50 lines
789 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()
{
abortProfiling();
}
void BaseProfiler::abortProfilingImpl()
{
if (!m_profilerProcess)
{
return;
}
m_profilerProcess->terminate();
m_profilerProcess->deleteLater();
}
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()
{
}