forked from qt-creator/qt-creator
QmlProfiler: Store typeIds in range data
We'll need to refer to them for additional global metadata. Change-Id: I717d3199b5ce8846c273b93bb8cd31fe3941035b Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -260,6 +260,11 @@ int AbstractTimelineModel::rowCount() const
|
|||||||
return d->expanded ? d->expandedRowCount : d->collapsedRowCount;
|
return d->expanded ? d->expandedRowCount : d->collapsedRowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AbstractTimelineModel::selectionId(int index) const
|
||||||
|
{
|
||||||
|
return range(index).typeId;
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractTimelineModel::clear()
|
void AbstractTimelineModel::clear()
|
||||||
{
|
{
|
||||||
Q_D(AbstractTimelineModel);
|
Q_D(AbstractTimelineModel);
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ public:
|
|||||||
int rowCount() const;
|
int rowCount() const;
|
||||||
|
|
||||||
// Methods that have to be implemented by child models
|
// Methods that have to be implemented by child models
|
||||||
virtual int selectionId(int index) const = 0;
|
|
||||||
virtual QColor color(int index) const = 0;
|
virtual QColor color(int index) const = 0;
|
||||||
virtual QVariantList labels() const = 0;
|
virtual QVariantList labels() const = 0;
|
||||||
virtual QVariantMap details(int index) const = 0;
|
virtual QVariantMap details(int index) const = 0;
|
||||||
@@ -83,6 +82,7 @@ public:
|
|||||||
// Methods which can optionally be implemented by child models.
|
// Methods which can optionally be implemented by child models.
|
||||||
// returned map should contain "file", "line", "column" properties, or be empty
|
// returned map should contain "file", "line", "column" properties, or be empty
|
||||||
virtual QVariantMap location(int index) const;
|
virtual QVariantMap location(int index) const;
|
||||||
|
virtual int selectionId(int index) const;
|
||||||
virtual bool isSelectionIdValid(int selectionId) const;
|
virtual bool isSelectionIdValid(int selectionId) const;
|
||||||
virtual int selectionIdForLocation(const QString &filename, int line, int column) const;
|
virtual int selectionIdForLocation(const QString &filename, int line, int column) const;
|
||||||
virtual int bindingLoopDest(int index) const;
|
virtual int bindingLoopDest(int index) const;
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ void PaintEventsModelProxy::loadData()
|
|||||||
lastEvent.animationcount = (int)event.numericData2;
|
lastEvent.animationcount = (int)event.numericData2;
|
||||||
QTC_ASSERT(lastEvent.animationcount > 0, continue);
|
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)
|
if (lastEvent.threadId == QmlDebug::GuiThread)
|
||||||
d->maxGuiThreadAnimations = qMax(lastEvent.animationcount, d->maxGuiThreadAnimations);
|
d->maxGuiThreadAnimations = qMax(lastEvent.animationcount, d->maxGuiThreadAnimations);
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ void RangeTimelineModel::loadData()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// store starttime-based instance
|
// store starttime-based instance
|
||||||
d->data.insert(insert(event.startTime, event.duration),
|
d->data.insert(insert(event.startTime, event.duration, event.typeIndex),
|
||||||
QmlRangeEventStartInstance(event.typeIndex));
|
QmlRangeEventStartInstance());
|
||||||
d->modelManager->modelProxyCountUpdated(d->modelId, count(), eventList.count() * 6);
|
d->modelManager->modelProxyCountUpdated(d->modelId, count(), eventList.count() * 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ void RangeTimelineModel::RangeTimelineModelPrivate::computeExpandedLevels()
|
|||||||
QHash<int, int> eventRow;
|
QHash<int, int> eventRow;
|
||||||
int eventCount = q->count();
|
int eventCount = q->count();
|
||||||
for (int i = 0; i < eventCount; i++) {
|
for (int i = 0; i < eventCount; i++) {
|
||||||
int typeId = data[i].typeId;
|
int typeId = q->range(i).typeId;
|
||||||
if (!eventRow.contains(typeId)) {
|
if (!eventRow.contains(typeId)) {
|
||||||
eventRow[typeId] = expandedRowTypes.size();
|
eventRow[typeId] = expandedRowTypes.size();
|
||||||
expandedRowTypes << typeId;
|
expandedRowTypes << typeId;
|
||||||
@@ -194,14 +194,14 @@ void RangeTimelineModel::RangeTimelineModelPrivate::findBindingLoops()
|
|||||||
|
|
||||||
// check whether event is already in stack
|
// check whether event is already in stack
|
||||||
for (int ii = 0; ii < callStack.size(); ++ii) {
|
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;
|
data[i].bindingLoopHead = callStack.at(ii).second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CallStackEntry newEntry(data[i].typeId, i);
|
CallStackEntry newEntry(q->range(i).typeId, i);
|
||||||
callStack.push(newEntry);
|
callStack.push(newEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,12 +224,6 @@ int RangeTimelineModel::row(int index) const
|
|||||||
return d->data[index].displayRowCollapsed;
|
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
|
int RangeTimelineModel::bindingLoopDest(int index) const
|
||||||
{
|
{
|
||||||
Q_D(const RangeTimelineModel);
|
Q_D(const RangeTimelineModel);
|
||||||
|
|||||||
@@ -49,14 +49,11 @@ class RangeTimelineModel : public AbstractTimelineModel
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
struct QmlRangeEventStartInstance {
|
struct QmlRangeEventStartInstance {
|
||||||
QmlRangeEventStartInstance(int typeId = -1) :
|
QmlRangeEventStartInstance() :
|
||||||
typeId(typeId),
|
|
||||||
displayRowExpanded(QmlDebug::Constants::QML_MIN_LEVEL),
|
displayRowExpanded(QmlDebug::Constants::QML_MIN_LEVEL),
|
||||||
displayRowCollapsed(QmlDebug::Constants::QML_MIN_LEVEL),
|
displayRowCollapsed(QmlDebug::Constants::QML_MIN_LEVEL),
|
||||||
bindingLoopHead(-1) {}
|
bindingLoopHead(-1) {}
|
||||||
|
|
||||||
int typeId;
|
|
||||||
|
|
||||||
// not-expanded, per type
|
// not-expanded, per type
|
||||||
int displayRowExpanded;
|
int displayRowExpanded;
|
||||||
int displayRowCollapsed;
|
int displayRowCollapsed;
|
||||||
@@ -69,7 +66,6 @@ public:
|
|||||||
quint64 features() const;
|
quint64 features() const;
|
||||||
|
|
||||||
int row(int index) const;
|
int row(int index) const;
|
||||||
int selectionId(int index) const;
|
|
||||||
int bindingLoopDest(int index) const;
|
int bindingLoopDest(int index) const;
|
||||||
QColor color(int index) const;
|
QColor color(int index) const;
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,12 @@ class QMLPROFILER_EXPORT SortedTimelineModel : public QObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct Range {
|
struct Range {
|
||||||
Range() : start(-1), duration(-1), parent(-1) {}
|
Range() : start(-1), duration(-1), typeId(-1), parent(-1) {}
|
||||||
Range(qint64 start, qint64 duration) :
|
Range(qint64 start, qint64 duration, int typeId) :
|
||||||
start(start), duration(duration), parent(-1) {}
|
start(start), duration(duration), typeId(typeId), parent(-1) {}
|
||||||
qint64 start;
|
qint64 start;
|
||||||
qint64 duration;
|
qint64 duration;
|
||||||
|
int typeId;
|
||||||
int parent;
|
int parent;
|
||||||
inline qint64 timestamp() const {return start;}
|
inline qint64 timestamp() const {return start;}
|
||||||
};
|
};
|
||||||
@@ -75,20 +76,20 @@ public:
|
|||||||
|
|
||||||
inline const Range &range(int index) const { return ranges[index]; }
|
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
|
/* 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. */
|
* 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)
|
if (index < ranges.size() - 1)
|
||||||
incrementStartIndices(index);
|
incrementStartIndices(index);
|
||||||
insertSorted(endTimes, RangeEnd(index, startTime + duration));
|
insertSorted(endTimes, RangeEnd(index, startTime + duration));
|
||||||
return index;
|
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)
|
if (index < ranges.size() - 1)
|
||||||
incrementStartIndices(index);
|
incrementStartIndices(index);
|
||||||
return index;
|
return index;
|
||||||
|
|||||||
Reference in New Issue
Block a user