aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libs/qmldebug/qmlprofilertraceclient.cpp25
-rw-r--r--libs/qmldebug/qmlprofilertraceclient.h9
-rw-r--r--plugins/qmlprofiler/localqmlprofilerrunner.cpp26
-rw-r--r--plugins/qmlprofiler/localqmlprofilerrunner.h10
-rw-r--r--plugins/qmlprofiler/qmlprofilerclientmanager.cpp30
-rw-r--r--plugins/qmlprofiler/qmlprofilerengine.cpp62
-rw-r--r--plugins/qmlprofiler/qmlprofilerengine.h16
-rw-r--r--plugins/qmlprofiler/qmlprofilermodelmanager.cpp47
-rw-r--r--plugins/qmlprofiler/qmlprofilermodelmanager.h11
-rw-r--r--plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp9
-rw-r--r--plugins/qmlprofiler/qmlprofilerplugin.cpp9
-rw-r--r--plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp81
-rw-r--r--plugins/qmlprofiler/qmlprofilerruncontrolfactory.h2
-rw-r--r--plugins/qmlprofiler/qmlprofilersimplemodel.cpp33
-rw-r--r--plugins/qmlprofiler/qmlprofilersimplemodel.h6
-rw-r--r--plugins/qmlprofiler/qmlprofilertool.cpp85
-rw-r--r--plugins/qmlprofiler/qmlprofilertool.h11
-rw-r--r--plugins/qmlprofiler/qmlprofilertracefile.cpp22
-rw-r--r--plugins/qmlprofiler/qmlprofilertracefile.h6
19 files changed, 189 insertions, 311 deletions
diff --git a/libs/qmldebug/qmlprofilertraceclient.cpp b/libs/qmldebug/qmlprofilertraceclient.cpp
index bd0337ca4a..b0824ddfdb 100644
--- a/libs/qmldebug/qmlprofilertraceclient.cpp
+++ b/libs/qmldebug/qmlprofilertraceclient.cpp
@@ -170,7 +170,8 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
} else if (event == AnimationFrame) {
int frameRate, animationCount;
stream >> frameRate >> animationCount;
- emit this->frame(time, frameRate, animationCount);
+ emit rangedEvent(QmlDebug::Painting, QmlDebug::AnimationFrame, time, 0,
+ QStringList(), QmlDebug::QmlEventLocation(), frameRate, animationCount, 0,0,0);
d->maximumTime = qMax(time, d->maximumTime);
} else if (event == StartTrace) {
emit this->traceStarted(time);
@@ -192,21 +193,20 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
}
while (count<5)
params[count++] = 0;
- emit sceneGraphFrame(SceneGraphFrameEvent, sgEventType, time, params[0], params[1], params[2], params[3], params[4]);
+ emit rangedEvent(SceneGraphFrameEvent, sgEventType,time, 0, QStringList(),
+ QmlDebug::QmlEventLocation(), params[0], params[1], params[2], params[3], params[4]);
} else if (messageType == PixmapCacheEvent) {
- int pixEvTy, width = -1, height = -1, refcount = -1;
+ int pixEvTy, width = 0, height = 0, refcount = 0;
QString pixUrl;
stream >> pixEvTy >> pixUrl;
if (pixEvTy == (int)PixmapReferenceCountChanged || pixEvTy == (int)PixmapCacheCountChanged) {
stream >> refcount;
- emit pixmapCacheEvent(time,pixEvTy, pixUrl, 0, 0, refcount);
- } else
- if (pixEvTy == (int)PixmapSizeKnown) {
- stream >> width >> height;
- emit pixmapCacheEvent(time,pixEvTy, pixUrl, width, height, 1);
- } else { // Other
- emit pixmapCacheEvent(time,pixEvTy, pixUrl, 0, 0, 0);
- }
+ } else if (pixEvTy == (int)PixmapSizeKnown) {
+ stream >> width >> height;
+ refcount = 1;
+ }
+ emit rangedEvent(QmlDebug::PixmapCacheEvent, pixEvTy, time, 0, QStringList(),
+ QmlDebug::QmlEventLocation(pixUrl,0,0), width, height, refcount, 0, 0);
d->maximumTime = qMax(time, d->maximumTime);
} else {
int range;
@@ -269,7 +269,8 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
bindingType = d->bindingTypes.pop();
if ((QmlEventType)range == Painting)
bindingType = QPainterEvent;
- emit this->range((QmlEventType)range, bindingType, startTime, time - startTime, data, location);
+ emit rangedEvent((QmlEventType)range, bindingType, startTime, time - startTime, data,
+ location, 0, 0, 0, 0, 0);
if (d->rangeCount[range] == 0) {
int count = d->rangeDatas[range].count() +
d->rangeStartTimes[range].count() +
diff --git a/libs/qmldebug/qmlprofilertraceclient.h b/libs/qmldebug/qmlprofilertraceclient.h
index 21c7d4eae1..b8364c0ab0 100644
--- a/libs/qmldebug/qmlprofilertraceclient.h
+++ b/libs/qmldebug/qmlprofilertraceclient.h
@@ -102,12 +102,9 @@ signals:
void event(int event, qint64 time);
void traceFinished( qint64 time );
void traceStarted( qint64 time );
- void range(int type, int bindingType, qint64 startTime, qint64 length,
- const QStringList &data, const QmlDebug::QmlEventLocation &location);
- void frame(qint64 time, int frameRate, int animationCount);
- void sceneGraphFrame(int eventType, int sgEventType, qint64 time, qint64 param1, qint64 param2, qint64 param3, qint64 param4, qint64 param5);
- void pixmapCacheEvent(qint64 time, int cacheEventType, const QString& url, int width, int height, int refCount);
-
+ void rangedEvent(int type, int bindingType, qint64 startTime, qint64 length,
+ const QStringList &data, const QmlDebug::QmlEventLocation &location,
+ qint64 param1, qint64 param2, qint64 param3, qint64 param4, qint64 param5);
void recordingChanged(bool arg);
void enabledChanged();
diff --git a/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/plugins/qmlprofiler/localqmlprofilerrunner.cpp
index 6eb06223be..14f7de97dd 100644
--- a/plugins/qmlprofiler/localqmlprofilerrunner.cpp
+++ b/plugins/qmlprofiler/localqmlprofilerrunner.cpp
@@ -45,7 +45,7 @@ LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner(
RunConfiguration *runConfiguration,
const Analyzer::AnalyzerStartParameters &sp,
QString *errorMessage,
- QmlProfilerEngine *engine)
+ QmlProfilerRunControl *engine)
{
QmlProjectManager::QmlProjectRunConfiguration *rc1 =
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
@@ -81,7 +81,7 @@ LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner(
}
LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration,
- QmlProfilerEngine *engine) :
+ QmlProfilerRunControl *engine) :
AbstractQmlProfilerRunner(engine),
m_configuration(configuration),
m_engine(engine)
@@ -92,12 +92,12 @@ LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuratio
LocalQmlProfilerRunner::~LocalQmlProfilerRunner()
{
- disconnect(&m_launcher, SIGNAL(processExited(int)), this, SLOT(spontaneousStop(int)));
+ disconnect();
}
void LocalQmlProfilerRunner::start()
{
- if (m_engine->mode() != Analyzer::StartQml)
+ if (m_engine->mode() != Analyzer::StartLocal)
return;
QString arguments = QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_configuration.port);
@@ -111,26 +111,32 @@ void LocalQmlProfilerRunner::start()
m_launcher.setWorkingDirectory(m_configuration.workingDirectory);
m_launcher.setEnvironment(m_configuration.environment);
- connect(&m_launcher, SIGNAL(processExited(int)), this, SLOT(spontaneousStop(int)));
+ connect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)),
+ this, SLOT(spontaneousStop(int,QProcess::ExitStatus)));
m_launcher.start(ProjectExplorer::ApplicationLauncher::Gui, m_configuration.executable,
arguments);
emit started();
}
-void LocalQmlProfilerRunner::spontaneousStop(int exitCode)
+void LocalQmlProfilerRunner::spontaneousStop(int exitCode, QProcess::ExitStatus status)
{
- if (QmlProfilerPlugin::debugOutput)
- qWarning("QmlProfiler: Application exited (exit code %d).", exitCode);
+ if (QmlProfilerPlugin::debugOutput) {
+ if (status == QProcess::CrashExit)
+ qWarning("QmlProfiler: Application crashed.");
+ else
+ qWarning("QmlProfiler: Application exited (exit code %d).", exitCode);
+ }
- disconnect(&m_launcher, SIGNAL(processExited(int)), this, SLOT(spontaneousStop(int)));
+ disconnect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)),
+ this, SLOT(spontaneousStop(int,QProcess::ExitStatus)));
emit stopped();
}
void LocalQmlProfilerRunner::stop()
{
- if (m_engine->mode() != Analyzer::StartQml)
+ if (m_engine->mode() != Analyzer::StartLocal)
return;
if (QmlProfilerPlugin::debugOutput)
diff --git a/plugins/qmlprofiler/localqmlprofilerrunner.h b/plugins/qmlprofiler/localqmlprofilerrunner.h
index 37591917da..540f472241 100644
--- a/plugins/qmlprofiler/localqmlprofilerrunner.h
+++ b/plugins/qmlprofiler/localqmlprofilerrunner.h
@@ -41,7 +41,7 @@ namespace Analyzer { class AnalyzerStartParameters; }
namespace QmlProfiler {
namespace Internal {
-class QmlProfilerEngine;
+class QmlProfilerRunControl;
class LocalQmlProfilerRunner : public AbstractQmlProfilerRunner
{
Q_OBJECT
@@ -58,7 +58,7 @@ public:
static LocalQmlProfilerRunner *createLocalRunner(ProjectExplorer::RunConfiguration *runConfiguration,
const Analyzer::AnalyzerStartParameters &sp,
QString *errorMessage,
- QmlProfilerEngine *engine);
+ QmlProfilerRunControl *engine);
~LocalQmlProfilerRunner();
@@ -68,15 +68,15 @@ public:
virtual quint16 debugPort() const;
private slots:
- void spontaneousStop(int exitCode);
+ void spontaneousStop(int exitCode, QProcess::ExitStatus status);
private:
- LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerEngine *engine);
+ LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerRunControl *engine);
private:
Configuration m_configuration;
ProjectExplorer::ApplicationLauncher m_launcher;
- QmlProfilerEngine *m_engine;
+ QmlProfilerRunControl *m_engine;
};
} // namespace Internal
diff --git a/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
index e733daf86a..926a382ce7 100644
--- a/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
+++ b/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
@@ -179,23 +179,15 @@ void QmlProfilerClientManager::connectClientSignals()
connect(d->qmlclientplugin.data(), SIGNAL(complete()),
this, SLOT(qmlComplete()));
connect(d->qmlclientplugin.data(),
- SIGNAL(range(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation)),
+ SIGNAL(rangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation,
+ qint64,qint64,qint64,qint64,qint64)),
d->modelManager,
- SLOT(addRangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation)));
+ SLOT(addQmlEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation,
+ qint64,qint64,qint64,qint64,qint64)));
connect(d->qmlclientplugin.data(), SIGNAL(traceFinished(qint64)),
d->modelManager->traceTime(), SLOT(setEndTime(qint64)));
connect(d->qmlclientplugin.data(), SIGNAL(traceStarted(qint64)),
d->modelManager->traceTime(), SLOT(setStartTime(qint64)));
- connect(d->qmlclientplugin.data(), SIGNAL(frame(qint64,int,int)),
- d->modelManager, SLOT(addFrameEvent(qint64,int,int)));
- connect(d->qmlclientplugin.data(),
- SIGNAL(pixmapCacheEvent(qint64,int,QString,int,int,int)),
- d->modelManager,
- SLOT(addPixmapCacheEvent(qint64,int,QString,int,int,int)));
- connect(d->qmlclientplugin.data(),
- SIGNAL(sceneGraphFrame(int,int,qint64,qint64,qint64,qint64,qint64,qint64)),
- d->modelManager,
- SLOT(addSceneGraphEvent(int,int,qint64,qint64,qint64,qint64,qint64,qint64)));
connect(d->qmlclientplugin.data(), SIGNAL(enabledChanged()),
d->qmlclientplugin.data(), SLOT(sendRecordingStatus()));
// fixme: this should be unified for both clients
@@ -219,23 +211,17 @@ void QmlProfilerClientManager::disconnectClientSignals()
disconnect(d->qmlclientplugin.data(), SIGNAL(complete()),
this, SLOT(qmlComplete()));
disconnect(d->qmlclientplugin.data(),
- SIGNAL(range(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation)),
+ SIGNAL(rangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation,
+ qint64,qint64,qint64,qint64,qint64)),
d->modelManager,
- SLOT(addRangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation)));
+ SLOT(addQmlEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation,
+ qint64,qint64,qint64,qint64,qint64)));
disconnect(d->qmlclientplugin.data(), SIGNAL(traceFinished(qint64)),
d->modelManager->traceTime(), SLOT(setEndTime(qint64)));
disconnect(d->qmlclientplugin.data(), SIGNAL(traceStarted(qint64)),
d->modelManager->traceTime(), SLOT(setStartTime(qint64)));
disconnect(d->qmlclientplugin.data(), SIGNAL(frame(qint64,int,int)),
d->modelManager, SLOT(addFrameEvent(qint64,int,int)));
- disconnect(d->qmlclientplugin.data(),
- SIGNAL(pixmapCacheEvent(qint64,int,QString,int,int,int)),
- d->modelManager,
- SLOT(addPixmapCacheEvent(qint64,int,QString,int,int,int)));
- disconnect(d->qmlclientplugin.data(),
- SIGNAL(sceneGraphFrame(int,int,qint64,qint64,qint64,qint64,qint64,qint64,qint64)),
- d->modelManager,
- SLOT(addSceneGraphEvent(int,int,qint64,qint64,qint64,qint64,qint64,qint64,qint64)));
disconnect(d->qmlclientplugin.data(), SIGNAL(enabledChanged()),
d->qmlclientplugin.data(), SLOT(sendRecordingStatus()));
// fixme: this should be unified for both clients
diff --git a/plugins/qmlprofiler/qmlprofilerengine.cpp b/plugins/qmlprofiler/qmlprofilerengine.cpp
index f8f4058e5a..0dff45f4d5 100644
--- a/plugins/qmlprofiler/qmlprofilerengine.cpp
+++ b/plugins/qmlprofiler/qmlprofilerengine.cpp
@@ -33,7 +33,6 @@
#include <analyzerbase/analyzermanager.h>
#include <coreplugin/icore.h>
-#include <debugger/debuggerrunconfigurationaspect.h>
#include <utils/qtcassert.h>
#include <coreplugin/helpmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -61,20 +60,14 @@ namespace Internal {
// QmlProfilerEnginePrivate
//
-class QmlProfilerEngine::QmlProfilerEnginePrivate
+class QmlProfilerRunControl::QmlProfilerEnginePrivate
{
public:
- QmlProfilerEnginePrivate(QmlProfilerEngine *qq, const AnalyzerStartParameters &sp) : q(qq), sp(sp), m_running(false) {}
-
- bool attach(const QString &address, uint port);
-
- QmlProfilerEngine *q;
+ QmlProfilerEnginePrivate() : m_running(false) {}
QmlProfilerStateManager *m_profilerState;
-
QTimer m_noDebugOutputTimer;
QmlDebug::QmlOutputParser m_outputParser;
- const AnalyzerStartParameters sp;
bool m_running;
};
@@ -82,11 +75,10 @@ public:
// QmlProfilerEngine
//
-QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
- const Analyzer::AnalyzerStartParameters &sp,
+QmlProfilerRunControl::QmlProfilerRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
- : IAnalyzerEngine(tool, sp, runConfiguration)
- , d(new QmlProfilerEnginePrivate(this, sp))
+ : AnalyzerRunControl(sp, runConfiguration)
+ , d(new QmlProfilerEnginePrivate)
{
d->m_profilerState = 0;
@@ -105,14 +97,14 @@ QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
this, SLOT(wrongSetupMessageBox(QString)));
}
-QmlProfilerEngine::~QmlProfilerEngine()
+QmlProfilerRunControl::~QmlProfilerRunControl()
{
if (d->m_profilerState && d->m_profilerState->currentState() == QmlProfilerStateManager::AppRunning)
- stop();
+ stopEngine();
delete d;
}
-bool QmlProfilerEngine::start()
+bool QmlProfilerRunControl::startEngine()
{
QTC_ASSERT(d->m_profilerState, return false);
@@ -128,7 +120,7 @@ bool QmlProfilerEngine::start()
}
}
- if (d->sp.startMode == StartQmlRemote || d->sp.startMode == StartLocal) {
+ if (startParameters().startMode == StartLocal) {
d->m_noDebugOutputTimer.start();
} else {
emit processRunning(startParameters().analyzerPort);
@@ -139,7 +131,7 @@ bool QmlProfilerEngine::start()
return true;
}
-void QmlProfilerEngine::stop()
+void QmlProfilerRunControl::stopEngine()
{
QTC_ASSERT(d->m_profilerState, return);
@@ -164,7 +156,7 @@ void QmlProfilerEngine::stop()
}
}
-void QmlProfilerEngine::notifyRemoteFinished(bool success)
+void QmlProfilerRunControl::notifyRemoteFinished(bool success)
{
QTC_ASSERT(d->m_profilerState, return);
@@ -176,7 +168,7 @@ void QmlProfilerEngine::notifyRemoteFinished(bool success)
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppKilled);
AnalyzerManager::stopTool();
- engineFinished();
+ runControlFinished();
break;
}
case QmlProfilerStateManager::AppStopped :
@@ -192,7 +184,7 @@ void QmlProfilerEngine::notifyRemoteFinished(bool success)
}
}
-void QmlProfilerEngine::cancelProcess()
+void QmlProfilerRunControl::cancelProcess()
{
QTC_ASSERT(d->m_profilerState, return);
@@ -212,16 +204,16 @@ void QmlProfilerEngine::cancelProcess()
return;
}
}
- engineFinished();
+ runControlFinished();
}
-void QmlProfilerEngine::logApplicationMessage(const QString &msg, Utils::OutputFormat format)
+void QmlProfilerRunControl::logApplicationMessage(const QString &msg, Utils::OutputFormat format)
{
- emit outputReceived(msg, format);
+ appendMessage(msg, format);
d->m_outputParser.processOutput(msg);
}
-void QmlProfilerEngine::wrongSetupMessageBox(const QString &errorMessage)
+void QmlProfilerRunControl::wrongSetupMessageBox(const QString &errorMessage)
{
QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical);
@@ -241,10 +233,10 @@ void QmlProfilerEngine::wrongSetupMessageBox(const QString &errorMessage)
// KILL
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
AnalyzerManager::stopTool();
- emit finished();
+ runControlFinished();
}
-void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button)
+void QmlProfilerRunControl::wrongSetupMessageBoxFinished(int button)
{
if (button == QMessageBox::Help) {
Core::HelpManager *helpManager = Core::HelpManager::instance();
@@ -253,7 +245,7 @@ void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button)
}
}
-void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
+void QmlProfilerRunControl::showNonmodalWarning(const QString &warningMsg)
{
QMessageBox *noExecWarning = new QMessageBox(Core::ICore::mainWindow());
noExecWarning->setIcon(QMessageBox::Warning);
@@ -265,27 +257,27 @@ void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
noExecWarning->show();
}
-void QmlProfilerEngine::notifyRemoteSetupDone(quint16 port)
+void QmlProfilerRunControl::notifyRemoteSetupDone(quint16 port)
{
d->m_noDebugOutputTimer.stop();
emit processRunning(port);
}
-void QmlProfilerEngine::processIsRunning(quint16 port)
+void QmlProfilerRunControl::processIsRunning(quint16 port)
{
d->m_noDebugOutputTimer.stop();
- if (port > 0 && mode() != StartQmlRemote)
+ if (port > 0 && startParameters().analyzerPort != 0)
emit processRunning(port);
}
-void QmlProfilerEngine::engineStarted()
+void QmlProfilerRunControl::engineStarted()
{
d->m_running = true;
emit starting(this);
}
-void QmlProfilerEngine::engineFinished()
+void QmlProfilerRunControl::runControlFinished()
{
d->m_running = false;
emit finished();
@@ -293,7 +285,7 @@ void QmlProfilerEngine::engineFinished()
////////////////////////////////////////////////////////////////
// Profiler State
-void QmlProfilerEngine::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
+void QmlProfilerRunControl::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
{
// disconnect old
if (d->m_profilerState)
@@ -306,7 +298,7 @@ void QmlProfilerEngine::registerProfilerStateManager( QmlProfilerStateManager *p
connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged()));
}
-void QmlProfilerEngine::profilerStateChanged()
+void QmlProfilerRunControl::profilerStateChanged()
{
switch (d->m_profilerState->currentState()) {
case QmlProfilerStateManager::AppReadyToStop : {
diff --git a/plugins/qmlprofiler/qmlprofilerengine.h b/plugins/qmlprofiler/qmlprofilerengine.h
index aea3c8bf8d..cf0b476f9f 100644
--- a/plugins/qmlprofiler/qmlprofilerengine.h
+++ b/plugins/qmlprofiler/qmlprofilerengine.h
@@ -30,22 +30,22 @@
#ifndef QMLPROFILERENGINE_H
#define QMLPROFILERENGINE_H
-#include <analyzerbase/ianalyzerengine.h>
#include "qmlprofilerstatemanager.h"
+
+#include <analyzerbase/analyzerruncontrol.h>
#include <utils/outputformat.h>
namespace QmlProfiler {
namespace Internal {
-class QmlProfilerEngine : public Analyzer::IAnalyzerEngine
+class QmlProfilerRunControl : public Analyzer::AnalyzerRunControl
{
Q_OBJECT
public:
- QmlProfilerEngine(Analyzer::IAnalyzerTool *tool,
- const Analyzer::AnalyzerStartParameters &sp,
+ QmlProfilerRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
- ~QmlProfilerEngine();
+ ~QmlProfilerRunControl();
void registerProfilerStateManager( QmlProfilerStateManager *profilerState );
@@ -58,8 +58,8 @@ signals:
void timeUpdate();
public slots:
- bool start();
- void stop();
+ bool startEngine();
+ void stopEngine();
private slots:
void notifyRemoteFinished(bool success = true);
@@ -70,7 +70,7 @@ private slots:
void wrongSetupMessageBoxFinished(int);
void processIsRunning(quint16 port = 0);
void engineStarted();
- void engineFinished();
+ void runControlFinished();
private slots:
void profilerStateChanged();
diff --git a/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
index 078bdb5174..ab70bca78b 100644
--- a/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
+++ b/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
@@ -225,14 +225,15 @@ void QmlProfilerModelManager::newTimeEstimation(qint64 estimation)
d->estimatedTime = estimation;
}
-void QmlProfilerModelManager::addRangedEvent(int type, int bindingType, qint64 startTime, qint64 length, const QStringList &data, const QmlDebug::QmlEventLocation &location)
+void QmlProfilerModelManager::addQmlEvent(int type, int bindingType, qint64 startTime, qint64 length, const QStringList &data, const QmlDebug::QmlEventLocation &location,
+ qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5)
{
// If trace start time was not explicitly set, use the first event
if (d->traceTime->startTime() == -1)
d->traceTime->setStartTime(startTime);
QTC_ASSERT(state() == QmlProfilerDataState::AcquiringData, /**/);
- d->model->addRangedEvent(type, bindingType, startTime, length, data, location);
+ d->model->addQmlEvent(type, bindingType, startTime, length, data, location, ndata1, ndata2, ndata3, ndata4, ndata5);
emit countChanged();
}
@@ -242,37 +243,6 @@ void QmlProfilerModelManager::addV8Event(int depth, const QString &function, con
d->v8Model->addV8Event(depth, function, filename, lineNumber,totalTime, selfTime);
}
-void QmlProfilerModelManager::addFrameEvent(qint64 time, int framerate, int animationcount)
-{
- if (d->traceTime->startTime() == -1)
- d->traceTime->setStartTime(time);
-
- QTC_ASSERT(state() == QmlProfilerDataState::AcquiringData, /**/);
- d->model->addFrameEvent(time, framerate, animationcount);
- emit countChanged();
-}
-
-void QmlProfilerModelManager::addSceneGraphEvent(int eventType, int SGEtype, qint64 startTime, qint64 timing1, qint64 timing2, qint64 timing3, qint64 timing4, qint64 timing5)
-{
- if (d->traceTime->startTime() == -1)
- d->traceTime->setStartTime(startTime);
-
- QTC_ASSERT(state() == QmlProfilerDataState::AcquiringData, /**/);
- d->model->addSceneGraphEvent(eventType, SGEtype, startTime, timing1, timing2, timing3, timing4, timing5);
- emit countChanged();
-}
-
-void QmlProfilerModelManager::addPixmapCacheEvent(qint64 time, int pixmapEventType, QString Url, int pixmapWidth, int pixmapHeight, int referenceCount)
-{
- if (d->traceTime->startTime() == -1)
- d->traceTime->setStartTime(time);
-
- QTC_ASSERT(state() == QmlProfilerDataState::AcquiringData, /**/);
- d->model->addPixmapCacheEvent(time, pixmapEventType, Url, pixmapWidth, pixmapHeight, referenceCount);
- emit countChanged();
-}
-
-
void QmlProfilerModelManager::complete()
{
if (state() == QmlProfilerDataState::AcquiringData) {
@@ -339,15 +309,12 @@ void QmlProfilerModelManager::load()
QmlProfilerFileReader reader;
connect(&reader, SIGNAL(error(QString)), this, SIGNAL(error(QString)));
- connect(&reader, SIGNAL(rangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation)), this,
- SLOT(addRangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation)));
+ connect(&reader, SIGNAL(rangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation,
+ qint64, qint64, qint64, qint64, qint64)),
+ this, SLOT(addQmlEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation,
+ qint64, qint64, qint64, qint64, qint64)));
connect(&reader, SIGNAL(traceStartTime(qint64)), traceTime(), SLOT(setStartTime(qint64)));
connect(&reader, SIGNAL(traceEndTime(qint64)), traceTime(), SLOT(setEndTime(qint64)));
- connect(&reader, SIGNAL(sceneGraphFrame(int,int,qint64,qint64,qint64,qint64,qint64,qint64)),
- this, SLOT(addSceneGraphEvent(int,int,qint64,qint64,qint64,qint64,qint64,qint64)));
- connect(&reader, SIGNAL(pixmapCacheEvent(qint64,int,QString,int,int,int)),
- this, SLOT(addPixmapCacheEvent(qint64,int,QString,int,int,int)));
- connect(&reader, SIGNAL(frame(qint64,int,int)), this, SLOT(addFrameEvent(qint64,int,int)));
reader.setV8DataModel(d->v8Model);
reader.load(&file);
diff --git a/plugins/qmlprofiler/qmlprofilermodelmanager.h b/plugins/qmlprofiler/qmlprofilermodelmanager.h
index fb44cf1937..59f3b0e7d9 100644
--- a/plugins/qmlprofiler/qmlprofilermodelmanager.h
+++ b/plugins/qmlprofiler/qmlprofilermodelmanager.h
@@ -126,17 +126,12 @@ public slots:
void clear();
void prepareForWriting();
- void addRangedEvent(int type, int bindingType, qint64 startTime, qint64 length,
- const QStringList &data, const QmlDebug::QmlEventLocation &location);
- void addSceneGraphEvent(int eventType, int SGEtype, qint64 startTime,
- qint64 timing1, qint64 timing2, qint64 timing3, qint64 timing4, qint64 timing5);
- void addPixmapCacheEvent(qint64 time, int pixmapEventType, QString Url,
- int pixmapWidth, int pixmapHeight, int referenceCount);
+ void addQmlEvent(int type, int bindingType, qint64 startTime, qint64 length,
+ const QStringList &data, const QmlDebug::QmlEventLocation &location,
+ qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5);
void addV8Event(int depth, const QString &function,const QString &filename, int lineNumber,
double totalTime, double selfTime);
- void addFrameEvent(qint64 time, int framerate, int animationcount);
-
void complete();
void save(const QString &filename);
diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
index 9db131f771..9cc160b1a5 100644
--- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
+++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
@@ -155,8 +155,13 @@ void PaintEventsModelProxy::loadData()
if (!eventAccepted(event))
continue;
+ qint64 estimatedDuration = 0;
+ // initial estimation of the event duration: 1/framerate
+ if (event.numericData1 > 0)
+ estimatedDuration = 1e9/event.numericData1;
+
// the profiler registers the animation events at the end of them
- qint64 realStartTime = event.startTime - event.duration;
+ qint64 realStartTime = event.startTime - estimatedDuration;
// the duration of the events is estimated from the framerate
// we need to correct it before appending a new event
@@ -171,7 +176,7 @@ void PaintEventsModelProxy::loadData()
QmlPaintEventData newEvent = {
realStartTime,
- event.duration,
+ estimatedDuration,
(int)event.numericData1,
(int)event.numericData2
};
diff --git a/plugins/qmlprofiler/qmlprofilerplugin.cpp b/plugins/qmlprofiler/qmlprofilerplugin.cpp
index 9cd725b39c..9cb1ee5ba6 100644
--- a/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -38,8 +38,6 @@
#include <QtPlugin>
-
-
using namespace Analyzer;
using namespace QmlProfiler;
using namespace QmlProfiler::Internal;
@@ -52,10 +50,9 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
Q_UNUSED(arguments)
Q_UNUSED(errorString)
- StartModes modes;
- modes.append(StartMode(StartLocal));
- modes.append(StartMode(StartRemote));
- AnalyzerManager::addTool(new QmlProfilerTool(this), modes);
+ IAnalyzerTool *tool = new QmlProfilerTool(this);
+ AnalyzerManager::addTool(tool, StartLocal);
+ AnalyzerManager::addTool(tool, StartRemote);
addAutoReleasedObject(new QmlProfilerRunControlFactory());
QmlProfilerPlugin::instance = this;
diff --git a/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp b/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
index 6e3ab3ff6a..86f0583e81 100644
--- a/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
+++ b/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
@@ -37,11 +37,22 @@
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzersettings.h>
+#include <debugger/debuggerrunconfigurationaspect.h>
+
+#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/kitinformation.h>
+#include <projectexplorer/localapplicationrunconfiguration.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
+#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
+
#include <utils/qtcassert.h>
+#include <QTcpServer>
+
using namespace Analyzer;
using namespace ProjectExplorer;
@@ -55,35 +66,65 @@ QmlProfilerRunControlFactory::QmlProfilerRunControlFactory(QObject *parent) :
bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{
- if (mode != QmlProfilerRunMode)
- return false;
- IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
- if (tool)
- return tool->canRun(runConfiguration, mode);
- return false;
+ return mode == QmlProfilerRunMode
+ && (qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)
+ || qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration));
}
-RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration *runConfiguration)
{
- IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
- if (!tool) {
- if (errorMessage)
- *errorMessage = tr("No analyzer tool selected"); // never happens
- return 0;
+ AnalyzerStartParameters sp;
+ EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>();
+
+ // FIXME: This is only used to communicate the connParams settings.
+ if (QmlProjectManager::QmlProjectRunConfiguration *rc1 =
+ qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) {
+ // This is a "plain" .qmlproject.
+ if (environment)
+ sp.environment = environment->environment();
+ sp.workingDirectory = rc1->workingDirectory();
+ sp.debuggee = rc1->observerPath();
+ sp.debuggeeArgs = rc1->viewerArguments();
+ sp.displayName = rc1->displayName();
+ } else if (LocalApplicationRunConfiguration *rc2 =
+ qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
+ if (environment)
+ sp.environment = environment->environment();
+ sp.workingDirectory = rc2->workingDirectory();
+ sp.debuggee = rc2->executable();
+ sp.debuggeeArgs = rc2->commandLineArguments();
+ sp.displayName = rc2->displayName();
+ } else {
+ // What could that be?
+ QTC_ASSERT(false, return sp);
+ }
+ const IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
+ if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
+ QTcpServer server;
+ if (!server.listen(QHostAddress::LocalHost) && !server.listen(QHostAddress::LocalHostIPv6)) {
+ qWarning() << "Cannot open port on host for QML profiling.";
+ return sp;
+ }
+ sp.analyzerHost = server.serverAddress().toString();
+ sp.analyzerPort = server.serverPort();
}
+ sp.startMode = StartLocal;
+ return sp;
+}
+RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+{
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
- AnalyzerStartParameters sp = tool->createStartParameters(runConfiguration, mode);
- sp.toolId = tool->id();
+ AnalyzerStartParameters sp = createQmlProfilerStartParameters(runConfiguration);
+ sp.runMode = mode;
// only desktop device is supported
- const ProjectExplorer::IDevice::ConstPtr device =
- ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
+ const IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
- AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
- QmlProfilerEngine *engine = qobject_cast<QmlProfilerEngine *>(rc->engine());
+ AnalyzerRunControl *rc = AnalyzerManager::createRunControl(sp, runConfiguration);
+ QmlProfilerRunControl *engine = qobject_cast<QmlProfilerRunControl *>(rc);
if (!engine) {
delete rc;
return 0;
@@ -94,7 +135,7 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
connect(runner, SIGNAL(stopped()), engine, SLOT(notifyRemoteFinished()));
connect(runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
engine, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
- connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), runner,
+ connect(engine, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)), runner,
SLOT(start()));
connect(rc, SIGNAL(finished()), runner, SLOT(stop()));
return rc;
diff --git a/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h b/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
index 3973411d93..46f2573df2 100644
--- a/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
+++ b/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
diff --git a/plugins/qmlprofiler/qmlprofilersimplemodel.cpp b/plugins/qmlprofiler/qmlprofilersimplemodel.cpp
index c2fc59892a..21c78fd219 100644
--- a/plugins/qmlprofiler/qmlprofilersimplemodel.cpp
+++ b/plugins/qmlprofiler/qmlprofilersimplemodel.cpp
@@ -71,40 +71,23 @@ int QmlProfilerSimpleModel::count() const
return eventList.count();
}
-void QmlProfilerSimpleModel::addRangedEvent(int type, int bindingType, qint64 startTime, qint64 duration, const QStringList &data, const QmlDebug::QmlEventLocation &location)
+void QmlProfilerSimpleModel::addQmlEvent(int type, int bindingType, qint64 startTime, qint64 duration, const QStringList &data, const QmlDebug::QmlEventLocation &location, qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5)
{
- QString displayName = QString::fromLatin1("%1:%2").arg(
+ QString displayName;
+ if (type == QmlDebug::Painting && bindingType == QmlDebug::AnimationFrame) {
+ displayName = tr("Animations");
+ } else {
+ displayName = QString::fromLatin1("%1:%2").arg(
location.filename,
QString::number(location.line));
- QmlEventData eventData = {displayName, type, bindingType, startTime, duration, data, location, 0, 0, 0, 0, 0};
- eventList.append(eventData);
-
- m_modelManager->modelProxyCountUpdated(m_modelId, startTime, m_modelManager->estimatedProfilingTime());
-}
+ }
-void QmlProfilerSimpleModel::addFrameEvent(qint64 time, int framerate, int animationcount)
-{
- qint64 duration = 1e9 / framerate;
- QmlEventData eventData = {tr("Animations"), QmlDebug::Painting, QmlDebug::AnimationFrame, time, duration, QStringList(), QmlDebug::QmlEventLocation(), framerate, animationcount, 0, 0, 0};
+ QmlEventData eventData = {displayName, type, bindingType, startTime, duration, data, location, ndata1, ndata2, ndata3, ndata4, ndata5};
eventList.append(eventData);
- m_modelManager->modelProxyCountUpdated(m_modelId, time, m_modelManager->estimatedProfilingTime());
-}
-void QmlProfilerSimpleModel::addSceneGraphEvent(int eventType, int SGEtype, qint64 startTime, qint64 timing1, qint64 timing2, qint64 timing3, qint64 timing4, qint64 timing5)
-{
- QmlEventData eventData = {QString(), eventType, SGEtype, startTime, 0, QStringList(), QmlDebug::QmlEventLocation(), timing1, timing2, timing3, timing4, timing5};
- eventList.append(eventData);
m_modelManager->modelProxyCountUpdated(m_modelId, startTime, m_modelManager->estimatedProfilingTime());
}
-void QmlProfilerSimpleModel::addPixmapCacheEvent(qint64 time, int cacheEventType, const QString &url, int width, int height, int refCount)
-{
- QmlDebug::QmlEventLocation location(url, 0, 0);
- QmlEventData eventData = {QString(), QmlDebug::PixmapCacheEvent, cacheEventType, time, 0, QStringList(), location, width, height, refCount, -1, -1};
- eventList.append(eventData);
- m_modelManager->modelProxyCountUpdated(m_modelId, time, m_modelManager->estimatedProfilingTime());
-}
-
qint64 QmlProfilerSimpleModel::lastTimeMark() const
{
if (eventList.isEmpty())
diff --git a/plugins/qmlprofiler/qmlprofilersimplemodel.h b/plugins/qmlprofiler/qmlprofilersimplemodel.h
index 26f27db5f0..2127a2bbcb 100644
--- a/plugins/qmlprofiler/qmlprofilersimplemodel.h
+++ b/plugins/qmlprofiler/qmlprofilersimplemodel.h
@@ -68,10 +68,8 @@ public:
bool isEmpty() const;
const QVector<QmlEventData> &getEvents() const;
int count() const;
- void addRangedEvent(int type, int bindingType, qint64 startTime, qint64 length, const QStringList &data, const QmlDebug::QmlEventLocation &location);
- void addFrameEvent(qint64 time, int framerate, int animationcount);
- void addSceneGraphEvent(int eventType, int SGEtype, qint64 startTime, qint64 timing1, qint64 timing2, qint64 timing3, qint64 timing4, qint64 timing5);
- void addPixmapCacheEvent(qint64 time, int cacheEventType, const QString& url, int width, int height, int refCount);
+ void addQmlEvent(int type, int bindingType, qint64 startTime, qint64 duration, const QStringList &data, const QmlDebug::QmlEventLocation &location,
+ qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5);
qint64 lastTimeMark() const;
virtual void complete();
diff --git a/plugins/qmlprofiler/qmlprofilertool.cpp b/plugins/qmlprofiler/qmlprofilertool.cpp
index de8ffa5b47..48c29616e9 100644
--- a/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -70,8 +70,6 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
-#include <debugger/debuggerrunconfigurationaspect.h>
-
#include <qtsupport/qtkitinformation.h>
#include <QApplication>
@@ -98,18 +96,12 @@ using namespace QmlProjectManager;
class QmlProfilerTool::QmlProfilerToolPrivate
{
public:
- QmlProfilerToolPrivate(QmlProfilerTool *qq) : q(qq) {}
- ~QmlProfilerToolPrivate() {}
-
- QmlProfilerTool *q;
-
QmlProfilerStateManager *m_profilerState;
QmlProfilerClientManager *m_profilerConnections;
QmlProfilerModelManager *m_profilerModelManager;
QmlProfilerViewManager *m_viewContainer;
Utils::FileInProjectFinder m_projectFinder;
- RunConfiguration *m_runConfiguration;
QToolButton *m_recordButton;
QToolButton *m_clearButton;
@@ -124,13 +116,12 @@ public:
};
QmlProfilerTool::QmlProfilerTool(QObject *parent)
- : IAnalyzerTool(parent), d(new QmlProfilerToolPrivate(this))
+ : IAnalyzerTool(parent), d(new QmlProfilerToolPrivate)
{
setObjectName(QLatin1String("QmlProfilerTool"));
d->m_profilerState = 0;
d->m_viewContainer = 0;
- d->m_runConfiguration = 0;
qmlRegisterType<QmlProfilerCanvas>("Monitor", 1, 0, "Canvas2D");
qmlRegisterType<Context2D>();
@@ -206,10 +197,10 @@ IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
return AnyMode;
}
-IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
+AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
{
- QmlProfilerEngine *engine = new QmlProfilerEngine(this, sp, runConfiguration);
+ QmlProfilerRunControl *engine = new QmlProfilerRunControl(sp, runConfiguration);
engine->registerProfilerStateManager(d->m_profilerState);
@@ -236,15 +227,13 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
if (isTcpConnection)
d->m_profilerConnections->setTcpConnection(sp.analyzerHost, sp.analyzerPort);
- d->m_runConfiguration = runConfiguration;
-
//
// Initialize m_projectFinder
//
QString projectDirectory;
- if (d->m_runConfiguration) {
- Project *project = d->m_runConfiguration->target()->project();
+ if (runConfiguration) {
+ Project *project = runConfiguration->target()->project();
projectDirectory = project->projectDirectory();
}
@@ -256,14 +245,6 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
return engine;
}
-bool QmlProfilerTool::canRun(RunConfiguration *runConfiguration, RunMode mode) const
-{
- if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)
- || qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration))
- return mode == runMode();
- return false;
-}
-
static QString sysroot(RunConfiguration *runConfig)
{
QTC_ASSERT(runConfig, return QString());
@@ -273,54 +254,6 @@ static QString sysroot(RunConfiguration *runConfig)
return QString();
}
-AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration *runConfiguration, RunMode mode) const
-{
- Q_UNUSED(mode);
-
- AnalyzerStartParameters sp;
- ProjectExplorer::EnvironmentAspect *environment
- = runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
- Debugger::DebuggerRunConfigurationAspect *debugger
- = runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
- QTC_ASSERT(debugger, return sp);
-
- // FIXME: This is only used to communicate the connParams settings.
- if (QmlProjectRunConfiguration *rc1 =
- qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) {
- // This is a "plain" .qmlproject.
- if (environment)
- sp.environment = environment->environment();
- sp.workingDirectory = rc1->workingDirectory();
- sp.debuggee = rc1->observerPath();
- sp.debuggeeArgs = rc1->viewerArguments();
- sp.displayName = rc1->displayName();
- } else if (LocalApplicationRunConfiguration *rc2 =
- qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
- if (environment)
- sp.environment = environment->environment();
- sp.workingDirectory = rc2->workingDirectory();
- sp.debuggee = rc2->executable();
- sp.debuggeeArgs = rc2->commandLineArguments();
- sp.displayName = rc2->displayName();
- } else {
- // What could that be?
- QTC_ASSERT(false, return sp);
- }
- const ProjectExplorer::IDevice::ConstPtr device =
- ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
- if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
- QTcpServer server;
- if (!server.listen(QHostAddress::LocalHost) && !server.listen(QHostAddress::LocalHostIPv6)) {
- qWarning() << "Cannot open port on host for QML profiling.";
- return sp;
- }
- sp.analyzerHost = server.serverAddress().toString();
- sp.analyzerPort = server.serverPort();
- }
- sp.startMode = StartQml;
- return sp;
-}
-
QWidget *QmlProfilerTool::createWidgets()
{
QTC_ASSERT(!d->m_viewContainer, return 0);
@@ -333,7 +266,6 @@ QWidget *QmlProfilerTool::createWidgets()
connect(d->m_viewContainer, SIGNAL(gotoSourceLocation(QString,int,int)),
this, SLOT(gotoSourceLocation(QString,int,int)));
-
//
// Toolbar
//
@@ -513,7 +445,6 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
}
AnalyzerStartParameters sp;
- sp.toolId = tool->id();
sp.startMode = mode;
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
@@ -529,7 +460,8 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
sp.sysroot = SysRootKitInformation::sysRoot(kit).toString();
sp.analyzerPort = port;
- AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
+ //AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
+ AnalyzerRunControl *rc = tool->createRunControl(sp, 0);
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
ProjectExplorerPlugin::instance()->startRunControl(rc, tool->runMode());
@@ -597,8 +529,7 @@ void QmlProfilerTool::showLoadDialog()
if (ModeManager::currentMode()->id() != MODE_ANALYZE)
AnalyzerManager::showMode();
- if (AnalyzerManager::currentSelectedTool() != this)
- AnalyzerManager::selectTool(this, StartRemote);
+ AnalyzerManager::selectTool(this, StartRemote);
QString filename = QFileDialog::getOpenFileName(Core::ICore::mainWindow(), tr("Load QML Trace"), QString(),
tr("QML traces (*%1)").arg(QLatin1String(TraceFileExtension)));
diff --git a/plugins/qmlprofiler/qmlprofilertool.h b/plugins/qmlprofiler/qmlprofilertool.h
index 412cb6a87f..5a3989e0e1 100644
--- a/plugins/qmlprofiler/qmlprofilertool.h
+++ b/plugins/qmlprofiler/qmlprofilertool.h
@@ -31,7 +31,7 @@
#define QMLPROFILERTOOL_H
#include <analyzerbase/ianalyzertool.h>
-#include <analyzerbase/ianalyzerengine.h>
+#include <analyzerbase/analyzerruncontrol.h>
QT_BEGIN_NAMESPACE
class QMessageBox;
@@ -56,16 +56,9 @@ public:
void extensionsInitialized() {}
- Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
+ Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
- bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
- ProjectExplorer::RunMode mode) const;
-
- Analyzer::AnalyzerStartParameters createStartParameters(
- ProjectExplorer::RunConfiguration *runConfiguration,
- ProjectExplorer::RunMode mode) const;
-
QWidget *createWidgets();
void startTool(Analyzer::StartMode mode);
diff --git a/plugins/qmlprofiler/qmlprofilertracefile.cpp b/plugins/qmlprofiler/qmlprofilertracefile.cpp
index 52bc3816d3..c8405c3d3c 100644
--- a/plugins/qmlprofiler/qmlprofilertracefile.cpp
+++ b/plugins/qmlprofiler/qmlprofilertracefile.cpp
@@ -372,18 +372,11 @@ void QmlProfilerFileReader::processQmlEvents()
QmlEvent &event = m_qmlEvents[eventIndex];
- if (event.type == Painting && event.bindingType == QmlDebug::AnimationFrame) {
- emit frame(range.startTime, range.numericData1, range.numericData2);
- } else if (event.type == PixmapCacheEvent) {
- emit pixmapCacheEvent(range.startTime, event.bindingType, event.filename, range.numericData1, range.numericData2, range.numericData3);
- } else if (event.type == SceneGraphFrameEvent) {
- emit sceneGraphFrame(SceneGraphFrameEvent, event.bindingType, range.startTime, range.numericData1, range.numericData2, range.numericData3, range.numericData4, range.numericData5);
- } else {
- emit rangedEvent(event.type, event.bindingType, range.startTime, range.duration,
- QStringList(event.displayName), QmlEventLocation(event.filename,
- event.line,
- event.column));
- }
+ emit rangedEvent(event.type, event.bindingType, range.startTime, range.duration,
+ QStringList(event.displayName),
+ QmlEventLocation(event.filename, event.line, event.column),
+ range.numericData1,range.numericData2, range.numericData3, range.numericData4, range.numericData5);
+
}
}
@@ -522,11 +515,6 @@ void QmlProfilerFileWriter::save(QIODevice *device)
if (range.numericData5 > 0)
stream.writeAttribute(_("timing5"), QString::number(range.numericData5));
}
-// if (event.type == QmlDebug::Painting && range.animationCount >= 0) {
-// // animation frame
-// stream.writeAttribute(_("framerate"), QString::number(rangedEvent.frameRate));
-// stream.writeAttribute(_("animationcount"), QString::number(rangedEvent.animationCount));
-// }
stream.writeEndElement();
}
stream.writeEndElement(); // profilerDataModel
diff --git a/plugins/qmlprofiler/qmlprofilertracefile.h b/plugins/qmlprofiler/qmlprofilertracefile.h
index 7733c477a5..f4e1b71d10 100644
--- a/plugins/qmlprofiler/qmlprofilertracefile.h
+++ b/plugins/qmlprofiler/qmlprofilertracefile.h
@@ -86,10 +86,8 @@ signals:
void traceEndTime(qint64 traceStartTime);
void rangedEvent(int type, int bindingType, qint64 startTime, qint64 length,
- const QStringList &data, const QmlDebug::QmlEventLocation &location);
- void frame(qint64 time, int frameRate, int animationCount);
- void sceneGraphFrame(int eventType, int sgEventType, qint64 time, qint64 param1, qint64 param2, qint64 param3, qint64 param4, qint64 param5);
- void pixmapCacheEvent(qint64 time, int cacheEventType, const QString& url, int width, int height, int refCount);
+ const QStringList &data, const QmlDebug::QmlEventLocation &location,
+ qint64 param1, qint64 param2, qint64 param3, qint64 param4, qint64 param5);
void error(const QString &error);
private: