diff --git a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp index 8579a9cf7cb..3d633160133 100644 --- a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp +++ b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp @@ -95,16 +95,15 @@ public: : RunWorker(runControl) { setId("LocalPerfRecordWorker"); - - auto perfAspect = runControl->aspect(); - QTC_ASSERT(perfAspect, return); - PerfSettings *settings = static_cast(perfAspect->currentSettings); - QTC_ASSERT(settings, return); - m_perfRecordArguments = settings->perfRecordArguments(); } void start() override { + auto perfAspect = runControl()->aspect(); + QTC_ASSERT(perfAspect, reportFailure(); return); + PerfSettings *settings = static_cast(perfAspect->currentSettings); + QTC_ASSERT(settings, reportFailure(); return); + m_process = new Process(this); connect(m_process, &Process::started, this, &RunWorker::reportStarted); @@ -125,7 +124,7 @@ public: }); CommandLine cmd({device()->filePath("perf"), {"record"}}); - cmd.addArgs(m_perfRecordArguments); + settings->addPerfRecordArguments(&cmd); cmd.addArgs({"-o", "-", "--"}); cmd.addCommandLineAsArgs(runControl()->commandLine(), CommandLine::Raw); @@ -145,7 +144,6 @@ public: private: QPointer m_process; - QStringList m_perfRecordArguments; }; diff --git a/src/plugins/perfprofiler/perfsettings.cpp b/src/plugins/perfprofiler/perfsettings.cpp index e5f307b85ae..9cfdf3d92c7 100644 --- a/src/plugins/perfprofiler/perfsettings.cpp +++ b/src/plugins/perfprofiler/perfsettings.cpp @@ -103,7 +103,7 @@ void PerfSettings::writeGlobalSettings() const settings->endGroup(); } -QStringList PerfSettings::perfRecordArguments() const +void PerfSettings::addPerfRecordArguments(CommandLine *cmd) const { QString callgraphArg = callgraphMode.itemValue().toString(); if (callgraphArg == Constants::PerfCallgraphDwarf) @@ -118,11 +118,11 @@ QStringList PerfSettings::perfRecordArguments() const } } - return QStringList({"-e", events, - "--call-graph", callgraphArg, - sampleMode.itemValue().toString(), - QString::number(period.value())}) - + ProcessArgs::splitArgs(extraArguments.value(), HostOsInfo::hostOs()); + cmd->addArgs({"-e", events, + "--call-graph", callgraphArg, + sampleMode.itemValue().toString(), + QString::number(period.value())}); + cmd->addArgs(extraArguments(), CommandLine::Raw); } void PerfSettings::resetToDefault() diff --git a/src/plugins/perfprofiler/perfsettings.h b/src/plugins/perfprofiler/perfsettings.h index fc808c1e118..4e8ae5700f8 100644 --- a/src/plugins/perfprofiler/perfsettings.h +++ b/src/plugins/perfprofiler/perfsettings.h @@ -14,7 +14,6 @@ namespace PerfProfiler { class PERFPROFILER_EXPORT PerfSettings final : public ProjectExplorer::ISettingsAspect { Q_OBJECT - Q_PROPERTY(QStringList perfRecordArguments READ perfRecordArguments NOTIFY changed) public: explicit PerfSettings(ProjectExplorer::Target *target = nullptr); @@ -23,7 +22,7 @@ public: void readGlobalSettings(); void writeGlobalSettings() const; - QStringList perfRecordArguments() const; + void addPerfRecordArguments(Utils::CommandLine *cmd) const; void resetToDefault();