diff options
author | Dominik Holland <dominik.holland@qt.io> | 2024-03-07 17:01:38 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@qt.io> | 2024-05-08 08:17:00 +0000 |
commit | 33271804d239cbb0c3f69a55ae45c1d4bf7c1b5d (patch) | |
tree | a03c15202d2210a15bd593de7ce0162faab5fd58 | |
parent | a90d16beda3bf603be0094af5916b1017946f1f4 (diff) |
PerfProfiler: Add support for reading perf output from other processes
Instead of just using the "PerfConnection" property when a "PerfRecorder"
is started, it is now also possible to set a "PerfProcess" property
and read stdout and stderr from there directly.
Change-Id: I01bd60a7ef36ca1676c0e0bc3d1f3e87f08749a2
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/plugins/perfprofiler/perfprofilerruncontrol.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp index 4c51b82b3f..a0927260c1 100644 --- a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp +++ b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp @@ -183,15 +183,21 @@ public: &PerfProfilerTool::onRunControlFinished); PerfDataReader *reader = m_perfParserWorker->reader(); + Process *perfProcess = nullptr; if (auto prw = qobject_cast<LocalPerfRecordWorker *>(m_perfRecordWorker)) { // That's the local case. - Process *recorder = prw->recorder(); - connect(recorder, &Process::readyReadStandardError, this, [this, recorder] { - appendMessage(QString::fromLocal8Bit(recorder->readAllRawStandardError()), + perfProcess = prw->recorder(); + } else { + perfProcess = runControl()->property("PerfProcess").value<Process *>(); + } + + if (perfProcess) { + connect(perfProcess, &Process::readyReadStandardError, this, [this, perfProcess] { + appendMessage(QString::fromLocal8Bit(perfProcess->readAllRawStandardError()), StdErrFormat); }); - connect(recorder, &Process::readyReadStandardOutput, this, [this, reader, recorder] { - if (!reader->feedParser(recorder->readAllRawStandardOutput())) + connect(perfProcess, &Process::readyReadStandardOutput, this, [this, reader, perfProcess] { + if (!reader->feedParser(perfProcess->readAllRawStandardOutput())) reportFailure(Tr::tr("Failed to transfer Perf data to perfparser.")); }); } |