Ios: Re-enable QmlProfiler

Change-Id: I55a102c8f3a0c748b483a2fa36aa51947d13764a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
hjk
2017-06-14 14:01:16 +02:00
parent 38b4dec764
commit 06014fb56f
3 changed files with 29 additions and 38 deletions

View File

@@ -182,8 +182,7 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) { if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) {
(void) new Ios::Internal::IosRunSupport(runControl); (void) new Ios::Internal::IosRunSupport(runControl);
} else if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { } else if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
runControl->createWorker(mode); (void) new IosQmlProfilerSupport(runControl);
(void) new IosAnalyzeSupport(runControl);
} else { } else {
(void) new IosDebugSupport(runControl); (void) new IosDebugSupport(runControl);
} }

View File

@@ -357,48 +357,44 @@ void IosRunSupport::stop()
} }
// //
// IosAnalyzeSupport // IosQmlProfilerSupport
// //
IosAnalyzeSupport::IosAnalyzeSupport(RunControl *runControl) IosQmlProfilerSupport::IosQmlProfilerSupport(RunControl *runControl)
: IosRunner(runControl) : RunWorker(runControl)
{ {
m_runner = new IosRunner(runControl);
addDependency(m_runner);
setDisplayName("IosAnalyzeSupport"); setDisplayName("IosAnalyzeSupport");
setQmlDebugging(QmlDebug::QmlProfilerServices);
auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration()); auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration());
StandardRunnable runnable; StandardRunnable runnable;
runnable.executable = iosRunConfig->localExecutable().toUserOutput(); runnable.executable = iosRunConfig->localExecutable().toUserOutput();
runnable.commandLineArguments = iosRunConfig->commandLineArguments(); runnable.commandLineArguments = iosRunConfig->commandLineArguments();
runControl->setRunnable(runnable);
runControl->setConnection(UrlConnection::localHostWithoutPort());
runControl->setDisplayName(iosRunConfig->applicationName()); runControl->setDisplayName(iosRunConfig->applicationName());
runControl->setRunnable(runnable);
connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort, m_runner = new IosRunner(runControl);
this, &IosAnalyzeSupport::qmlServerReady); m_runner->setQmlDebugging(QmlDebug::QmlProfilerServices);
addDependency(m_runner);
m_profiler = runControl->createWorker(runControl->runMode());
m_profiler->addDependency(this);
} }
void IosAnalyzeSupport::start() void IosQmlProfilerSupport::start()
{ {
// Use m_runner->qmlServerPort() // FIXME UrlConnection serverUrl;
} QTcpServer server;
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6), return);
serverUrl.setHost(server.serverAddress().toString());
void IosAnalyzeSupport::qmlServerReady() Port qmlPort = m_runner->qmlServerPort();
{ serverUrl.setPort(qmlPort.number());
// runControl()->notifyRemoteSetupDone(m_qmlServerPort); m_profiler->recordData("QmlServerUrl", serverUrl);
} if (qmlPort.isValid())
reportStarted();
void IosAnalyzeSupport::appOutput(const QString &output) else
{ reportFailure(tr("Could not get necessary ports for the profiler connection."));
m_outputParser.processOutput(output);
}
void IosAnalyzeSupport::errorMsg(const QString &output)
{
m_outputParser.processOutput(output);
} }
// //

View File

@@ -65,6 +65,7 @@ public:
virtual void appOutput(const QString &/*output*/) {} virtual void appOutput(const QString &/*output*/) {}
virtual void errorMsg(const QString &/*msg*/) {} virtual void errorMsg(const QString &/*msg*/) {}
virtual void onStart() { reportStarted(); }
Utils::Port qmlServerPort() const; Utils::Port qmlServerPort() const;
Utils::Port gdbServerPort() const; Utils::Port gdbServerPort() const;
@@ -111,22 +112,17 @@ private:
}; };
class IosAnalyzeSupport : public IosRunner class IosQmlProfilerSupport : public ProjectExplorer::RunWorker
{ {
Q_OBJECT Q_OBJECT
public: public:
IosAnalyzeSupport(ProjectExplorer::RunControl *runControl); IosQmlProfilerSupport(ProjectExplorer::RunControl *runControl);
private: private:
void start() override; void start() override;
IosRunner *m_runner = nullptr;
void qmlServerReady(); ProjectExplorer::RunWorker *m_profiler = nullptr;
void appOutput(const QString &output) override;
void errorMsg(const QString &output) override;
QmlDebug::QmlOutputParser m_outputParser;
IosRunner *m_runner;
}; };