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>
This commit is contained in:
Ulf Hermann
2014-06-12 15:34:38 +02:00
parent 74414bb9e7
commit 3ea13b9b12
6 changed files with 14 additions and 47 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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);

View File

@@ -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;