diff options
author | hjk <hjk@qt.io> | 2024-03-07 13:17:48 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2024-03-07 16:27:08 +0000 |
commit | 4c0991b25df4b1c25a0121af1a8a314c8de05c7e (patch) | |
tree | e570124a7c27608621046c0b838d65cdb26c7301 | |
parent | b24acbc28be35ce55b4e9b15c2f265ebf9f3440b (diff) |
PerfProfiler: Make perf record args accessible
... without creating a hard dependencies.
Change-Id: I07b40dd9f1a4f53c5279d36f44e2a9123a34fa74
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r-- | src/plugins/perfprofiler/perfprofilerconstants.h | 1 | ||||
-rw-r--r-- | src/plugins/perfprofiler/perfprofilerruncontrol.cpp | 12 | ||||
-rw-r--r-- | src/plugins/perfprofiler/perfsettings.cpp | 22 | ||||
-rw-r--r-- | src/plugins/perfprofiler/perfsettings.h | 3 |
4 files changed, 23 insertions, 15 deletions
diff --git a/src/plugins/perfprofiler/perfprofilerconstants.h b/src/plugins/perfprofiler/perfprofilerconstants.h index 53a63a938a..c1ff11c684 100644 --- a/src/plugins/perfprofiler/perfprofilerconstants.h +++ b/src/plugins/perfprofiler/perfprofilerconstants.h @@ -29,6 +29,7 @@ const char AnalyzerSettingsGroupId[] = "Analyzer"; const char PerfSettingsId[] = "Analyzer.Perf.Settings"; const char PerfCallgraphDwarf[] = "dwarf"; +const char PerfRecordArgsId[] = "PerfRecordArgsId"; const char PerfStreamMagic[] = "QPERFSTREAM"; const char PerfZqfileMagic[] = "PTQFILE4.10"; diff --git a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp index 2d35f1790e..56e32c9a2f 100644 --- a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp +++ b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp @@ -6,8 +6,6 @@ #include "perfdatareader.h" #include "perfprofilertool.h" #include "perfprofilertr.h" -#include "perfrunconfigurationaspect.h" -#include "perfsettings.h" #include <coreplugin/icore.h> #include <coreplugin/messagemanager.h> @@ -97,11 +95,6 @@ public: void start() final { - auto perfAspect = runControl()->aspect<PerfRunConfigurationAspect>(); - QTC_ASSERT(perfAspect, reportFailure(); return); - PerfSettings *settings = static_cast<PerfSettings *>(perfAspect->currentSettings); - QTC_ASSERT(settings, reportFailure(); return); - m_process = new Process(this); connect(m_process, &Process::started, this, &RunWorker::reportStarted); @@ -121,8 +114,11 @@ public: reportStopped(); }); + const Store perfArgs = runControl()->settingsData(PerfProfiler::Constants::PerfSettingsId); + const QString recordArgs = perfArgs[Constants::PerfRecordArgsId].toString(); + CommandLine cmd({device()->filePath("perf"), {"record"}}); - settings->addPerfRecordArguments(&cmd); + cmd.addArgs(recordArgs, CommandLine::Raw); cmd.addArgs({"-o", "-", "--"}); cmd.addCommandLineAsArgs(runControl()->commandLine(), CommandLine::Raw); diff --git a/src/plugins/perfprofiler/perfsettings.cpp b/src/plugins/perfprofiler/perfsettings.cpp index d5f3ac88ca..ab4ad75cc3 100644 --- a/src/plugins/perfprofiler/perfsettings.cpp +++ b/src/plugins/perfprofiler/perfsettings.cpp @@ -371,6 +371,8 @@ PerfSettings &globalSettings() PerfSettings::PerfSettings(ProjectExplorer::Target *target) { setAutoApply(false); + setId(Constants::PerfSettingsId); + period.setSettingsKey("Analyzer.Perf.Frequency"); period.setRange(250, 2147483647); period.setDefaultValue(250); @@ -448,7 +450,13 @@ void PerfSettings::writeGlobalSettings() const settings->endGroup(); } -void PerfSettings::addPerfRecordArguments(CommandLine *cmd) const +void PerfSettings::toMap(Store &map) const +{ + AspectContainer::toMap(map); + map[Constants::PerfRecordArgsId] = perfRecordArguments(); +} + +QString PerfSettings::perfRecordArguments() const { QString callgraphArg = callgraphMode.itemValue().toString(); if (callgraphArg == Constants::PerfCallgraphDwarf) @@ -463,11 +471,13 @@ void PerfSettings::addPerfRecordArguments(CommandLine *cmd) const } } - cmd->addArgs({"-e", events, - "--call-graph", callgraphArg, - sampleMode.itemValue().toString(), - QString::number(period())}); - cmd->addArgs(extraArguments(), CommandLine::Raw); + CommandLine cmd; + cmd.addArgs({"-e", events, + "--call-graph", callgraphArg, + sampleMode.itemValue().toString(), + QString::number(period())}); + cmd.addArgs(extraArguments(), CommandLine::Raw); + return cmd.arguments(); } void PerfSettings::resetToDefault() diff --git a/src/plugins/perfprofiler/perfsettings.h b/src/plugins/perfprofiler/perfsettings.h index a53557b9c4..79ee955b92 100644 --- a/src/plugins/perfprofiler/perfsettings.h +++ b/src/plugins/perfprofiler/perfsettings.h @@ -20,7 +20,8 @@ public: void readGlobalSettings(); void writeGlobalSettings() const; - void addPerfRecordArguments(Utils::CommandLine *cmd) const; + void toMap(Utils::Store &map) const override; + QString perfRecordArguments() const; void resetToDefault(); |