diff options
author | Christiaan Janssen <christiaan.janssen@digia.com> | 2013-06-20 16:29:37 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@digia.com> | 2013-06-24 14:57:21 +0300 |
commit | a7f03f3b5b62660e4f01749ff6d590d2bb3873c2 (patch) | |
tree | e90f5c6b38b4f05cc3f0cfce32f4c381ab7c2e98 | |
parent | 4fde52bb7a1b00d6f53891fbed3e796dd4aad1e2 (diff) |
QmlProfiler: cleaned up old commented code
Change-Id: I1d9a16bc02770a6f1c9a742c8342b0d32e291737
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r-- | plugins/qmlprofiler/abstracttimelinemodel.cpp | 1 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp | 9 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilereventsmodelproxy.h | 2 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilermodelmanager.cpp | 1 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp | 61 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilersimplemodel.cpp | 2 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp | 13 | ||||
-rw-r--r-- | plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h | 25 | ||||
-rw-r--r-- | plugins/qmlprofiler/timelinerenderer.cpp | 4 | ||||
-rw-r--r-- | plugins/qmlprofilerextended/pixmapcachemodel.cpp | 93 | ||||
-rw-r--r-- | plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp | 106 |
11 files changed, 128 insertions, 189 deletions
diff --git a/plugins/qmlprofiler/abstracttimelinemodel.cpp b/plugins/qmlprofiler/abstracttimelinemodel.cpp index 564d75d467..d462e8a915 100644 --- a/plugins/qmlprofiler/abstracttimelinemodel.cpp +++ b/plugins/qmlprofiler/abstracttimelinemodel.cpp @@ -60,7 +60,6 @@ qint64 AbstractTimelineModel::traceDuration() const int AbstractTimelineModel::getState() const { - // TODO: connect statechanged return (int)m_modelManager->state(); } diff --git a/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp index de98500f69..d7c325c25f 100644 --- a/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp @@ -134,12 +134,12 @@ void QmlProfilerEventsModelProxy::loadData(qint64 rangeStart, qint64 rangeEnd) QString hash = QmlProfilerSimpleModel::getHashString(*event); if (!d->data.contains(hash)) { QmlEventStats stats = { - event->bindingType, event->displayName, hash, event->data.join(QLatin1String(" ")), event->location, event->eventType, + event->bindingType, event->duration, 1, //calls event->duration, //minTime @@ -225,12 +225,12 @@ void QmlProfilerEventsModelProxy::loadData(qint64 rangeStart, qint64 rangeEnd) // insert root event QmlEventStats rootEvent = { - 0, rootEventName, //event.displayName, rootEventName, // hash tr("Main Program"), //event.details, rootEventLocation, // location - (int)QmlDebug::Binding, + (int)QmlDebug::Binding, // event type + 0, // binding type qmlTime + 1, 1, //calls qmlTime + 1, //minTime @@ -322,7 +322,8 @@ void QmlProfilerEventParentsModelProxy::loadData() 0, 0, QStringList() << tr("Main Program"), - QmlDebug::QmlEventLocation(rootEventName, 0, 0) + QmlDebug::QmlEventLocation(rootEventName, 0, 0), + 0,0,0,0,0 // numericData fields }; cachedEvents.insert(rootEventName, rootEvent); diff --git a/plugins/qmlprofiler/qmlprofilereventsmodelproxy.h b/plugins/qmlprofiler/qmlprofilereventsmodelproxy.h index 1c6a3ab004..d86c3229fb 100644 --- a/plugins/qmlprofiler/qmlprofilereventsmodelproxy.h +++ b/plugins/qmlprofiler/qmlprofilereventsmodelproxy.h @@ -49,12 +49,12 @@ class QmlProfilerEventsModelProxy : public QObject Q_OBJECT public: struct QmlEventStats { - int bindingType; // TODO: only makes sense for bindings! QString displayName; QString eventHashStr; QString details; QmlDebug::QmlEventLocation location; int eventType; + int bindingType; qint64 duration; qint64 calls; diff --git a/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index bd47bea32b..a2a24cc5c0 100644 --- a/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -164,7 +164,6 @@ QmlProfilerTraceTime *QmlProfilerModelManager::traceTime() const return d->traceTime; } -// TODO: rename to just "model" or something like that QmlProfilerSimpleModel *QmlProfilerModelManager::simpleModel() const { return d->model; diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp index 21aa33d5f5..bcb71a9664 100644 --- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp @@ -145,10 +145,6 @@ void PaintEventsModelProxy::loadData() if (simpleModel->isEmpty()) return; -// int lastEventId = 0; - -// d->prepare(); - // collect events const QVector<QmlProfilerSimpleModel::QmlEventData> referenceList = simpleModel->getEvents(); foreach (const QmlProfilerSimpleModel::QmlEventData &event, referenceList) { @@ -159,10 +155,11 @@ void PaintEventsModelProxy::loadData() // we need to correct it before appending a new event if (d->eventList.count() > 0) { QmlPaintEventData *lastEvent = &d->eventList[d->eventList.count()-1]; - if (lastEvent->startTime + lastEvent->duration >= event.startTime) + if (lastEvent->startTime + lastEvent->duration >= event.startTime) { // 1 nanosecond less to prevent overlap lastEvent->duration = event.startTime - lastEvent->startTime - 1; lastEvent->framerate = 1e9/lastEvent->duration; + } } QmlPaintEventData newEvent = { @@ -177,7 +174,7 @@ void PaintEventsModelProxy::loadData() d->computeAnimationCountLimit(); -// qSort(d->eventList.begin(), d->eventList.end(), compareStartTimes); + qSort(d->eventList.begin(), d->eventList.end(), compareStartTimes); emit countChanged(); } @@ -229,6 +226,11 @@ const QString PaintEventsModelProxy::categoryLabel(int categoryIndex) const int PaintEventsModelProxy::findFirstIndex(qint64 startTime) const { + return findFirstIndexNoParents(startTime); +} + +int PaintEventsModelProxy::findFirstIndexNoParents(qint64 startTime) const +{ if (d->eventList.isEmpty()) return -1; if (d->eventList.count() == 1 || d->eventList.first().startTime+d->eventList.first().duration >= startTime) @@ -249,33 +251,28 @@ int PaintEventsModelProxy::findFirstIndex(qint64 startTime) const return toIndex; } -int PaintEventsModelProxy::findFirstIndexNoParents(qint64 startTime) const -{ - return findFirstIndex(startTime); -} - int PaintEventsModelProxy::findLastIndex(qint64 endTime) const { - if (d->eventList.isEmpty()) - return -1; - if (d->eventList.first().startTime >= endTime) - return -1; - if (d->eventList.count() == 1) - return 0; - if (d->eventList.last().startTime <= endTime) - return d->eventList.count()-1; - - int fromIndex = 0; - int toIndex = d->eventList.count()-1; - while (toIndex - fromIndex > 1) { - int midIndex = (fromIndex + toIndex)/2; - if (d->eventList[midIndex].startTime < endTime) - fromIndex = midIndex; - else - toIndex = midIndex; - } + if (d->eventList.isEmpty()) + return -1; + if (d->eventList.first().startTime >= endTime) + return -1; + if (d->eventList.count() == 1) + return 0; + if (d->eventList.last().startTime <= endTime) + return d->eventList.count()-1; + + int fromIndex = 0; + int toIndex = d->eventList.count()-1; + while (toIndex - fromIndex > 1) { + int midIndex = (fromIndex + toIndex)/2; + if (d->eventList[midIndex].startTime < endTime) + fromIndex = midIndex; + else + toIndex = midIndex; + } - return fromIndex; + return fromIndex; } int PaintEventsModelProxy::getEventType(int index) const @@ -321,10 +318,6 @@ int PaintEventsModelProxy::getEventId(int index) const QColor PaintEventsModelProxy::getColor(int index) const { - // TODO -// return QColor("blue"); -// int ndx = getEventId(index); -// return QColor::fromHsl((ndx*25)%360, 76, 166); double fpsFraction = d->eventList[index].framerate / 60.0; if (fpsFraction > 1.0) fpsFraction = 1.0; diff --git a/plugins/qmlprofiler/qmlprofilersimplemodel.cpp b/plugins/qmlprofiler/qmlprofilersimplemodel.cpp index 52ddc3ac99..ef95ffb881 100644 --- a/plugins/qmlprofiler/qmlprofilersimplemodel.cpp +++ b/plugins/qmlprofiler/qmlprofilersimplemodel.cpp @@ -78,7 +78,7 @@ void QmlProfilerSimpleModel::addRangedEvent(int type, int bindingType, qint64 st void QmlProfilerSimpleModel::addFrameEvent(qint64 time, int framerate, int animationcount) { qint64 duration = 1e9 / framerate; - QmlEventData eventData = {tr("Animations"), QmlDebug::Painting, QmlDebug::AnimationFrame, time, duration, QStringList(), QmlDebug::QmlEventLocation(), framerate, animationcount, 0, 0, 0}; + QmlEventData eventData = {tr("Animations"), QmlDebug::Painting, QmlDebug::AnimationFrame, time - duration, duration, QStringList(), QmlDebug::QmlEventLocation(), framerate, animationcount, 0, 0, 0}; eventList.append(eventData); } diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp index a1655547c4..c50b3468f6 100644 --- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp @@ -61,7 +61,6 @@ public: void prepare(); void computeNestingContracted(); void computeExpandedLevels(); - void computeBaseEventIndexes(); void buildEndTimeList(); void findBindingLoops(); void computeRowStarts(); @@ -192,8 +191,6 @@ void BasicTimelineModel::loadData() event.data.join(QLatin1String(" ")), event.location, (QmlDebug::QmlEventType)event.eventType, -// event.bindingType, -// 1, lastEventId++ // event id }; d->eventDict << rangeEventData; @@ -204,10 +201,10 @@ void BasicTimelineModel::loadData() QmlRangeEventStartInstance eventStartInstance = { event.startTime, event.duration, + d->eventHashes.indexOf(eventHash), // event id QmlDebug::Constants::QML_MIN_LEVEL, // displayRowExpanded; QmlDebug::Constants::QML_MIN_LEVEL, // displayRowCollapsed; 1, - d->eventHashes.indexOf(eventHash), // event id -1 // bindingLoopHead }; d->startTimeData.append(eventStartInstance); @@ -221,8 +218,6 @@ void BasicTimelineModel::loadData() // compute nestingLevel - expanded d->computeExpandedLevels(); - d->computeBaseEventIndexes(); - // populate endtimelist d->buildEndTimeList(); @@ -279,7 +274,6 @@ void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted() startTimeData[i].displayRowCollapsed = nestingLevels[type]; - // todo: this should go to another method if (level == QmlDebug::Constants::QML_MIN_LEVEL) { if (lastBaseEventEndTime < startTimeData[i].startTime) { lastBaseEventIndex = i; @@ -313,11 +307,6 @@ void BasicTimelineModel::BasicTimelineModelPrivate::computeExpandedLevels() } } -void BasicTimelineModel::BasicTimelineModelPrivate::computeBaseEventIndexes() -{ - // TODO -} - void BasicTimelineModel::BasicTimelineModelPrivate::buildEndTimeList() { endTimeData.clear(); diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h index e02ec99e0d..53b05e93e2 100644 --- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h +++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h @@ -57,7 +57,6 @@ public: struct QmlRangeEventData { QString displayName; -// QString eventHashStr; QString details; QmlDebug::QmlEventLocation location; QmlDebug::QmlEventType eventType; @@ -68,22 +67,12 @@ public: struct QmlRangeEventStartInstance { qint64 startTime; qint64 duration; - -// int endTimeIndex; + int eventId; // not-expanded, per type int displayRowExpanded; int displayRowCollapsed; int baseEventIndex; // used by findfirstindex - - -// QmlRangeEventData *statsInfo; - int eventId; - - // animation-related data -// int frameRate; -// int animationCount; - int bindingLoopHead; }; @@ -92,18 +81,6 @@ public: qint64 endTime; }; -// struct QmlRangedEvent { -// int bindingType; // TODO: only makes sense for bindings! -// QString displayName; -// QString eventHashStr; -// QString details; -// QmlDebug::QmlEventLocation location; -// QmlDebug::QmlEventType eventType; -// //int eventType; - -// qint64 duration; -// }; - BasicTimelineModel(QObject *parent = 0); ~BasicTimelineModel(); diff --git a/plugins/qmlprofiler/timelinerenderer.cpp b/plugins/qmlprofiler/timelinerenderer.cpp index 053673d19a..a6f63213a8 100644 --- a/plugins/qmlprofiler/timelinerenderer.cpp +++ b/plugins/qmlprofiler/timelinerenderer.cpp @@ -532,8 +532,6 @@ int TimelineRenderer::prevItemFromId(int modelIndex, int eventId) const void TimelineRenderer::selectNextFromId(int modelIndex, int eventId) { - - // TODO: find next index depending on model int eventIndex = nextItemFromId(modelIndex, eventId); if (eventIndex != -1) { setSelectedModel(modelIndex); @@ -543,8 +541,6 @@ void TimelineRenderer::selectNextFromId(int modelIndex, int eventId) void TimelineRenderer::selectPrevFromId(int modelIndex, int eventId) { - - // TODO: find next index depending on model int eventIndex = prevItemFromId(modelIndex, eventId); if (eventIndex != -1) { setSelectedModel(modelIndex); diff --git a/plugins/qmlprofilerextended/pixmapcachemodel.cpp b/plugins/qmlprofilerextended/pixmapcachemodel.cpp index 1212089099..7ececbcb2c 100644 --- a/plugins/qmlprofilerextended/pixmapcachemodel.cpp +++ b/plugins/qmlprofilerextended/pixmapcachemodel.cpp @@ -103,6 +103,7 @@ qint64 PixmapCacheModel::lastTimeMark() const void PixmapCacheModel::setExpanded(int category, bool expanded) { + Q_UNUSED(category); d->isExpanded = expanded; } @@ -129,70 +130,59 @@ const QString PixmapCacheModel::categoryLabel(int categoryIndex) const int PixmapCacheModel::findFirstIndex(qint64 startTime) const { - // TODO properly - int candidate = -2; - for (int i=0; i < d->eventList.count(); i++) - if (d->eventList[i].startTime + d->eventList[i].duration > startTime) { - candidate = i; - break; - } - - if (candidate == -1) - return 0; - if (candidate == -2) - return d->eventList.count() - 1; - + int candidate = findFirstIndexNoParents(startTime); return candidate; } int PixmapCacheModel::findFirstIndexNoParents(qint64 startTime) const { - // TODO properly - return findFirstIndex(startTime); - -// int candidate = -1; -// // in the "endtime" list, find the first event that ends after startTime -// if (d->endTimeData.isEmpty()) -// return 0; // -1 -// if (d->endTimeData.count() == 1 || d->endTimeData.first().endTime >= startTime) -// candidate = 0; -// else -// if (d->endTimeData.last().endTime <= startTime) -// return 0; // -1 - -// if (candidate == -1) { -// int fromIndex = 0; -// int toIndex = d->endTimeData.count()-1; -// while (toIndex - fromIndex > 1) { -// int midIndex = (fromIndex + toIndex)/2; -// if (d->endTimeData[midIndex].endTime < startTime) -// fromIndex = midIndex; -// else -// toIndex = midIndex; -// } - -// candidate = toIndex; -// } - -// int ndx = d->endTimeData[candidate].startTimeIndex; - -// return ndx; + if (d->eventList.isEmpty()) + return -1; + if (d->eventList.count() == 1 || d->eventList.first().startTime+d->eventList.first().duration >= startTime) + return 0; + else + if (d->eventList.last().startTime+d->eventList.last().duration <= startTime) + return -1; + + int fromIndex = 0; + int toIndex = d->eventList.count()-1; + while (toIndex - fromIndex > 1) { + int midIndex = (fromIndex + toIndex)/2; + if (d->eventList[midIndex].startTime + d->eventList[midIndex].duration < startTime) + fromIndex = midIndex; + else + toIndex = midIndex; + } + return toIndex; } int PixmapCacheModel::findLastIndex(qint64 endTime) const { - // TODO properly - int candidate = 0; - for (int i = d->eventList.count()-1; i >= 0; i--) - if (d->eventList[i].startTime < endTime) { - candidate = i; - break; - } - return candidate; + if (d->eventList.isEmpty()) + return -1; + if (d->eventList.first().startTime >= endTime) + return -1; + if (d->eventList.count() == 1) + return 0; + if (d->eventList.last().startTime <= endTime) + return d->eventList.count()-1; + + int fromIndex = 0; + int toIndex = d->eventList.count()-1; + while (toIndex - fromIndex > 1) { + int midIndex = (fromIndex + toIndex)/2; + if (d->eventList[midIndex].startTime < endTime) + fromIndex = midIndex; + else + toIndex = midIndex; + } + + return fromIndex; } int PixmapCacheModel::getEventType(int index) const { + Q_UNUSED(index); return QmlDebug::PixmapCacheEvent; } @@ -263,6 +253,7 @@ QString getFilenameOnly(QString absUrl) const QVariantList PixmapCacheModel::getLabelsForCategory(int category) const { + Q_UNUSED(category); QVariantList result; if (d->isExpanded && !isEmpty()) { diff --git a/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp b/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp index d58354fd7c..fe44258e2a 100644 --- a/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp +++ b/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp @@ -111,12 +111,13 @@ qint64 SceneGraphTimelineModel::lastTimeMark() const void SceneGraphTimelineModel::setExpanded(int category, bool expanded) { - d->isExpanded = expanded; + Q_UNUSED(category); + d->isExpanded = expanded; } int SceneGraphTimelineModel::categoryDepth(int categoryIndex) const { - // TODO + Q_UNUSED(categoryIndex); if (isEmpty()) return 1; return 3; @@ -135,74 +136,64 @@ const QString SceneGraphTimelineModel::categoryLabel(int categoryIndex) const int SceneGraphTimelineModel::findFirstIndex(qint64 startTime) const { - // TODO properly - int candidate = -2; - for (int i=0; i < d->eventList.count(); i++) - if (d->eventList[i].startTime + d->eventList[i].duration > startTime) { - candidate = i; - break; - } - - if (candidate == -1) - return 0; - if (candidate == -2) - return d->eventList.count() - 1; + int candidate = findFirstIndexNoParents(startTime); + // because there's two threads synchronized, the right index could be one off + if (candidate > 0 && d->eventList[candidate-1].startTime + d->eventList[candidate-1].duration >= startTime) + return candidate - 1; return candidate; } int SceneGraphTimelineModel::findFirstIndexNoParents(qint64 startTime) const { - // TODO properly - return findFirstIndex(startTime); - -// int candidate = -1; -// // in the "endtime" list, find the first event that ends after startTime -// if (d->endTimeData.isEmpty()) -// return 0; // -1 -// if (d->endTimeData.count() == 1 || d->endTimeData.first().endTime >= startTime) -// candidate = 0; -// else -// if (d->endTimeData.last().endTime <= startTime) -// return 0; // -1 - -// if (candidate == -1) { -// int fromIndex = 0; -// int toIndex = d->endTimeData.count()-1; -// while (toIndex - fromIndex > 1) { -// int midIndex = (fromIndex + toIndex)/2; -// if (d->endTimeData[midIndex].endTime < startTime) -// fromIndex = midIndex; -// else -// toIndex = midIndex; -// } - -// candidate = toIndex; -// } - -// int ndx = d->endTimeData[candidate].startTimeIndex; - -// return ndx; + if (d->eventList.isEmpty()) + return -1; + if (d->eventList.count() == 1 || d->eventList.first().startTime+d->eventList.first().duration >= startTime) + return 0; + else + if (d->eventList.last().startTime+d->eventList.last().duration <= startTime) + return -1; + + int fromIndex = 0; + int toIndex = d->eventList.count()-1; + while (toIndex - fromIndex > 1) { + int midIndex = (fromIndex + toIndex)/2; + if (d->eventList[midIndex].startTime + d->eventList[midIndex].duration < startTime) + fromIndex = midIndex; + else + toIndex = midIndex; + } + return toIndex; } int SceneGraphTimelineModel::findLastIndex(qint64 endTime) const { - // TODO properly - int candidate = 0; - for (int i = d->eventList.count()-1; i >= 0; i--) - if (d->eventList[i].startTime < endTime) { - candidate = i; - break; - } - return candidate; + if (d->eventList.isEmpty()) + return -1; + if (d->eventList.first().startTime >= endTime) + return -1; + if (d->eventList.count() == 1) + return 0; + if (d->eventList.last().startTime <= endTime) + return d->eventList.count()-1; + + int fromIndex = 0; + int toIndex = d->eventList.count()-1; + while (toIndex - fromIndex > 1) { + int midIndex = (fromIndex + toIndex)/2; + if (d->eventList[midIndex].startTime < endTime) + fromIndex = midIndex; + else + toIndex = midIndex; + } + + return fromIndex; } int SceneGraphTimelineModel::getEventType(int index) const { - // TODO fix - return QmlDebug::PixmapCacheEvent; - //return QmlDebug::SceneGraphFrameEvent; - // return 0; + Q_UNUSED(index); + return QmlDebug::SceneGraphFrameEvent; } int SceneGraphTimelineModel::getEventCategory(int index) const @@ -259,6 +250,7 @@ QColor SceneGraphTimelineModel::getColor(int index) const float SceneGraphTimelineModel::getHeight(int index) const { + Q_UNUSED(index); return 1.0f; } @@ -275,6 +267,7 @@ QString labelForSGType(int t) const QVariantList SceneGraphTimelineModel::getLabelsForCategory(int category) const { + Q_UNUSED(category); QVariantList result; if (d->isExpanded && !isEmpty()) { @@ -448,6 +441,7 @@ void SceneGraphTimelineModel::loadData() d->eventList[lastRenderEvent].timing[15] = event.numericData1; break; } + default: break; } } } |