diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-12 15:34:38 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-17 16:25:31 +0200 |
commit | 3ea13b9b12119529b8695d1a4c54317fc69087dd (patch) | |
tree | e7d0babcbb35612b6dc926fdccb31f09b3c079c4 /src/plugins/qmlprofiler | |
parent | 74414bb9e7a6530d3f64172607e3279910bcfa22 (diff) | |
download | qt-creator-3ea13b9b12119529b8695d1a4c54317fc69087dd.tar.gz |
QmlProfiler: remove eventType and simplify nesting calculations
With only one category per model we only have one eventType per model
and thus we don't need to differentiate per type anymore when
calculating the nesting.
Change-Id: Ic42a1c5c056f3480b7842a57fbff66a5e907abfb
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/plugins/qmlprofiler')
6 files changed, 14 insertions, 47 deletions
diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel.h b/src/plugins/qmlprofiler/abstracttimelinemodel.h index 9518b3adb5..24cfd4c91b 100644 --- a/src/plugins/qmlprofiler/abstracttimelinemodel.h +++ b/src/plugins/qmlprofiler/abstracttimelinemodel.h @@ -76,7 +76,6 @@ public: Q_INVOKABLE virtual QColor getColor(int index) const = 0; virtual const QVariantList getLabels() const = 0; Q_INVOKABLE virtual const QVariantList getEventDetails(int index) const = 0; - virtual int getEventType(int index) const = 0; virtual int getEventRow(int index) const = 0; virtual void loadData() = 0; virtual void clear() = 0; diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp index 1ff2dc8ea4..0b053351f0 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp @@ -159,42 +159,31 @@ void RangeTimelineModel::loadData() void RangeTimelineModel::RangeTimelineModelPrivate::computeNestingContracted() { - Q_Q(RangeTimelineModel); int i; int eventCount = count(); - QList<int> nestingLevels; - QList< QHash<int, qint64> > endtimesPerNestingLevel; - - for (i = 0; i < QmlDebug::MaximumRangeType; i++) { - nestingLevels << QmlDebug::Constants::QML_MIN_LEVEL; - QHash<int, qint64> dummyHash; - dummyHash[QmlDebug::Constants::QML_MIN_LEVEL] = 0; - endtimesPerNestingLevel << dummyHash; - } + int nestingLevels = QmlDebug::Constants::QML_MIN_LEVEL; + contractedRows = nestingLevels + 1; + QVector<qint64> nestingEndTimes; + nestingEndTimes.fill(0, nestingLevels + 1); for (i = 0; i < eventCount; i++) { qint64 st = ranges[i].start; - int type = q->getEventType(i); // per type - if (endtimesPerNestingLevel[type][nestingLevels[type]] > st) { - nestingLevels[type]++; + if (nestingEndTimes[nestingLevels] > st) { + if (++nestingLevels == nestingEndTimes.length()) + nestingEndTimes << 0; + if (nestingLevels == contractedRows) + ++contractedRows; } else { - while (nestingLevels[type] > QmlDebug::Constants::QML_MIN_LEVEL && - endtimesPerNestingLevel[type][nestingLevels[type]-1] <= st) - nestingLevels[type]--; + while (nestingLevels > QmlDebug::Constants::QML_MIN_LEVEL && + nestingEndTimes[nestingLevels-1] <= st) + nestingLevels--; } - endtimesPerNestingLevel[type][nestingLevels[type]] = - st + ranges[i].duration; + nestingEndTimes[nestingLevels] = st + ranges[i].duration; - ranges[i].displayRowCollapsed = nestingLevels[type]; - } - - // nestingdepth - for (i = 0; i < eventCount; i++) { - if (contractedRows <= ranges[i].displayRowCollapsed) - contractedRows = ranges[i].displayRowCollapsed + 1; + ranges[i].displayRowCollapsed = nestingLevels; } } @@ -275,13 +264,6 @@ QString RangeTimelineModel::categoryLabel(int categoryIndex) } } -int RangeTimelineModel::getEventType(int index) const -{ - Q_D(const RangeTimelineModel); - Q_UNUSED(index); - return d->rangeType; -} - int RangeTimelineModel::getEventRow(int index) const { Q_D(const RangeTimelineModel); diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h index 25c95465cd..4f8fffdc3f 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h @@ -81,7 +81,6 @@ public: Q_INVOKABLE int rowCount() const; static QString categoryLabel(int categoryIndex); - int getEventType(int index) const; int getEventRow(int index) const; Q_INVOKABLE int getEventId(int index) const; int getBindingLoopDest(int index) const; diff --git a/src/plugins/qmlprofiler/singlecategorytimelinemodel.cpp b/src/plugins/qmlprofiler/singlecategorytimelinemodel.cpp index c8298172b5..666b27ba21 100644 --- a/src/plugins/qmlprofiler/singlecategorytimelinemodel.cpp +++ b/src/plugins/qmlprofiler/singlecategorytimelinemodel.cpp @@ -73,11 +73,4 @@ const QString SingleCategoryTimelineModel::title() const return d->title; } -int SingleCategoryTimelineModel::getEventType(int index) const -{ - Q_D(const SingleCategoryTimelineModel); - Q_UNUSED(index); - return (d->message << 8) + d->rangeType; -} - } diff --git a/src/plugins/qmlprofiler/timelinemodelaggregator.cpp b/src/plugins/qmlprofiler/timelinemodelaggregator.cpp index 3c7daf6539..716e77b32f 100644 --- a/src/plugins/qmlprofiler/timelinemodelaggregator.cpp +++ b/src/plugins/qmlprofiler/timelinemodelaggregator.cpp @@ -175,11 +175,6 @@ int TimelineModelAggregator::findLastIndex(int modelIndex, qint64 endTime) const return d->modelList[modelIndex]->findLastIndex(endTime); } -int TimelineModelAggregator::getEventType(int modelIndex, int index) const -{ - return d->modelList[modelIndex]->getEventType(index); -} - int TimelineModelAggregator::getEventRow(int modelIndex, int index) const { return d->modelList[modelIndex]->getEventRow(index); diff --git a/src/plugins/qmlprofiler/timelinemodelaggregator.h b/src/plugins/qmlprofiler/timelinemodelaggregator.h index e49866d9c5..b0135c8f7f 100644 --- a/src/plugins/qmlprofiler/timelinemodelaggregator.h +++ b/src/plugins/qmlprofiler/timelinemodelaggregator.h @@ -71,7 +71,6 @@ public: int findFirstIndexNoParents(int modelIndex, qint64 startTime) const; int findLastIndex(int modelIndex, qint64 endTime) const; - int getEventType(int modelIndex, int index) const; int getEventRow(int modelIndex, int index) const; Q_INVOKABLE qint64 getDuration(int modelIndex, int index) const; Q_INVOKABLE qint64 getStartTime(int modelIndex, int index) const; |