aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-17 16:42:21 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-19 11:33:20 +0000
commit7b4e253a1e0d0ba985251ce1fafbf634d95cc744 (patch)
tree5cb56c2057bc4bafcfe7b67f50ea1dcdce28d1ae /src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
parent2217eef3a3f5832b6955dc4a2e4ff061364a6a15 (diff)
QmlProfiler: Support local connections on Qt >= 5.6
This removes the need to receive messages from the application via stderr. The "Connecting to socket" is still parsed, but only for diagnostic purposes. If it doesn't arrive, the profiling will still work. Change-Id: I022691293da2a1e671ba1263bc76e4044bf1a5b7 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmlprofiler/localqmlprofilerrunner.cpp')
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
index 2d59e4e3a1..9d49420f27 100644
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
+++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
@@ -44,6 +44,7 @@
#include <qmldebug/qmldebugcommandlinearguments.h>
#include <QTcpServer>
+#include <QTemporaryFile>
using namespace QmlProfiler;
using namespace ProjectExplorer;
@@ -71,7 +72,7 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
conf.executableArguments = sp.debuggeeArgs;
conf.workingDirectory = sp.workingDirectory;
conf.environment = sp.environment;
-
+ conf.socket = sp.analyzerSocket;
conf.port = sp.analyzerPort;
if (conf.executable.isEmpty()) {
@@ -92,6 +93,17 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
return rc;
}
+QString LocalQmlProfilerRunner::findFreeSocket()
+{
+ QTemporaryFile file;
+ if (file.open()) {
+ return file.fileName();
+ } else {
+ qWarning() << "Could not open a temporary file to find a debug socket.";
+ return QString();
+ }
+}
+
quint16 LocalQmlProfilerRunner::findFreePort(QString &host)
{
QTcpServer server;
@@ -121,15 +133,21 @@ LocalQmlProfilerRunner::~LocalQmlProfilerRunner()
void LocalQmlProfilerRunner::start()
{
- QString arguments = QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices,
- m_configuration.port);
+ QString arguments = m_configuration.socket.isEmpty() ?
+ QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices,
+ m_configuration.port) :
+ QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlProfilerServices,
+ m_configuration.socket);
+
if (!m_configuration.executableArguments.isEmpty())
arguments += QLatin1Char(' ') + m_configuration.executableArguments;
- if (QmlProfilerPlugin::debugOutput)
- qWarning("QmlProfiler: Launching %s:%d", qPrintable(m_configuration.executable),
- m_configuration.port);
+ if (QmlProfilerPlugin::debugOutput) {
+ qWarning("QmlProfiler: Launching %s:%s", qPrintable(m_configuration.executable),
+ qPrintable(m_configuration.socket.isEmpty() ?
+ QString::number(m_configuration.port) : m_configuration.socket));
+ }
m_launcher.setWorkingDirectory(m_configuration.workingDirectory);
m_launcher.setEnvironment(m_configuration.environment);