forked from qt-creator/qt-creator
QmlProfiler: Load the timeline model data event by event
All the models do the same thing when loading the data: They iterate the list of events, determine for each one if they accept it, and if so, they load it. After the list has been fully loaded, they do some finalization. This can be centralized, and ultimately we won't need to expose the central QVector<QmlEvent> for that anymore. Change-Id: Ia82facfdc3968200bbec323a02f2fcc02ac44e9e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -62,25 +62,16 @@ bool QmlProfilerRangeModel::supportsBindingLoops() const
|
||||
return rangeType() == Binding || rangeType() == HandlingSignal;
|
||||
}
|
||||
|
||||
void QmlProfilerRangeModel::loadData()
|
||||
void QmlProfilerRangeModel::loadEvent(const QmlEvent &event, const QmlEventType &type)
|
||||
{
|
||||
QmlProfilerDataModel *simpleModel = modelManager()->qmlModel();
|
||||
if (simpleModel->isEmpty())
|
||||
return;
|
||||
|
||||
// collect events
|
||||
const QVector<QmlEvent> &eventList = simpleModel->events();
|
||||
const QVector<QmlEventType> &typesList = simpleModel->eventTypes();
|
||||
foreach (const QmlEvent &event, eventList) {
|
||||
const QmlEventType &type = typesList[event.typeIndex()];
|
||||
if (!accepted(type))
|
||||
continue;
|
||||
|
||||
// store starttime-based instance
|
||||
m_data.insert(insert(event.timestamp(), event.duration(), event.typeIndex()),
|
||||
QmlRangeEventStartInstance());
|
||||
}
|
||||
Q_UNUSED(type);
|
||||
// store starttime-based instance
|
||||
m_data.insert(insert(event.timestamp(), event.duration(), event.typeIndex()),
|
||||
QmlRangeEventStartInstance());
|
||||
}
|
||||
|
||||
void QmlProfilerRangeModel::finalize()
|
||||
{
|
||||
// compute range nesting
|
||||
computeNesting();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user