forked from qt-creator/qt-creator
QmlProfiler: Support profiling via CODA on Symbian
Change-Id: I44be1a67c95814a78c82b17e991e5e3a722a63c8 Reviewed-by: Christiaan Janssen Reviewed-on: http://codereview.qt.nokia.com/428 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -92,9 +92,7 @@ AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent)
|
||||
|
||||
bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
|
||||
{
|
||||
return runConfiguration->isEnabled() && mode == Constants::MODE_ANALYZE
|
||||
&& (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)
|
||||
|| qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration));
|
||||
return runConfiguration->isEnabled() && mode == Constants::MODE_ANALYZE;
|
||||
}
|
||||
|
||||
ProjectExplorer::RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration,
|
||||
@@ -102,9 +100,16 @@ ProjectExplorer::RunControl *AnalyzerRunControlFactory::create(RunConfiguration
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
|
||||
const AnalyzerStartParameters sp
|
||||
= qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)
|
||||
? localStartParameters(runConfiguration) : remoteLinuxStartParameters(runConfiguration);
|
||||
AnalyzerStartParameters sp;
|
||||
if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
sp = localStartParameters(runConfiguration);
|
||||
} else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp = remoteLinuxStartParameters(runConfiguration);
|
||||
} else {
|
||||
// might be S60DeviceRunfiguration, or something else ...
|
||||
sp.startMode = StartRemote;
|
||||
}
|
||||
|
||||
return create(sp, runConfiguration);
|
||||
}
|
||||
|
||||
|
@@ -16,5 +16,6 @@
|
||||
<dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
|
||||
<dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
|
||||
<dependency name=\"AnalyzerBase\" version=\"$$QTCREATOR_VERSION\"/>
|
||||
<dependency name=\"Qt4ProjectManager\" version=\"$$QTCREATOR_VERSION\"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
82
src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp
Normal file
82
src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** No Commercial Usage
|
||||
**
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "codaqmlprofilerrunner.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <analyzerbase/analyzerconstants.h>
|
||||
#include <qt4projectmanager/qt-s60/codaruncontrol.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace QmlProfiler::Internal;
|
||||
|
||||
CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configuration,
|
||||
QObject *parent) :
|
||||
AbstractQmlProfilerRunner(parent),
|
||||
m_runControl(new CodaRunControl(configuration, Analyzer::Constants::MODE_ANALYZE))
|
||||
{
|
||||
connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped()));
|
||||
connect(m_runControl,
|
||||
SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)),
|
||||
this, SLOT(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)));
|
||||
}
|
||||
|
||||
CodaQmlProfilerRunner::~CodaQmlProfilerRunner()
|
||||
{
|
||||
delete m_runControl;
|
||||
}
|
||||
|
||||
void CodaQmlProfilerRunner::start()
|
||||
{
|
||||
QTC_ASSERT(m_runControl, return);
|
||||
m_runControl->start();
|
||||
}
|
||||
|
||||
void CodaQmlProfilerRunner::stop()
|
||||
{
|
||||
QTC_ASSERT(m_runControl, return);
|
||||
m_runControl->stop();
|
||||
}
|
||||
|
||||
void CodaQmlProfilerRunner::appendMessage(ProjectExplorer::RunControl *, const QString &message,
|
||||
Utils::OutputFormat format)
|
||||
{
|
||||
emit appendMessage(message, format);
|
||||
}
|
||||
|
71
src/plugins/qmlprofiler/codaqmlprofilerrunner.h
Normal file
71
src/plugins/qmlprofiler/codaqmlprofilerrunner.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
** No Commercial Usage
|
||||
**
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef CODAQMLPROFILERRUNNER_H
|
||||
#define CODAQMLPROFILERRUNNER_H
|
||||
|
||||
#include "abstractqmlprofilerrunner.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
class CodaQmlProfilerRunner : public AbstractQmlProfilerRunner
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(CodaQmlProfilerRunner)
|
||||
|
||||
using AbstractQmlProfilerRunner::appendMessage; // don't hide signal
|
||||
public:
|
||||
explicit CodaQmlProfilerRunner(Qt4ProjectManager::S60DeviceRunConfiguration *configuration,
|
||||
QObject *parent = 0);
|
||||
~CodaQmlProfilerRunner();
|
||||
|
||||
// AbstractQmlProfilerRunner
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
|
||||
private slots:
|
||||
void appendMessage(ProjectExplorer::RunControl *, const QString &message,
|
||||
Utils::OutputFormat format);
|
||||
private:
|
||||
ProjectExplorer::RunControl *m_runControl;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
|
||||
#endif // CODAQMLPROFILERRUNNER_H
|
@@ -7,6 +7,7 @@ include(../../qtcreatorplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../plugins/analyzerbase/analyzerbase.pri)
|
||||
include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri)
|
||||
include(../../plugins/qt4projectmanager/qt4projectmanager.pri)
|
||||
include(../../libs/qmljsdebugclient/qmljsdebugclient-lib.pri)
|
||||
|
||||
QT += network script declarative
|
||||
@@ -22,7 +23,8 @@ SOURCES += \
|
||||
qmlprofilerattachdialog.cpp \
|
||||
qmlprofilersummaryview.cpp \
|
||||
qmlprojectanalyzerruncontrolfactory.cpp \
|
||||
localqmlprofilerrunner.cpp
|
||||
localqmlprofilerrunner.cpp \
|
||||
codaqmlprofilerrunner.cpp
|
||||
|
||||
HEADERS += \
|
||||
qmlprofilerconstants.h \
|
||||
@@ -36,7 +38,8 @@ HEADERS += \
|
||||
qmlprofilersummaryview.h \
|
||||
qmlprojectanalyzerruncontrolfactory.h \
|
||||
abstractqmlprofilerrunner.h \
|
||||
localqmlprofilerrunner.h
|
||||
localqmlprofilerrunner.h \
|
||||
codaqmlprofilerrunner.h
|
||||
|
||||
RESOURCES += \
|
||||
qml/qml.qrc
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilertool.h"
|
||||
#include "localqmlprofilerrunner.h"
|
||||
#include "codaqmlprofilerrunner.h"
|
||||
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
#include <analyzerbase/analyzerconstants.h>
|
||||
@@ -43,6 +44,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <qmljsdebugclient/qdeclarativedebugclient_p.h>
|
||||
#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -65,8 +67,30 @@ namespace Internal {
|
||||
// QmlProfilerEnginePrivate
|
||||
//
|
||||
|
||||
static AbstractQmlProfilerRunner *
|
||||
createRunner(const Analyzer::AnalyzerStartParameters &m_params, QObject *parent)
|
||||
class QmlProfilerEngine::QmlProfilerEnginePrivate
|
||||
{
|
||||
public:
|
||||
QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {}
|
||||
~QmlProfilerEnginePrivate() {}
|
||||
|
||||
bool attach(const QString &address, uint port);
|
||||
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
const Analyzer::AnalyzerStartParameters &m_params,
|
||||
QObject *parent);
|
||||
|
||||
QmlProfilerEngine *q;
|
||||
|
||||
Analyzer::AnalyzerStartParameters m_params;
|
||||
AbstractQmlProfilerRunner *m_runner;
|
||||
bool m_running;
|
||||
bool m_fetchingData;
|
||||
bool m_delayedDelete;
|
||||
};
|
||||
|
||||
AbstractQmlProfilerRunner *
|
||||
QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *configuration,
|
||||
const Analyzer::AnalyzerStartParameters &m_params,
|
||||
QObject *parent)
|
||||
{
|
||||
AbstractQmlProfilerRunner *runner = 0;
|
||||
if (m_params.startMode == Analyzer::StartLocal) {
|
||||
@@ -78,32 +102,15 @@ createRunner(const Analyzer::AnalyzerStartParameters &m_params, QObject *parent)
|
||||
configuration.port = m_params.connParams.port;
|
||||
|
||||
runner = new LocalQmlProfilerRunner(configuration, parent);
|
||||
|
||||
} else if (m_params.startMode == Analyzer::StartRemote) {
|
||||
|
||||
if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config
|
||||
= qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(configuration)) {
|
||||
runner = new CodaQmlProfilerRunner(s60Config, parent);
|
||||
}
|
||||
}
|
||||
return runner;
|
||||
}
|
||||
|
||||
|
||||
class QmlProfilerEngine::QmlProfilerEnginePrivate
|
||||
{
|
||||
public:
|
||||
QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {}
|
||||
~QmlProfilerEnginePrivate() {}
|
||||
|
||||
bool attach(const QString &address, uint port);
|
||||
|
||||
QmlProfilerEngine *q;
|
||||
|
||||
Analyzer::AnalyzerStartParameters m_params;
|
||||
AbstractQmlProfilerRunner *m_runner;
|
||||
bool m_running;
|
||||
bool m_fetchingData;
|
||||
bool m_delayedDelete;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// QmlProfilerEngine
|
||||
//
|
||||
@@ -129,10 +136,9 @@ QmlProfilerEngine::~QmlProfilerEngine()
|
||||
void QmlProfilerEngine::start()
|
||||
{
|
||||
QTC_ASSERT(!d->m_runner, return);
|
||||
d->m_runner = createRunner(d->m_params, this);
|
||||
d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), d->m_params, this);
|
||||
QTC_ASSERT(d->m_runner, return);
|
||||
|
||||
connect(d->m_runner, SIGNAL(started()), this, SIGNAL(processRunning()));
|
||||
connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped()));
|
||||
connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||
this, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
|
||||
@@ -148,6 +154,7 @@ void QmlProfilerEngine::stop()
|
||||
if (d->m_fetchingData) {
|
||||
if (d->m_running)
|
||||
d->m_delayedDelete = true;
|
||||
// will result in dataReceived() call
|
||||
emit stopRecording();
|
||||
} else {
|
||||
finishProcess();
|
||||
|
@@ -66,6 +66,8 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
|
||||
|
||||
#include <QtCore/QFile>
|
||||
|
||||
#include <QtGui/QHBoxLayout>
|
||||
@@ -96,8 +98,15 @@ public:
|
||||
QAction *m_attachAction;
|
||||
QToolButton *m_recordButton;
|
||||
bool m_recordingEnabled;
|
||||
QString m_host;
|
||||
quint64 m_port;
|
||||
|
||||
enum ConnectMode {
|
||||
TcpConnection, OstConnection
|
||||
};
|
||||
|
||||
ConnectMode m_connectMode;
|
||||
QString m_tcpHost;
|
||||
quint64 m_tcpPort;
|
||||
QString m_ostDevice;
|
||||
};
|
||||
|
||||
QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
||||
@@ -142,8 +151,22 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
|
||||
{
|
||||
QmlProfilerEngine *engine = new QmlProfilerEngine(sp, runConfiguration);
|
||||
|
||||
d->m_host = sp.connParams.host;
|
||||
d->m_port = sp.connParams.port;
|
||||
d->m_connectMode = QmlProfilerToolPrivate::TcpConnection;
|
||||
|
||||
if (Qt4ProjectManager::S60DeployConfiguration *deployConfig
|
||||
= qobject_cast<Qt4ProjectManager::S60DeployConfiguration*>(
|
||||
runConfiguration->target()->activeDeployConfiguration())) {
|
||||
if (deployConfig->communicationChannel()
|
||||
== Qt4ProjectManager::S60DeployConfiguration::CommunicationCodaSerialConnection) {
|
||||
d->m_connectMode = QmlProfilerToolPrivate::OstConnection;
|
||||
d->m_ostDevice = deployConfig->serialPortName();
|
||||
}
|
||||
}
|
||||
|
||||
if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) {
|
||||
d->m_tcpHost = sp.connParams.host;
|
||||
d->m_tcpPort = sp.connParams.port;
|
||||
}
|
||||
|
||||
d->m_runConfiguration = runConfiguration;
|
||||
d->m_project = runConfiguration->target()->project();
|
||||
@@ -274,10 +297,18 @@ void QmlProfilerTool::connectToClient()
|
||||
{
|
||||
if (!d->m_client || d->m_client->state() != QAbstractSocket::UnconnectedState)
|
||||
return;
|
||||
if (QmlProfilerPlugin::debugOutput)
|
||||
qWarning("QmlProfiler: Connecting to %s:%lld ...", qPrintable(d->m_host), d->m_port);
|
||||
|
||||
d->m_client->connectToHost(d->m_host, d->m_port);
|
||||
if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) {
|
||||
if (QmlProfilerPlugin::debugOutput)
|
||||
qWarning("QmlProfiler: Connecting to %s:%lld ...", qPrintable(d->m_tcpHost), d->m_tcpPort);
|
||||
|
||||
d->m_client->connectToHost(d->m_tcpHost, d->m_tcpPort);
|
||||
} else {
|
||||
if (QmlProfilerPlugin::debugOutput)
|
||||
qWarning("QmlProfiler: Connecting to ost device %s...", qPrintable(d->m_ostDevice));
|
||||
|
||||
d->m_client->connectToOst(d->m_ostDevice);
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerTool::disconnectClient()
|
||||
@@ -367,8 +398,8 @@ void QmlProfilerTool::attach()
|
||||
if (result == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
d->m_port = dialog.port();
|
||||
d->m_host = dialog.address();
|
||||
d->m_tcpPort = dialog.port();
|
||||
d->m_tcpHost = dialog.address();
|
||||
|
||||
connectClient();
|
||||
AnalyzerManager::instance()->showMode();
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <debugger/debuggerconstants.h>
|
||||
#include <analyzerbase/analyzerconstants.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
@@ -90,7 +91,9 @@ S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration, const Q
|
||||
m_targetName = s60runConfig->targetName();
|
||||
m_commandLineArguments = s60runConfig->commandLineArguments();
|
||||
QString qmlArgs = s60runConfig->qmlCommandLineArguments();
|
||||
if (mode == Debugger::Constants::DEBUGMODE && qmlArgs.length()) {
|
||||
if ((mode == Debugger::Constants::DEBUGMODE)
|
||||
|| (mode == Analyzer::Constants::MODE_ANALYZE)
|
||||
&& !qmlArgs.isEmpty()) {
|
||||
m_commandLineArguments.prepend(' ');
|
||||
m_commandLineArguments.prepend(qmlArgs);
|
||||
}
|
||||
|
Reference in New Issue
Block a user