diff options
author | Dominik Holland <dominik.holland@qt.io> | 2024-03-07 17:16:30 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@qt.io> | 2024-05-08 08:17:14 +0000 |
commit | aad2f6ecac5f7d7522bec7e509a2ce984a5161af (patch) | |
tree | cde0fa65b6fcbd9f9d53937ae76c907382bc713c | |
parent | 33271804d239cbb0c3f69a55ae45c1d4bf7c1b5d (diff) |
AppMan: Add PerfProfiler support
Change-Id: I7873742ebd93af1aed1c57e473c85d0b06bbbbf3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
3 files changed, 46 insertions, 18 deletions
diff --git a/src/plugins/qtapplicationmanager/appmanagerplugin.cpp b/src/plugins/qtapplicationmanager/appmanagerplugin.cpp index f100f53b34..3afd7705b4 100644 --- a/src/plugins/qtapplicationmanager/appmanagerplugin.cpp +++ b/src/plugins/qtapplicationmanager/appmanagerplugin.cpp @@ -36,6 +36,7 @@ class AppManagerPlugin final : public ExtensionSystem::IPlugin setupAppManagerRunWorker(); setupAppManagerDebugWorker(); setupAppManagerQmlToolingWorker(); + setupAppManagerPerfProfilerWorker(); } }; diff --git a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp index bfcda6e287..ac4b0c26c1 100644 --- a/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp +++ b/src/plugins/qtapplicationmanager/appmanagerruncontrol.cpp @@ -15,6 +15,8 @@ #include <debugger/debuggerruncontrol.h> #include <debugger/debuggerkitaspect.h> +#include <perfprofiler/perfprofilerconstants.h> + #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildsystem.h> #include <projectexplorer/buildtargetinfo.h> @@ -99,15 +101,10 @@ public: setId(AppManager::Constants::DEBUG_LAUNCHER_ID); setEssential(true); - connect(&m_launcher, &Process::started, this, &RunWorker::reportStarted); - connect(&m_launcher, &Process::done, this, &RunWorker::reportStopped); - - connect(&m_launcher, &Process::readyReadStandardOutput, this, [this] { - appendMessage(m_launcher.readAllStandardOutput(), StdOutFormat); - }); - connect(&m_launcher, &Process::readyReadStandardError, this, [this] { - appendMessage(m_launcher.readAllStandardError(), StdErrFormat); - }); + if (usePerf) { + suppressDefaultStdOutHandling(); + runControl->setProperty("PerfProcess", QVariant::fromValue(process())); + } m_portsGatherer = new Debugger::DebugServerPortsGatherer(runControl); m_portsGatherer->setUseGdbServer(useGdbServer || usePerf); @@ -123,7 +120,6 @@ public: if (auto envAspect = runControl->aspectData<EnvironmentAspect>()) envVars = envAspect->environment.toStringList(); -// const int perfPort = m_portsGatherer->gdbServer().port(); const int gdbServerPort = m_portsGatherer->gdbServer().port(); const int qmlServerPort = m_portsGatherer->qmlServer().port(); @@ -147,14 +143,10 @@ public: } cmd.addArg(debugArgs.join(' ')); } - //FIXME UNTESTED CODE if (m_usePerf) { - Store settingsData = runControl->settingsData("Analyzer.Perf.Settings"); - QVariant perfRecordArgs = settingsData.value("Analyzer.Perf.RecordArguments"); - QString args = Utils::transform(perfRecordArgs.toStringList(), [](QString arg) { - return arg.replace(',', ",,"); - }).join(','); - cmd.addArg(QString("perf record %1 -o - --").arg(args)); + const Store perfArgs = runControl->settingsData(PerfProfiler::Constants::PerfSettingsId); + const QString recordArgs = perfArgs[PerfProfiler::Constants::PerfRecordArgsId].toString(); + cmd.addArg(QString("perf record %1 -o - --").arg(recordArgs)); } cmd.addArg("-eio"); @@ -185,7 +177,6 @@ private: bool m_useGdbServer; bool m_useQmlServer; QmlDebug::QmlDebugServicesPreset m_qmlServices; - Process m_launcher; }; @@ -300,6 +291,25 @@ private: RunWorker *m_worker = nullptr; }; +// AppManagerDevicePerfProfilerSupport + +class AppManagerPerfProfilerSupport final : public RunWorker +{ +public: + explicit AppManagerPerfProfilerSupport(RunControl *runControl) + : RunWorker(runControl) + { + setId("AppManagerPerfProfilerSupport"); + + m_profilee = new AppManInferiorRunner(runControl, true, false, false, + QmlDebug::NoQmlDebugServices); + addStartDependency(m_profilee); + addStopDependency(m_profilee); + } + +private: + AppManInferiorRunner *m_profilee = nullptr; +}; // Factories @@ -338,6 +348,17 @@ public: } }; +class AppManagerPerfProfilerWorkerFactory final : public RunWorkerFactory +{ +public: + AppManagerPerfProfilerWorkerFactory() + { + setProduct<AppManagerPerfProfilerSupport>(); + addSupportedRunMode("PerfRecorder"); + addSupportedRunConfig(Constants::RUNANDDEBUGCONFIGURATION_ID); + } +}; + void setupAppManagerRunWorker() { static AppManagerRunWorkerFactory theAppManagerRunWorkerFactory; @@ -353,4 +374,9 @@ void setupAppManagerQmlToolingWorker() static AppManagerQmlToolingWorkerFactory theAppManagerQmlToolingWorkerFactory; } +void setupAppManagerPerfProfilerWorker() +{ + static AppManagerPerfProfilerWorkerFactory theAppManagerPerfProfilerWorkerFactory; +} + } // AppManager::Internal diff --git a/src/plugins/qtapplicationmanager/appmanagerruncontrol.h b/src/plugins/qtapplicationmanager/appmanagerruncontrol.h index b98f462c29..3530d4d10b 100644 --- a/src/plugins/qtapplicationmanager/appmanagerruncontrol.h +++ b/src/plugins/qtapplicationmanager/appmanagerruncontrol.h @@ -10,5 +10,6 @@ namespace AppManager::Internal { void setupAppManagerRunWorker(); void setupAppManagerDebugWorker(); void setupAppManagerQmlToolingWorker(); +void setupAppManagerPerfProfilerWorker(); } // AppManager::Internal |