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:
Ulf Hermann
2016-04-26 13:23:35 +02:00
parent 67378a7928
commit 5ba6f04d4b
16 changed files with 460 additions and 496 deletions

View File

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