diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2018-10-29 13:18:12 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-05-03 12:44:56 +0000 |
commit | ec19c381a0153be2f94e5a7a3294fa48b3d40c82 (patch) | |
tree | 5eb4b4edfbc79e69e3a5cc8f644675706f1d96b9 | |
parent | a4a0b030500ff568aa4faf45ca10f53db3aeb242 (diff) |
Always use the first attributes as fallback
This fixes parsing of data files generated with `perf record -s`.
In such a case, we do have non-empty attributes but the samples don't
reference any attribute by id. Perf uses the first available attribute
in such cases, cf. `perf_evlist__id2evsel`.
Change-Id: I1e5a9b59cd82dbe0d4eb1d140fb9b1e7768284fa
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rw-r--r-- | app/perfunwind.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp index 7a33f8f..9f8c1b4 100644 --- a/app/perfunwind.cpp +++ b/app/perfunwind.cpp @@ -236,12 +236,10 @@ void PerfUnwind::addAttributes(const PerfEventAttributes &attributes, const QByt const QList<quint64> &ids) { 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(). - filteredIds = {0}; - } + // 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(). + filteredIds << 0; { // remove attributes that are known already |