aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/perfprofiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-05-03 13:59:09 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-05-08 09:27:39 +0000
commit63beec8921c3195be3b95a7394de2711918227bf (patch)
tree2786261ac7dd5b1fb8291c0aacc8458be6659e40 /src/plugins/perfprofiler
parent5574884cb11942ac010c66025430e379d1924be5 (diff)
PerfProfiler: Save and load CPU id for events
Change-Id: Ieafbb391fb3383e96790dfa2f222d48aecec21a2 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'src/plugins/perfprofiler')
-rw-r--r--src/plugins/perfprofiler/perfevent.h6
-rw-r--r--src/plugins/perfprofiler/perfprofilertracemanager.h9
2 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/perfprofiler/perfevent.h b/src/plugins/perfprofiler/perfevent.h
index dd5c052af4..e57712a722 100644
--- a/src/plugins/perfprofiler/perfevent.h
+++ b/src/plugins/perfprofiler/perfevent.h
@@ -88,6 +88,7 @@ private:
quint32 m_pid = 0;
quint32 m_tid = 0;
quint64 m_value = 0;
+ quint32 m_cpu = 0;
quint8 m_origNumGuessedFrames = 0;
quint8 m_numGuessedFrames = 0;
quint8 m_feature = PerfEventType::InvalidFeature;
@@ -120,7 +121,7 @@ inline QDataStream &operator>>(QDataStream &stream, PerfEvent &event)
}
quint64 timestamp;
- stream >> event.m_pid >> event.m_tid >> timestamp;
+ stream >> event.m_pid >> event.m_tid >> timestamp >> event.m_cpu;
static const quint64 qint64Max = static_cast<quint64>(std::numeric_limits<qint64>::max());
event.setTimestamp(static_cast<qint64>(qMin(timestamp, qint64Max)));
@@ -169,7 +170,8 @@ inline QDataStream &operator<<(QDataStream &stream, const PerfEvent &event)
{
quint8 feature = event.feature();
stream << feature << event.m_pid << event.m_tid
- << (event.timestamp() < 0ll ? 0ull : static_cast<quint64>(event.timestamp()));
+ << (event.timestamp() < 0ll ? 0ull : static_cast<quint64>(event.timestamp()))
+ << event.m_cpu;
switch (feature) {
case PerfEventType::ThreadStart:
case PerfEventType::ThreadEnd:
diff --git a/src/plugins/perfprofiler/perfprofilertracemanager.h b/src/plugins/perfprofiler/perfprofilertracemanager.h
index ce78e23612..b35c6f1bd8 100644
--- a/src/plugins/perfprofiler/perfprofilertracemanager.h
+++ b/src/plugins/perfprofiler/perfprofilertracemanager.h
@@ -71,9 +71,9 @@ public:
struct Thread {
Thread(qint64 start = -1, qint64 firstEvent = -1, qint64 lastEvent = -1, quint32 pid = 0,
- quint32 tid = 0, qint32 name = -1, bool enabled = false) :
+ quint32 tid = 0, quint32 cpu = 0, qint32 name = -1, bool enabled = false) :
start(start), firstEvent(firstEvent), lastEvent(lastEvent), pid(pid), tid(tid),
- name(name), enabled(enabled)
+ cpu(cpu), name(name), enabled(enabled)
{}
qint64 start;
@@ -81,6 +81,7 @@ public:
qint64 lastEvent;
quint32 pid;
quint32 tid;
+ quint32 cpu;
qint32 name;
bool enabled;
};
@@ -240,14 +241,14 @@ inline QDataStream &operator<<(QDataStream &stream,
inline QDataStream &operator>>(QDataStream &stream, PerfProfilerTraceManager::Thread &thread)
{
- stream >> thread.pid >> thread.tid >> thread.start >> thread.name;
+ stream >> thread.pid >> thread.tid >> thread.start >> thread.cpu >> thread.name;
thread.enabled = (thread.pid != 0);
return stream;
}
inline QDataStream &operator<<(QDataStream &stream, const PerfProfilerTraceManager::Thread &thread)
{
- return stream << thread.pid << thread.tid << thread.start << thread.name;
+ return stream << thread.pid << thread.tid << thread.start << thread.cpu << thread.name;
}