diff options
author | Eike Ziller <eike.ziller@qt.io> | 2017-03-28 09:25:22 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2017-03-28 09:25:22 +0200 |
commit | 4296e642906a540efd5502c65c760f09b0a49ed7 (patch) | |
tree | 7fde460b63119a43ac66462dffbb9ba00d48085c | |
parent | eea91238f58075ec6e991f874be3f057664ba147 (diff) | |
parent | c9e284904ae7d1e0d3358160ded766e0e46e83ca (diff) |
Merge remote-tracking branch 'origin/4.3'
Change-Id: I210e819f30185a0f8d4ad3bc7d35e8d4d7593cbd
-rw-r--r-- | app/perfunwind.cpp | 19 | ||||
-rw-r--r-- | app/perfunwind.h | 6 |
2 files changed, 17 insertions, 8 deletions
diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp index caf2ece..8dfcc7f 100644 --- a/app/perfunwind.cpp +++ b/app/perfunwind.cpp @@ -116,20 +116,26 @@ void PerfUnwind::comm(const PerfRecordComm &comm) void PerfUnwind::attr(const PerfRecordAttr &attr) { - const qint32 internalId = resolveAttr(attr.attr(), attr.attr().name()); + addAttributes(attr.attr(), attr.attr().name(), attr.ids()); +} + +void PerfUnwind::addAttributes(const PerfEventAttributes &attributes, const QByteArray &name, + const QList<quint64> &ids) +{ + const qint32 internalId = resolveAttributes(attributes, name); - if (attr.ids().isEmpty()) { + if (ids.isEmpty()) { // If we only get one attribute, it doesn't have an ID. // The default ID for samples is 0, so we assign that here, // in order to look it up in analyze(). m_attributeIds[0] = internalId; } else { - foreach (quint64 id, attr.ids()) + foreach (quint64 id, ids) m_attributeIds[id] = internalId; } } -qint32 PerfUnwind::resolveAttr(const PerfEventAttributes &attributes, const QByteArray &name) +qint32 PerfUnwind::resolveAttributes(const PerfEventAttributes &attributes, const QByteArray &name) { auto it = m_attributes.find(attributes); if (it == m_attributes.end()) { @@ -161,9 +167,8 @@ void PerfUnwind::lost(const PerfRecordLost &lost) void PerfUnwind::features(const PerfFeatures &features) { const auto &eventDescs = features.eventDesc().eventDescs; - for (const auto &desc : eventDescs) { - resolveAttr(desc.attrs, desc.name); - } + for (const auto &desc : eventDescs) + addAttributes(desc.attrs, desc.name, desc.ids); QByteArray buffer; QDataStream(&buffer, QIODevice::WriteOnly) << static_cast<quint8>(FeaturesDefinition) diff --git a/app/perfunwind.h b/app/perfunwind.h index 19361f3..931a552 100644 --- a/app/perfunwind.h +++ b/app/perfunwind.h @@ -129,7 +129,11 @@ public: Dwfl *dwfl(quint32 pid, quint64 timestamp); qint32 resolveString(const QByteArray &string); - qint32 resolveAttr(const PerfEventAttributes &attributes, const QByteArray &name); + + void addAttributes(const PerfEventAttributes &attributes, const QByteArray &name, + const QList<quint64> &ids); + qint32 resolveAttributes(const PerfEventAttributes &attributes, + const QByteArray &name); int lookupLocation(const Location &location) const; int resolveLocation(const Location &location); |