diff --git a/src/parsers/perf/perfparser.cpp b/src/parsers/perf/perfparser.cpp index 8b6b1116..2e30149c 100644 --- a/src/parsers/perf/perfparser.cpp +++ b/src/parsers/perf/perfparser.cpp @@ -294,6 +294,8 @@ struct Sample : Record QVector frames; quint8 guessedFrames = 0; QVector costs; + quint32 tracePointFormat = std::numeric_limits::max(); + quint32 tracePointData = std::numeric_limits::max(); }; QDataStream& operator>>(QDataStream& stream, Sample& sample) @@ -534,6 +536,43 @@ QDebug operator<<(QDebug stream, const Error& error) return stream; } +struct TracePointFormat +{ + StringId systemId; + StringId nameId; + quint32 flags; + StringId format; +}; + +QDataStream& operator>>(QDataStream& stream, TracePointFormat& format) +{ + stream >> format.systemId >> format.nameId >> format.flags >> format.format; + return stream; +} + +QDebug operator<<(QDebug stream, const TracePointFormat& format) +{ + stream.noquote().nospace() << "TracePointFormat{" + << "systemId=" << format.systemId << ", " + << "nameId=" << format.nameId << ", " + << "flags=" << format.flags << ", " + << "format=" << format.format << "}"; + return stream; +} + +using TracePointData = QHash; + +QDebug operator<<(QDebug stream, const TracePointData& traceData) +{ + auto s = stream.noquote().nospace(); + s << "TracePointData{"; + for (auto it = traceData.cbegin(), end = traceData.cend(); it != end; it++) { + s << it.key() << "=" << it.value() << ", "; + } + s << "}"; + return stream; +} + void addCallerCalleeEvent(const Data::Symbol& symbol, const Data::Location& location, int type, quint64 cost, QSet* recursionGuard, Data::CallerCalleeResults* callerCalleeResult, int numCosts) @@ -755,11 +794,19 @@ class PerfParserPrivate : public QObject } } + if (static_cast(eventType) == EventType::TracePointSample) { + quint32 eventFormatId; + TracePointData traceData; + stream >> eventFormatId >> traceData; + tracepointData[eventFormatId].push_back(traceData); + qCDebug(LOG_PERFPARSER) << "parsed:" << traceData; + sample.tracePointFormat = eventFormatId; + sample.tracePointData = tracepointData.size() - 1; + } + addRecord(sample); addSample(sample); - if (static_cast(eventType) == EventType::TracePointSample) - return true; // TODO: read full data break; } case EventType::ThreadStart: { @@ -871,9 +918,14 @@ class PerfParserPrivate : public QObject emit debugInfoDownloadProgress(strings.value(module.id), strings.value(url.id), numerator, denominator); break; } - case EventType::TracePointFormat: - // TODO: implement me - return true; + case EventType::TracePointFormat: { + qint32 id; + TracePointFormat format; + stream >> id >> format; + qCDebug(LOG_PERFPARSER) << "parsed:" << format; + tracepointFormat[id] = format; + break; + } case EventType::InvalidType: break; } @@ -1441,6 +1493,8 @@ class PerfParserPrivate : public QObject QHash m_lastSampleTimePerCore; Settings::CostAggregation costAggregation; bool perfMapFileExists = false; + QHash tracepointFormat; + QHash> tracepointData; // samples recorded without --call-graph have only one frame int m_numSamplesWithMoreThanOneFrame = 0;