forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -183,15 +183,21 @@ public:
|
|||||||
&PerfProfilerTool::onRunControlFinished);
|
&PerfProfilerTool::onRunControlFinished);
|
||||||
|
|
||||||
PerfDataReader *reader = m_perfParserWorker->reader();
|
PerfDataReader *reader = m_perfParserWorker->reader();
|
||||||
|
Process *perfProcess = nullptr;
|
||||||
if (auto prw = qobject_cast<LocalPerfRecordWorker *>(m_perfRecordWorker)) {
|
if (auto prw = qobject_cast<LocalPerfRecordWorker *>(m_perfRecordWorker)) {
|
||||||
// That's the local case.
|
// That's the local case.
|
||||||
Process *recorder = prw->recorder();
|
perfProcess = prw->recorder();
|
||||||
connect(recorder, &Process::readyReadStandardError, this, [this, recorder] {
|
} else {
|
||||||
appendMessage(QString::fromLocal8Bit(recorder->readAllRawStandardError()),
|
perfProcess = runControl()->property("PerfProcess").value<Process *>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perfProcess) {
|
||||||
|
connect(perfProcess, &Process::readyReadStandardError, this, [this, perfProcess] {
|
||||||
|
appendMessage(QString::fromLocal8Bit(perfProcess->readAllRawStandardError()),
|
||||||
StdErrFormat);
|
StdErrFormat);
|
||||||
});
|
});
|
||||||
connect(recorder, &Process::readyReadStandardOutput, this, [this, reader, recorder] {
|
connect(perfProcess, &Process::readyReadStandardOutput, this, [this, reader, perfProcess] {
|
||||||
if (!reader->feedParser(recorder->readAllRawStandardOutput()))
|
if (!reader->feedParser(perfProcess->readAllRawStandardOutput()))
|
||||||
reportFailure(Tr::tr("Failed to transfer Perf data to perfparser."));
|
reportFailure(Tr::tr("Failed to transfer Perf data to perfparser."));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user