forked from qt-creator/qt-creator
PerfProfiler: Make perf record args accessible
... without creating a hard dependencies. Change-Id: I07b40dd9f1a4f53c5279d36f44e2a9123a34fa74 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
This commit is contained in:
@@ -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";
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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,
|
||||
CommandLine cmd;
|
||||
cmd.addArgs({"-e", events,
|
||||
"--call-graph", callgraphArg,
|
||||
sampleMode.itemValue().toString(),
|
||||
QString::number(period())});
|
||||
cmd->addArgs(extraArguments(), CommandLine::Raw);
|
||||
cmd.addArgs(extraArguments(), CommandLine::Raw);
|
||||
return cmd.arguments();
|
||||
}
|
||||
|
||||
void PerfSettings::resetToDefault()
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user