forked from qt-creator/qt-creator
QmlProfiler: Add a QmlTypedEvent and extend QmlEvent
The QmlTypedEvent is mainly useful to read a generic QmlEvent and QmlEventType from a QPacket. QmlEventType has a stream operator to do exactly that. QmlEvent also gets further options to store 32-bit data in addition to 64- and 8-bit data. Also, with the more generic storage layout we can reduce the memory consumption of range events by 50%. This comes at the cost of additional memory allocations for non-range events, but as non-range events are significantly less frequent than range events, this is a good tradeoff. Finally the new storage layout lends itself to efficient serialization, which will help when developing new storage and transfer formats for QML traces. Change-Id: I420de68b0142f23c8fb2ca8b329d7ffe69c83fe0 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -78,10 +78,10 @@ void QmlProfilerAnimationsModel::loadData()
|
||||
if (!accepted(type))
|
||||
continue;
|
||||
|
||||
lastThread = (AnimationThread)event.numericData(2);
|
||||
lastThread = (AnimationThread)event.number<qint32>(2);
|
||||
|
||||
// initial estimation of the event duration: 1/framerate
|
||||
qint64 estimatedDuration = event.numericData(0) > 0 ? 1e9/event.numericData(0) : 1;
|
||||
qint64 estimatedDuration = event.number<qint32>(0) > 0 ? 1e9 / event.number<qint32>(0) : 1;
|
||||
|
||||
// the profiler registers the animation events at the end of them
|
||||
qint64 realEndTime = event.timestamp();
|
||||
@@ -97,8 +97,8 @@ void QmlProfilerAnimationsModel::loadData()
|
||||
// Don't "fix" the framerate even if we've fixed the duration.
|
||||
// The server should know better after all and if it doesn't we want to see that.
|
||||
lastEvent.typeId = event.typeIndex();
|
||||
lastEvent.framerate = (int)event.numericData(0);
|
||||
lastEvent.animationcount = (int)event.numericData(1);
|
||||
lastEvent.framerate = event.number<qint32>(0);
|
||||
lastEvent.animationcount = event.number<qint32>(1);
|
||||
QTC_ASSERT(lastEvent.animationcount > 0, continue);
|
||||
|
||||
m_data.insert(insert(realStartTime, realEndTime - realStartTime, lastThread), lastEvent);
|
||||
|
||||
Reference in New Issue
Block a user