diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-03-05 18:26:58 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-03-18 13:08:40 +0200 |
commit | f3c36a82123703df63c135b076e3ed699bc54bd7 (patch) | |
tree | 557e7fc448bdf570863d1c84222c8ab0ce86f35d | |
parent | 307d1080a4a409458f8b2cfb4e4fc94754d74ff0 (diff) |
Send COMM events separately.
The client wants to know when the thread names change.
Change-Id: I14f9176dbfb5f552d67e34e49a3e23bde30de287
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | app/perfdata.cpp | 2 | ||||
-rw-r--r-- | app/perfunwind.cpp | 24 | ||||
-rw-r--r-- | app/perfunwind.h | 3 |
3 files changed, 18 insertions, 11 deletions
diff --git a/app/perfdata.cpp b/app/perfdata.cpp index 6a71b3f..9e73107 100644 --- a/app/perfdata.cpp +++ b/app/perfdata.cpp @@ -69,7 +69,7 @@ PerfData::ReadStatus PerfData::processEvents(QDataStream &stream) case PERF_RECORD_COMM: { PerfRecordComm comm(&m_eventHeader, sampleType, sampleIdAll); stream >> comm; - m_destination->registerThread(comm.tid(), comm.comm()); + m_destination->comm(comm); break; } case PERF_RECORD_SAMPLE: { diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp index afee2fb..66952d5 100644 --- a/app/perfunwind.cpp +++ b/app/perfunwind.cpp @@ -101,9 +101,22 @@ void PerfUnwind::registerElf(const PerfRecordMmap &mmap) } -void PerfUnwind::registerThread(quint32 tid, const QString &name) +void sendBuffer(QIODevice *output, const QByteArray &buffer) { - threads[tid] = name; + quint32 size = buffer.length(); + output->write(reinterpret_cast<char *>(&size), sizeof(quint32)); + output->write(buffer); +} + +void PerfUnwind::comm(PerfRecordComm &comm) +{ + + threads[comm.tid()] = QString::fromLocal8Bit(comm.comm()); + QByteArray buffer; + QDataStream(&buffer, QIODevice::WriteOnly) << static_cast<quint8>(Command) + << comm.pid() << comm.tid() << threads[comm.tid()] + << comm.time() << QVector<PerfUnwind::Frame>(); + sendBuffer(output, buffer); } Dwfl_Module *PerfUnwind::reportElf(quint64 ip, quint32 pid) const @@ -363,13 +376,6 @@ void PerfUnwind::resolveCallchain() } } -void sendBuffer(QIODevice *output, const QByteArray &buffer) -{ - quint32 size = buffer.length(); - output->write(reinterpret_cast<char *>(&size), sizeof(quint32)); - output->write(buffer); -} - void PerfUnwind::analyze(const PerfRecordSample &sample) { if (sample.pid() != lastPid) { diff --git a/app/perfunwind.h b/app/perfunwind.h index b87f357..6d43fdd 100644 --- a/app/perfunwind.h +++ b/app/perfunwind.h @@ -36,6 +36,7 @@ public: BadStack, ThreadStart, ThreadEnd, + Command, InvalidType }; @@ -76,7 +77,7 @@ public: } void registerElf(const PerfRecordMmap &mmap); - void registerThread(quint32 tid, const QString &name); + void comm(PerfRecordComm &comm); quint32 pid() const { return lastPid; } Dwfl_Module *reportElf(quint64 ip, quint32 pid) const; |