forked from qt-creator/qt-creator
PerfProfiler: Save and load CPU id for events
Change-Id: Ieafbb391fb3383e96790dfa2f222d48aecec21a2 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
This commit is contained in:
@@ -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:
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user