Commit 71ac0956 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Store typeIds in range data



We'll need to refer to them for additional global metadata.

Change-Id: I717d3199b5ce8846c273b93bb8cd31fe3941035b
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 38f4d6a5
......@@ -260,6 +260,11 @@ int AbstractTimelineModel::rowCount() const
return d->expanded ? d->expandedRowCount : d->collapsedRowCount;
}
int AbstractTimelineModel::selectionId(int index) const
{
return range(index).typeId;
}
void AbstractTimelineModel::clear()
{
Q_D(AbstractTimelineModel);
......
......@@ -73,7 +73,6 @@ public:
int rowCount() const;
// Methods that have to be implemented by child models
virtual int selectionId(int index) const = 0;
virtual QColor color(int index) const = 0;
virtual QVariantList labels() const = 0;
virtual QVariantMap details(int index) const = 0;
......@@ -83,6 +82,7 @@ public:
// Methods which can optionally be implemented by child models.
// returned map should contain "file", "line", "column" properties, or be empty
virtual QVariantMap location(int index) const;
virtual int selectionId(int index) const;
virtual bool isSelectionIdValid(int selectionId) const;
virtual int selectionIdForLocation(const QString &filename, int line, int column) const;
virtual int bindingLoopDest(int index) const;
......
......@@ -126,7 +126,8 @@ void PaintEventsModelProxy::loadData()
lastEvent.animationcount = (int)event.numericData2;
QTC_ASSERT(lastEvent.animationcount > 0, continue);
d->data.insert(insert(realStartTime, realEndTime - realStartTime), lastEvent);
d->data.insert(insert(realStartTime, realEndTime - realStartTime, event.typeIndex),
lastEvent);
if (lastEvent.threadId == QmlDebug::GuiThread)
d->maxGuiThreadAnimations = qMax(lastEvent.animationcount, d->maxGuiThreadAnimations);
......
......@@ -98,8 +98,8 @@ void RangeTimelineModel::loadData()
continue;
// store starttime-based instance
d->data.insert(insert(event.startTime, event.duration),
QmlRangeEventStartInstance(event.typeIndex));
d->data.insert(insert(event.startTime, event.duration, event.typeIndex),
QmlRangeEventStartInstance());
d->modelManager->modelProxyCountUpdated(d->modelId, count(), eventList.count() * 6);
}
......@@ -162,7 +162,7 @@ void RangeTimelineModel::RangeTimelineModelPrivate::computeExpandedLevels()
QHash<int, int> eventRow;
int eventCount = q->count();
for (int i = 0; i < eventCount; i++) {
int typeId = data[i].typeId;
int typeId = q->range(i).typeId;
if (!eventRow.contains(typeId)) {
eventRow[typeId] = expandedRowTypes.size();
expandedRowTypes << typeId;
......@@ -194,14 +194,14 @@ void RangeTimelineModel::RangeTimelineModelPrivate::findBindingLoops()
// check whether event is already in stack
for (int ii = 0; ii < callStack.size(); ++ii) {
if (callStack.at(ii).first == data[i].typeId) {
if (callStack.at(ii).first == q->range(i).typeId) {
data[i].bindingLoopHead = callStack.at(ii).second;
break;
}
}
CallStackEntry newEntry(data[i].typeId, i);
CallStackEntry newEntry(q->range(i).typeId, i);
callStack.push(newEntry);
}
......@@ -224,12 +224,6 @@ int RangeTimelineModel::row(int index) const
return d->data[index].displayRowCollapsed;
}
int RangeTimelineModel::selectionId(int index) const
{
Q_D(const RangeTimelineModel);
return d->data[index].typeId;
}
int RangeTimelineModel::bindingLoopDest(int index) const
{
Q_D(const RangeTimelineModel);
......
......@@ -49,14 +49,11 @@ class RangeTimelineModel : public AbstractTimelineModel
public:
struct QmlRangeEventStartInstance {
QmlRangeEventStartInstance(int typeId = -1) :
typeId(typeId),
QmlRangeEventStartInstance() :
displayRowExpanded(QmlDebug::Constants::QML_MIN_LEVEL),
displayRowCollapsed(QmlDebug::Constants::QML_MIN_LEVEL),
bindingLoopHead(-1) {}
int typeId;
// not-expanded, per type
int displayRowExpanded;
int displayRowCollapsed;
......@@ -69,7 +66,6 @@ public:
quint64 features() const;
int row(int index) const;
int selectionId(int index) const;
int bindingLoopDest(int index) const;
QColor color(int index) const;
......
......@@ -42,11 +42,12 @@ class QMLPROFILER_EXPORT SortedTimelineModel : public QObject {
public:
struct Range {
Range() : start(-1), duration(-1), parent(-1) {}
Range(qint64 start, qint64 duration) :
start(start), duration(duration), parent(-1) {}
Range() : start(-1), duration(-1), typeId(-1), parent(-1) {}
Range(qint64 start, qint64 duration, int typeId) :
start(start), duration(duration), typeId(typeId), parent(-1) {}
qint64 start;
qint64 duration;
int typeId;
int parent;
inline qint64 timestamp() const {return start;}
};
......@@ -75,20 +76,20 @@ public:
inline const Range &range(int index) const { return ranges[index]; }
inline int insert(qint64 startTime, qint64 duration)
inline int insert(qint64 startTime, qint64 duration, int typeId)
{
/* Doing insert-sort here is preferable as most of the time the times will actually be
* presorted in the right way. So usually this will just result in appending. */
int index = insertSorted(ranges, Range(startTime, duration));
int index = insertSorted(ranges, Range(startTime, duration, typeId));
if (index < ranges.size() - 1)
incrementStartIndices(index);
insertSorted(endTimes, RangeEnd(index, startTime + duration));
return index;
}
inline int insertStart(qint64 startTime)
inline int insertStart(qint64 startTime, int typeId)
{
int index = insertSorted(ranges, Range(startTime, 0));
int index = insertSorted(ranges, Range(startTime, 0, typeId));
if (index < ranges.size() - 1)
incrementStartIndices(index);
return index;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment