aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/memoryusagemodel.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-07-05 13:04:40 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-07-11 15:28:27 +0000
commitd2c9466d79c68a36b1a2c0e3e8d512e69eedfc85 (patch)
treee77f1b69c1f26b09a535596cd5fc69c5808f5bef /src/plugins/qmlprofiler/memoryusagemodel.cpp
parent42d3f501a1f5d3e3190776f28ec05f3e8dbe5be2 (diff)
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>
Diffstat (limited to 'src/plugins/qmlprofiler/memoryusagemodel.cpp')
-rw-r--r--src/plugins/qmlprofiler/memoryusagemodel.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp
index d07b40df2fb..b0541fa7d00 100644
--- a/src/plugins/qmlprofiler/memoryusagemodel.cpp
+++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp
@@ -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();