2014-02-15 13:19:35 +00:00
|
|
|
#include "BaseProfiler.h"
|
2019-04-07 22:59:04 +01:00
|
|
|
#include "QObjectPtr.h"
|
2014-02-15 13:19:35 +00:00
|
|
|
|
2014-02-15 17:15:41 +00:00
|
|
|
#include <QProcess>
|
|
|
|
|
2015-02-09 00:51:14 +00:00
|
|
|
BaseProfiler::BaseProfiler(SettingsObjectPtr settings, InstancePtr instance, QObject *parent)
|
2018-07-15 13:51:05 +01:00
|
|
|
: BaseExternalTool(settings, instance, parent)
|
2014-02-15 13:19:35 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-04-07 22:59:04 +01:00
|
|
|
void BaseProfiler::beginProfiling(shared_qobject_ptr<LaunchTask> process)
|
2014-02-15 13:19:35 +00:00
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
beginProfilingImpl(process);
|
2014-02-15 13:19:35 +00:00
|
|
|
}
|
|
|
|
|
2014-02-16 07:54:52 +00:00
|
|
|
void BaseProfiler::abortProfiling()
|
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
abortProfilingImpl();
|
2014-02-16 07:54:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseProfiler::abortProfilingImpl()
|
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
if (!m_profilerProcess)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_profilerProcess->terminate();
|
|
|
|
m_profilerProcess->deleteLater();
|
|
|
|
m_profilerProcess = 0;
|
|
|
|
emit abortLaunch(tr("Profiler aborted"));
|
2014-02-16 07:54:52 +00:00
|
|
|
}
|
|
|
|
|
2014-03-30 19:11:05 +01:00
|
|
|
BaseProfiler *BaseProfilerFactory::createProfiler(InstancePtr instance, QObject *parent)
|
2014-02-15 13:19:35 +00:00
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
return qobject_cast<BaseProfiler *>(createTool(instance, parent));
|
2014-02-15 13:19:35 +00:00
|
|
|
}
|