summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2013-12-02 14:13:10 +0100
committerUlf Hermann <ulf.hermann@digia.com>2013-12-02 14:13:10 +0100
commit727f9436718002cf9bd3cdf651e5b174f34cedd3 (patch)
tree43a577462697b4fddafb3f39bc61fd521ddb33f8
parentab17b3ea6ea4f7b61f5ab740e431c40150e4ee18 (diff)
downloadqt-creator-727f9436718002cf9bd3cdf651e5b174f34cedd3.tar.gz
Make sure that all pixmap URLs have a some event in the timeline
If that's not the case the categoryDepth() method will return a lower number of categories than getLabelsForCategory() which leads to glitches.
-rw-r--r--plugins/qmlprofilerextension/pixmapcachemodel.cpp55
-rw-r--r--plugins/qmlprofilerextension/pixmapcachemodel.h2
2 files changed, 35 insertions, 22 deletions
diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp
index d1fec8d171..0266a1bf30 100644
--- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp
+++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp
@@ -368,6 +368,16 @@ bool compareStartTimes(const PixmapCacheModel::PixmapCacheEvent&t1, const Pixmap
return t1.startTime < t2.startTime;
}
+void PixmapCacheModel::synthesizeLoadStart(PixmapCacheEvent &newEvent)
+{
+ // if it's a new entry it means that we don't have a corresponding start
+ newEvent.pixmapEventType = PixmapLoadingStarted;
+ newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
+ newEvent.duration = newEvent.startTime - traceStartTime();
+ newEvent.startTime = traceStartTime();
+ d->eventList << newEvent;
+}
+
void PixmapCacheModel::loadData()
{
clear();
@@ -393,22 +403,24 @@ void PixmapCacheModel::loadData()
if (newEvent.urlIndex == -1) {
isNewEntry = true;
newEvent.urlIndex = d->pixmapUrls.count();
+ qDebug() << "url: " << event.location.filename << " type: " << newEvent.pixmapEventType;
d->pixmapUrls << event.location.filename;
d->pixmapSizes << QPair<int, int>(0,0); // default value
pixmapStartPoints << d->eventList.count(); // index to the starting point
}
- if (newEvent.pixmapEventType == PixmapSizeKnown) { // pixmap size
- d->pixmapSizes[newEvent.urlIndex] = QPair<int,int>((int)event.numericData1, (int)event.numericData2);
- }
-
newEvent.eventId = newEvent.urlIndex + 1;
+ newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
- // Cache Size Changed Event
- if (newEvent.pixmapEventType == PixmapCacheCountChanged) {
+ switch (newEvent.pixmapEventType) {
+ case PixmapSizeKnown: // pixmap size
+ d->pixmapSizes[newEvent.urlIndex] = QPair<int,int>((int)event.numericData1, (int)event.numericData2);
+ if (isNewEntry)
+ synthesizeLoadStart(newEvent);
+ break;
+ case PixmapCacheCountChanged: {// Cache Size Changed Event
newEvent.startTime = event.startTime + 1; // delay 1 ns for proper sorting
newEvent.eventId = 0;
- newEvent.rowNumberExpanded = 1;
newEvent.rowNumberCollapsed = 1;
qint64 pixSize = d->pixmapSizes[newEvent.urlIndex].first * d->pixmapSizes[newEvent.urlIndex].second;
@@ -424,36 +436,35 @@ void PixmapCacheModel::loadData()
newEvent.cacheSize = prevSize + pixSize;
d->eventList << newEvent;
lastCacheSizeEvent = d->eventList.count() - 1;
+ break;
}
-
- // Load
- if (newEvent.pixmapEventType == PixmapLoadingStarted) {
+ case PixmapLoadingStarted: // Load
pixmapStartPoints[newEvent.urlIndex] = d->eventList.count();
- newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
d->eventList << newEvent;
- }
-
- if (newEvent.pixmapEventType == PixmapLoadingFinished || newEvent.pixmapEventType == PixmapLoadingError) {
+ break;
+ case PixmapLoadingFinished:
+ case PixmapLoadingError: {
int loadIndex = pixmapStartPoints[newEvent.urlIndex];
if (!isNewEntry) {
d->eventList[loadIndex].duration = event.startTime - d->eventList[loadIndex].startTime;
} else {
- // if it's a new entry it means that we don't have a corresponding start
- newEvent.pixmapEventType = PixmapLoadingStarted;
- newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
- newEvent.startTime = traceStartTime();
- newEvent.duration = event.startTime - traceStartTime();
- d->eventList << newEvent;
+ synthesizeLoadStart(newEvent);
}
if (event.bindingType == PixmapLoadingFinished)
d->eventList[loadIndex].cacheSize = 1; // use count to mark success
else
d->eventList[loadIndex].cacheSize = -1; // ... or failure
+ break;
+ }
+ default:
+ if (isNewEntry)
+ synthesizeLoadStart(newEvent);
+ break;
}
-
- m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), 2*simpleModel->getEvents().count());
}
+ m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), 2*simpleModel->getEvents().count());
+
if (lastCacheSizeEvent != -1) {
d->eventList[lastCacheSizeEvent].duration = traceEndTime() - d->eventList[lastCacheSizeEvent].startTime;
}
diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.h b/plugins/qmlprofilerextension/pixmapcachemodel.h
index 8ac8d42218..2e63f5996f 100644
--- a/plugins/qmlprofilerextension/pixmapcachemodel.h
+++ b/plugins/qmlprofilerextension/pixmapcachemodel.h
@@ -114,6 +114,8 @@ protected slots:
void dataChanged();
private:
+ void synthesizeLoadStart(PixmapCacheEvent &newEvent);
+
class PixmapCacheModelPrivate;
PixmapCacheModelPrivate *d;