summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2017-12-21 16:52:53 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-05-02 15:26:07 +0000
commit05f20d7926f3b4ed38697b962535c03bde268f15 (patch)
tree5e349da32b1bb2ddd39becb01e4c083c3a24bddc /app
parent05ab1508cc7b263b5dca511c8fa22f04f88fbdd2 (diff)
Do not override previous attributes
The attributes available in the features struct contains more information. We used to overwrite that by the less-interesting data available in the attributes list. Instead of doing this, check whether a given attribute was encountered already. If so, don't report it a second time. Change-Id: I308c3cf7ceeb8e6f0ca33de52ecfc1a63f62477d Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'app')
-rw-r--r--app/perfunwind.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp
index 393e515..baeea39 100644
--- a/app/perfunwind.cpp
+++ b/app/perfunwind.cpp
@@ -236,18 +236,21 @@ void PerfUnwind::attr(const PerfRecordAttr &attr)
void PerfUnwind::addAttributes(const PerfEventAttributes &attributes, const QByteArray &name,
const QList<quint64> &ids)
{
- const qint32 internalId = m_attributes.size();
- m_attributes.append(attributes);
- sendAttributes(internalId, attributes, name);
-
- if (ids.isEmpty()) {
+ auto filteredIds = ids;
+ if (filteredIds.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, ids)
- m_attributeIds[id] = internalId;
+ filteredIds = {0};
+ }
+
+ {
+ // remove attributes that are known already
+ auto it = std::remove_if(filteredIds.begin(), filteredIds.end(),
+ [this] (quint64 id) {
+ return m_attributeIds.contains(id);
+ });
+ filteredIds.erase(it, filteredIds.end());
}
// Switch to dynamic buffering if it's a trace point
@@ -255,6 +258,16 @@ void PerfUnwind::addAttributes(const PerfEventAttributes &attributes, const QByt
qDebug() << "Trace point attributes detected. Switching to dynamic buffering";
revertTargetEventBufferSize();
}
+
+ if (filteredIds.isEmpty())
+ return;
+
+ const qint32 internalId = m_attributes.size();
+ m_attributes.append(attributes);
+ sendAttributes(internalId, attributes, name);
+
+ foreach (quint64 id, filteredIds)
+ m_attributeIds[id] = internalId;
}
void PerfUnwind::sendAttributes(qint32 id, const PerfEventAttributes &attributes, const QByteArray &name)