2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-25 09:25:17 +01:00
|
|
|
|
2017-05-29 16:04:31 +02:00
|
|
|
#include "qmlprofilerclientmanager.h"
|
2015-07-01 18:11:54 +02:00
|
|
|
#include "qmlprofilerruncontrol.h"
|
2016-01-19 17:25:18 +01:00
|
|
|
#include "qmlprofilertool.h"
|
2017-05-29 16:04:31 +02:00
|
|
|
#include "qmlprofilerplugin.h"
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2016-02-24 14:42:52 +01:00
|
|
|
#include <debugger/analyzer/analyzermanager.h>
|
2016-01-28 18:24:08 +01:00
|
|
|
|
2011-06-09 14:30:15 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2011-06-28 15:51:20 +02:00
|
|
|
#include <coreplugin/helpmanager.h>
|
2016-05-30 16:56:46 +02:00
|
|
|
|
2017-05-29 16:04:31 +02:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
2013-01-29 18:00:30 +01:00
|
|
|
#include <projectexplorer/environmentaspect.h>
|
2016-05-30 16:56:46 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2017-05-29 16:04:31 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2016-05-30 16:56:46 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/projectexplorericons.h>
|
2017-05-29 16:04:31 +02:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2016-01-25 15:00:20 +01:00
|
|
|
#include <projectexplorer/runnables.h>
|
2016-05-30 16:56:46 +02:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
#include <qtsupport/baseqtversion.h>
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2013-10-15 16:46:35 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2017-05-29 16:04:31 +02:00
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
#include <qmldebug/qmloutputparser.h>
|
2017-05-29 16:04:31 +02:00
|
|
|
#include <qmldebug/qmldebugcommandlinearguments.h>
|
2011-05-04 16:50:24 +02:00
|
|
|
|
2016-05-30 16:56:46 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2017-05-29 16:04:31 +02:00
|
|
|
#include <QApplication>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QMessageBox>
|
2013-10-15 16:46:35 +02:00
|
|
|
#include <QPushButton>
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
using namespace Debugger;
|
2013-08-29 19:00:34 +02:00
|
|
|
using namespace Core;
|
2011-07-05 12:14:41 +02:00
|
|
|
using namespace ProjectExplorer;
|
2017-05-29 16:04:31 +02:00
|
|
|
using namespace QmlProfiler::Internal;
|
2011-06-30 13:44:22 +02:00
|
|
|
|
2011-05-20 13:36:16 +02:00
|
|
|
namespace QmlProfiler {
|
2011-05-04 16:50:24 +02:00
|
|
|
|
2017-06-14 10:50:18 +02:00
|
|
|
static QString QmlServerUrl = "QmlServerUrl";
|
|
|
|
|
|
2011-05-04 16:50:24 +02:00
|
|
|
//
|
2015-07-01 18:11:54 +02:00
|
|
|
// QmlProfilerRunControlPrivate
|
2011-05-04 16:50:24 +02:00
|
|
|
//
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
class QmlProfilerRunner::QmlProfilerRunnerPrivate
|
2011-05-20 13:36:16 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2016-01-06 11:40:52 +01:00
|
|
|
QmlProfilerStateManager *m_profilerState = 0;
|
2011-05-20 13:36:16 +02:00
|
|
|
};
|
|
|
|
|
|
2011-05-04 16:50:24 +02:00
|
|
|
//
|
2015-07-01 18:11:54 +02:00
|
|
|
// QmlProfilerRunControl
|
2011-05-04 16:50:24 +02:00
|
|
|
//
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
QmlProfilerRunner::QmlProfilerRunner(RunControl *runControl)
|
|
|
|
|
: RunWorker(runControl)
|
|
|
|
|
, d(new QmlProfilerRunnerPrivate)
|
2011-03-11 12:22:57 +01:00
|
|
|
{
|
2017-06-14 10:50:18 +02:00
|
|
|
setDisplayName("QmlProfilerRunner");
|
2017-05-29 13:14:16 +02:00
|
|
|
runControl->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR);
|
2017-07-05 15:17:38 +02:00
|
|
|
setSupportsReRunning(false);
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
QmlProfilerRunner::~QmlProfilerRunner()
|
2011-03-11 12:22:57 +01:00
|
|
|
{
|
2017-05-29 13:14:16 +02:00
|
|
|
if (runControl()->isRunning() && d->m_profilerState)
|
2017-06-26 18:40:11 +02:00
|
|
|
runControl()->initiateStop();
|
2011-03-11 12:22:57 +01:00
|
|
|
delete d;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
void QmlProfilerRunner::start()
|
2011-03-11 12:22:57 +01:00
|
|
|
{
|
2017-05-09 10:25:11 +02:00
|
|
|
Internal::QmlProfilerTool::instance()->finalizeRunControl(this);
|
2017-05-29 16:04:31 +02:00
|
|
|
QTC_ASSERT(d->m_profilerState, return);
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2017-06-14 10:50:18 +02:00
|
|
|
QUrl serverUrl = this->serverUrl();
|
2016-01-28 18:24:08 +01:00
|
|
|
|
2017-08-10 14:13:18 +02:00
|
|
|
QmlProfilerClientManager *clientManager = Internal::QmlProfilerTool::clientManager();
|
|
|
|
|
|
|
|
|
|
connect(clientManager, &QmlProfilerClientManager::connectionFailed,
|
|
|
|
|
this, [this, clientManager] {
|
|
|
|
|
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow());
|
|
|
|
|
infoBox->setIcon(QMessageBox::Critical);
|
|
|
|
|
infoBox->setWindowTitle(QmlProfilerTool::tr("Qt Creator"));
|
|
|
|
|
infoBox->setText(QmlProfilerTool::tr("Could not connect to the in-process QML profiler.\n"
|
|
|
|
|
"Do you want to retry?"));
|
|
|
|
|
infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help);
|
|
|
|
|
infoBox->setDefaultButton(QMessageBox::Retry);
|
|
|
|
|
infoBox->setModal(true);
|
|
|
|
|
|
|
|
|
|
connect(infoBox, &QDialog::finished, this, [clientManager, this](int result) {
|
|
|
|
|
switch (result) {
|
|
|
|
|
case QMessageBox::Retry:
|
|
|
|
|
clientManager->retryConnect();
|
|
|
|
|
break;
|
|
|
|
|
case QMessageBox::Help:
|
|
|
|
|
HelpManager::handleHelpRequest(
|
|
|
|
|
"qthelp://org.qt-project.qtcreator/doc/creator-debugging-qml.html");
|
|
|
|
|
Q_FALLTHROUGH();
|
|
|
|
|
case QMessageBox::Cancel:
|
|
|
|
|
// The actual error message has already been logged.
|
|
|
|
|
QmlProfilerTool::logState(QmlProfilerTool::tr("Failed to connect."));
|
|
|
|
|
cancelProcess();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
infoBox->show();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
clientManager->setServerUrl(serverUrl);
|
2017-06-13 11:43:04 +02:00
|
|
|
if (serverUrl.port() != -1) {
|
2017-05-29 16:04:31 +02:00
|
|
|
clientManager->connectToTcpServer();
|
2017-08-10 14:13:18 +02:00
|
|
|
} else {
|
|
|
|
|
clientManager->startLocalServer();
|
2017-05-29 16:04:31 +02:00
|
|
|
}
|
2011-05-04 16:50:24 +02:00
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
|
2017-05-29 16:04:31 +02:00
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
reportStarted();
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
void QmlProfilerRunner::stop()
|
2011-03-11 12:22:57 +01:00
|
|
|
{
|
2017-03-13 13:48:55 +01:00
|
|
|
QTC_ASSERT(d->m_profilerState, return);
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
switch (d->m_profilerState->currentState()) {
|
2015-10-20 12:48:26 +02:00
|
|
|
case QmlProfilerStateManager::AppRunning:
|
2012-02-24 10:47:17 +01:00
|
|
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppStopRequested);
|
2017-08-09 13:45:08 +02:00
|
|
|
break;
|
2015-10-20 12:48:26 +02:00
|
|
|
case QmlProfilerStateManager::AppStopRequested:
|
|
|
|
|
// Pressed "stop" a second time. Kill the application without collecting data
|
|
|
|
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
|
2017-08-09 13:45:08 +02:00
|
|
|
reportStopped();
|
2015-10-20 12:48:26 +02:00
|
|
|
break;
|
2015-09-11 16:10:58 +02:00
|
|
|
case QmlProfilerStateManager::Idle:
|
|
|
|
|
case QmlProfilerStateManager::AppDying:
|
2012-05-08 15:14:11 +02:00
|
|
|
// valid, but no further action is needed
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
2012-07-27 15:43:00 +02:00
|
|
|
default: {
|
|
|
|
|
const QString message = QString::fromLatin1("Unexpected engine stop from state %1 in %2:%3")
|
|
|
|
|
.arg(d->m_profilerState->currentStateAsString(), QString::fromLatin1(__FILE__), QString::number(__LINE__));
|
|
|
|
|
qWarning("%s", qPrintable(message));
|
|
|
|
|
}
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
2011-05-04 16:50:24 +02:00
|
|
|
}
|
2016-03-02 13:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
void QmlProfilerRunner::notifyRemoteFinished()
|
2011-03-24 12:42:15 +01:00
|
|
|
{
|
2012-02-24 10:47:17 +01:00
|
|
|
QTC_ASSERT(d->m_profilerState, return);
|
2011-07-13 14:47:34 +02:00
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
switch (d->m_profilerState->currentState()) {
|
2015-09-11 16:10:58 +02:00
|
|
|
case QmlProfilerStateManager::AppRunning:
|
2014-03-18 13:00:21 +01:00
|
|
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
2015-09-11 16:10:58 +02:00
|
|
|
case QmlProfilerStateManager::Idle:
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
2015-09-11 16:10:58 +02:00
|
|
|
default:
|
2012-07-27 15:43:00 +02:00
|
|
|
const QString message = QString::fromLatin1("Process died unexpectedly from state %1 in %2:%3")
|
|
|
|
|
.arg(d->m_profilerState->currentStateAsString(), QString::fromLatin1(__FILE__), QString::number(__LINE__));
|
|
|
|
|
qWarning("%s", qPrintable(message));
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2011-04-14 15:23:17 +02:00
|
|
|
}
|
2011-04-06 12:26:19 +02:00
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
void QmlProfilerRunner::cancelProcess()
|
2011-05-20 13:36:16 +02:00
|
|
|
{
|
2012-02-24 10:47:17 +01:00
|
|
|
QTC_ASSERT(d->m_profilerState, return);
|
2011-04-14 16:05:41 +02:00
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
switch (d->m_profilerState->currentState()) {
|
2015-09-11 16:10:58 +02:00
|
|
|
case QmlProfilerStateManager::Idle:
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
2015-09-11 16:10:58 +02:00
|
|
|
case QmlProfilerStateManager::AppRunning:
|
2012-05-08 15:14:11 +02:00
|
|
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
|
|
|
|
default: {
|
2012-07-27 15:43:00 +02:00
|
|
|
const QString message = QString::fromLatin1("Unexpected process termination requested with state %1 in %2:%3")
|
|
|
|
|
.arg(d->m_profilerState->currentStateAsString(), QString::fromLatin1(__FILE__), QString::number(__LINE__));
|
|
|
|
|
qWarning("%s", qPrintable(message));
|
2012-02-24 10:47:17 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2011-04-06 12:26:19 +02:00
|
|
|
}
|
2017-05-29 16:04:31 +02:00
|
|
|
runControl()->initiateStop();
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
void QmlProfilerRunner::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
|
2012-02-24 10:47:17 +01:00
|
|
|
{
|
|
|
|
|
// disconnect old
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (d->m_profilerState)
|
2015-10-30 12:35:17 +01:00
|
|
|
disconnect(d->m_profilerState, &QmlProfilerStateManager::stateChanged,
|
2017-05-29 13:14:16 +02:00
|
|
|
this, &QmlProfilerRunner::profilerStateChanged);
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
d->m_profilerState = profilerState;
|
|
|
|
|
|
|
|
|
|
// connect
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (d->m_profilerState)
|
2015-10-30 12:35:17 +01:00
|
|
|
connect(d->m_profilerState, &QmlProfilerStateManager::stateChanged,
|
2017-05-29 13:14:16 +02:00
|
|
|
this, &QmlProfilerRunner::profilerStateChanged);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
2017-05-29 13:14:16 +02:00
|
|
|
void QmlProfilerRunner::profilerStateChanged()
|
2012-02-24 10:47:17 +01:00
|
|
|
{
|
|
|
|
|
switch (d->m_profilerState->currentState()) {
|
2015-09-11 16:10:58 +02:00
|
|
|
case QmlProfilerStateManager::Idle:
|
2017-08-08 15:11:23 +02:00
|
|
|
reportStopped();
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-13 11:43:04 +02:00
|
|
|
void QmlProfilerRunner::setServerUrl(const QUrl &serverUrl)
|
2017-05-29 16:04:31 +02:00
|
|
|
{
|
2017-06-14 10:50:18 +02:00
|
|
|
recordData(QmlServerUrl, serverUrl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QUrl QmlProfilerRunner::serverUrl() const
|
|
|
|
|
{
|
|
|
|
|
QVariant recordedServer = recordedData(QmlServerUrl);
|
2017-06-29 18:32:01 +02:00
|
|
|
return recordedServer.toUrl();
|
2017-06-14 10:50:18 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
//
|
|
|
|
|
// LocalQmlProfilerSupport
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
static QUrl localServerUrl(RunControl *runControl)
|
2017-06-14 10:50:18 +02:00
|
|
|
{
|
2017-06-26 16:48:28 +02:00
|
|
|
QUrl serverUrl;
|
|
|
|
|
RunConfiguration *runConfiguration = runControl->runConfiguration();
|
|
|
|
|
Kit *kit = runConfiguration->target()->kit();
|
|
|
|
|
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
|
|
|
|
if (version) {
|
|
|
|
|
if (version->qtVersion() >= QtSupport::QtVersionNumber(5, 6, 0))
|
2017-06-29 18:32:01 +02:00
|
|
|
serverUrl = urlFromLocalSocket();
|
2017-06-26 16:48:28 +02:00
|
|
|
else
|
2017-06-29 18:32:01 +02:00
|
|
|
serverUrl = urlFromLocalHostAndFreePort();
|
2017-06-26 16:48:28 +02:00
|
|
|
} else {
|
|
|
|
|
qWarning("Running QML profiler on Kit without Qt version?");
|
2017-06-29 18:32:01 +02:00
|
|
|
serverUrl = urlFromLocalHostAndFreePort();
|
2017-06-26 16:48:28 +02:00
|
|
|
}
|
|
|
|
|
return serverUrl;
|
|
|
|
|
}
|
2017-05-29 16:04:31 +02:00
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl)
|
|
|
|
|
: LocalQmlProfilerSupport(runControl, localServerUrl(runControl))
|
|
|
|
|
{
|
|
|
|
|
}
|
2017-05-29 16:04:31 +02:00
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const QUrl &serverUrl)
|
|
|
|
|
: RunWorker(runControl)
|
|
|
|
|
{
|
2017-07-19 17:34:31 +02:00
|
|
|
setDisplayName("LocalQmlProfilerSupport");
|
|
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
m_profiler = new QmlProfilerRunner(runControl);
|
|
|
|
|
m_profiler->setServerUrl(serverUrl);
|
2017-08-08 15:11:23 +02:00
|
|
|
addStopDependency(m_profiler);
|
2017-05-29 16:04:31 +02:00
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
StandardRunnable debuggee = runnable().as<StandardRunnable>();
|
|
|
|
|
QString arguments = QmlDebug::qmlDebugArguments(QmlDebug::QmlProfilerServices, serverUrl);
|
2017-05-29 16:04:31 +02:00
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
if (!debuggee.commandLineArguments.isEmpty())
|
|
|
|
|
arguments += ' ' + debuggee.commandLineArguments;
|
|
|
|
|
|
|
|
|
|
debuggee.commandLineArguments = arguments;
|
|
|
|
|
debuggee.runMode = ApplicationLauncher::Gui;
|
|
|
|
|
|
|
|
|
|
m_profilee = new SimpleTargetRunner(runControl);
|
|
|
|
|
m_profilee->setRunnable(debuggee);
|
2017-08-08 14:09:50 +02:00
|
|
|
addStartDependency(m_profilee);
|
2017-08-09 10:18:46 +02:00
|
|
|
|
|
|
|
|
// We need to open the local server before the application tries to connect.
|
|
|
|
|
// In the TCP case, it doesn't hurt either to start the profiler before.
|
|
|
|
|
m_profilee->addStartDependency(m_profiler);
|
|
|
|
|
|
2017-08-08 15:11:23 +02:00
|
|
|
m_profilee->addStopDependency(this);
|
2017-05-29 16:04:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
void LocalQmlProfilerSupport::start()
|
2017-05-29 16:04:31 +02:00
|
|
|
{
|
2017-06-26 16:48:28 +02:00
|
|
|
reportStarted();
|
|
|
|
|
emit localRunnerStarted();
|
2017-05-29 16:04:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-26 16:48:28 +02:00
|
|
|
void LocalQmlProfilerSupport::stop()
|
2017-05-29 16:04:31 +02:00
|
|
|
{
|
2017-06-26 16:48:28 +02:00
|
|
|
reportStopped();
|
|
|
|
|
emit localRunnerStopped();
|
2017-05-29 16:04:31 +02:00
|
|
|
}
|
|
|
|
|
|
2011-05-20 13:36:16 +02:00
|
|
|
} // namespace QmlProfiler
|