Skip to content

Commit 18dff5a

Browse files
committed
Forward more tracepoint information to hotspot
This patch forwards the tracepoint formatstring and the event format id for tracepoints to hotspot.
1 parent a6aeb01 commit 18dff5a

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

app/perftracingdata.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ static void processLine(const QByteArray &line,
107107
const std::function<void(const QByteArray &, const QByteArray &)> &handler)
108108
{
109109
const auto chunks = line.split('\t');
110-
for (const auto &chunk : chunks) {
111-
QList<QByteArray> segments = chunk.split(':');
112-
if (segments.size() != 2)
110+
for (const auto& chunk : chunks) {
111+
auto split = chunk.indexOf(':');
112+
if (split == -1) {
113113
continue;
114+
}
114115

115-
QByteArray name = segments[0].toLower();
116-
QByteArray value = segments[1].trimmed();
116+
auto name = chunk.left(split).toLower().trimmed();
117+
auto value = chunk.mid(split + 1).trimmed();
117118
if (value.endsWith(';'))
118119
value.chop(1);
119120
handler(name, value);
@@ -240,6 +241,8 @@ bool PerfTracingData::readEventFormats(QDataStream &stream, const QByteArray &sy
240241
seenId = true;
241242
} else if (name == "format") {
242243
stage = CommonFields;
244+
} else if (name == "print fmt") {
245+
event.format = value;
243246
}
244247
});
245248
}

app/perftracingdata.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct EventFormat
6666
QVector<FormatField> commonFields;
6767
QVector<FormatField> fields;
6868
quint32 flags = 0;
69+
QByteArray format;
6970
};
7071

7172
class PerfTracingData

app/perfunwind.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ void PerfUnwind::sendEventFormat(qint32 id, const EventFormat &format)
428428

429429
QByteArray buffer;
430430
QDataStream(&buffer, QIODevice::WriteOnly) << static_cast<quint8>(TracePointFormat) << id
431-
<< systemId << nameId << format.flags;
431+
<< systemId << nameId << format.flags << resolveString(format.format);
432432
sendBuffer(buffer);
433433
}
434434

@@ -809,13 +809,12 @@ void PerfUnwind::analyze(const PerfRecordSample &sample)
809809

810810
if (type == TracePointSample) {
811811
QHash<qint32, QVariant> traceData;
812-
const QByteArray &data = sample.rawData();
813-
const EventFormat &format = m_tracingData.eventFormat(eventFormatId);
814-
for (const FormatField &field : format.fields) {
815-
traceData[lookupString(field.name)]
816-
= readTraceData(data, field, m_byteOrder != QSysInfo::ByteOrder);
812+
const QByteArray& data = sample.rawData();
813+
const EventFormat& format = m_tracingData.eventFormat(eventFormatId);
814+
for (const FormatField& field : format.fields) {
815+
traceData[lookupString(field.name)] = readTraceData(data, field, m_byteOrder != QSysInfo::ByteOrder);
817816
}
818-
stream << traceData;
817+
stream << eventFormatId << traceData;
819818
}
820819

821820
sendBuffer(buffer);

0 commit comments

Comments
 (0)