QmlProfiler: Always dispatch memory and pixmap events

These events carry state which needs to be tracked even if they are
outside the current range.

Change-Id: Ia4bc34010f81cec29cd934ce2fefa0c337aef11f
Task-number: QTCREATORBUG-16552
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Ulf Hermann
2016-07-05 13:04:40 +02:00
parent 42d3f501a1
commit d2c9466d79
3 changed files with 75 additions and 27 deletions

View File

@@ -177,11 +177,19 @@ void MemoryUsageModel::loadEvent(const QmlEvent &event, const QmlEventType &type
m_currentUsage = allocation.size;
if (m_currentUsageIndex != -1) {
insertEnd(m_currentUsageIndex,
event.timestamp() - startTime(m_currentUsageIndex) - 1);
qint64 duration = event.timestamp() - startTime(m_currentUsageIndex);
if (duration > 0) {
insertEnd(m_currentUsageIndex, duration - 1);
m_currentUsageIndex = insertStart(event.timestamp(), SmallItem);
m_data.insert(m_currentUsageIndex, allocation);
} else {
// Ignore ranges of 0 duration. We only need to keep track of the sizes.
m_data[m_currentUsageIndex] = allocation;
}
} else {
m_currentUsageIndex = insertStart(event.timestamp(), SmallItem);
m_data.insert(m_currentUsageIndex, allocation);
}
m_currentUsageIndex = insertStart(event.timestamp(), SmallItem);
m_data.insert(m_currentUsageIndex, allocation);
m_continuation = m_continuation | ContinueUsage;
}
}
@@ -201,11 +209,22 @@ void MemoryUsageModel::loadEvent(const QmlEvent &event, const QmlEventType &type
if (m_currentSize > m_maxSize)
m_maxSize = m_currentSize;
if (m_currentJSHeapIndex != -1)
insertEnd(m_currentJSHeapIndex,
event.timestamp() - startTime(m_currentJSHeapIndex) - 1);
m_currentJSHeapIndex = insertStart(event.timestamp(), type.detailType());
m_data.insert(m_currentJSHeapIndex, allocation);
if (m_currentJSHeapIndex != -1) {
qint64 duration = event.timestamp() - startTime(m_currentJSHeapIndex);
if (duration > 0){
insertEnd(m_currentJSHeapIndex, duration - 1);
m_currentJSHeapIndex = insertStart(event.timestamp(), type.detailType());
m_data.insert(m_currentJSHeapIndex, allocation);
} else {
// Ignore ranges of 0 duration. We only need to keep track of the sizes.
m_data[m_currentJSHeapIndex] = allocation;
}
} else {
m_currentJSHeapIndex = insertStart(event.timestamp(), type.detailType());
m_data.insert(m_currentJSHeapIndex, allocation);
}
m_continuation = m_continuation | ContinueAllocation;
}
}
@@ -215,10 +234,10 @@ void MemoryUsageModel::finalize()
{
if (m_currentJSHeapIndex != -1)
insertEnd(m_currentJSHeapIndex, modelManager()->traceTime()->endTime() -
startTime(m_currentJSHeapIndex) - 1);
startTime(m_currentJSHeapIndex));
if (m_currentUsageIndex != -1)
insertEnd(m_currentUsageIndex, modelManager()->traceTime()->endTime() -
startTime(m_currentUsageIndex) - 1);
startTime(m_currentUsageIndex));
computeNesting();