diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2017-03-28 17:49:11 +0200 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2017-03-29 14:54:12 +0000 |
commit | 7278b440efdb91f72e43fcd14f808ac2f1037330 (patch) | |
tree | c994be02a967e4def95a077501370b1b12b1d0e5 | |
parent | 8e8c40d7a21bd52f8ee8c71d3c8628fba53efcc2 (diff) |
Include sample period and weight in parsed output
The sample period equals the performance counter value since the
last sample, and is e.g. emitted also by `perf script`.
The sample weight is important for client application to correctly
attribute the sampling cost. I.e. it is not enough to just count the
number of total sample, but rather one must use the weighted number
of samples.
Change-Id: I052ae25dcca972320ca8601b3d821398c08401ad
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | app/perfdata.h | 2 | ||||
-rw-r--r-- | app/perfunwind.cpp | 3 | ||||
-rw-r--r-- | app/perfunwind.h | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/perfdata.h b/app/perfdata.h index 906def1..3ce5b5a 100644 --- a/app/perfdata.h +++ b/app/perfdata.h @@ -373,6 +373,8 @@ public: quint64 ip() const { return m_ip; } const QByteArray &userStack() const { return m_userStack; } const QList<quint64> &callchain() const { return m_callchain; } + quint64 period() const { return m_period; } + quint64 weight() const { return m_weight; } private: struct ReadFormat { diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp index 37e418c..7b94ab3 100644 --- a/app/perfunwind.cpp +++ b/app/perfunwind.cpp @@ -414,7 +414,8 @@ void PerfUnwind::analyze(const PerfRecordSample &sample) QDataStream(&buffer, QIODevice::WriteOnly) << static_cast<quint8>(Sample) << sample.pid() << sample.tid() << sample.time() << m_currentUnwind.frames - << numGuessedFrames << m_attributeIds.value(sample.id(), -1); + << numGuessedFrames << m_attributeIds.value(sample.id(), -1) + << sample.period() << sample.weight(); sendBuffer(buffer); } diff --git a/app/perfunwind.h b/app/perfunwind.h index ffff2f2..c7103c6 100644 --- a/app/perfunwind.h +++ b/app/perfunwind.h @@ -48,7 +48,7 @@ class PerfUnwind : public QObject Q_OBJECT public: enum EventType { - Sample, + Sample43, // now obsolete ThreadStart, ThreadEnd, Command, @@ -59,6 +59,7 @@ public: LostDefinition, FeaturesDefinition, Error, + Sample, InvalidType }; |