From a156067e69c6066538286521effb6587144803f6 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Tue, 4 Jul 2017 11:27:52 +0200 Subject: Forward information on sampling frequency/period for events This allows us to reconstruct the sample period for data files generated with the following command: perf record -c 100000 ... Without the explicit `-P` flag, the above data file has no periods for the samples. By forwarding the event attribute configuration, clients can reconstruct the data as needed. Change-Id: I098e1f14cc66e97daaceffb288080868693c2d95 Reviewed-by: Milian Wolff --- app/perfattributes.h | 2 ++ app/perfunwind.cpp | 3 ++- app/perfunwind.h | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/perfattributes.h b/app/perfattributes.h index 5d60852..85fd7ae 100644 --- a/app/perfattributes.h +++ b/app/perfattributes.h @@ -48,6 +48,8 @@ public: quint32 type() const { return m_type; } quint64 config() const { return m_config; } int sampleIdOffset() const; + bool usesFrequency() const { return m_freq; }; + quint64 frequenyOrPeriod() const { return m_sampleFreq; } QByteArray name() const; diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp index 90d3f8c..3eef7d8 100644 --- a/app/perfunwind.cpp +++ b/app/perfunwind.cpp @@ -260,7 +260,8 @@ void PerfUnwind::sendAttributes(qint32 id, const PerfEventAttributes &attributes QByteArray buffer; QDataStream(&buffer, QIODevice::WriteOnly) << static_cast(AttributesDefinition) << id << attributes.type() - << attributes.config() << attrNameId; + << attributes.config() << attrNameId + << attributes.usesFrequency() << attributes.frequenyOrPeriod(); sendBuffer(buffer); } diff --git a/app/perfunwind.h b/app/perfunwind.h index 4779544..304534d 100644 --- a/app/perfunwind.h +++ b/app/perfunwind.h @@ -50,7 +50,7 @@ public: Command, LocationDefinition, SymbolDefinition, - AttributesDefinition, + AttributesDefinition49, StringDefinition, LostDefinition, FeaturesDefinition, @@ -59,6 +59,7 @@ public: Progress, TracePointFormat, TracePointSample, + AttributesDefinition, InvalidType }; -- cgit v1.2.3