From dcd8d37f351803fc0a1b9402b6503fd8dce93a09 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 28 Mar 2018 09:42:28 +0200 Subject: [PATCH] QmlProfiler: Don't expose the vector of event types We always want either the total number of event types or one specific type. There is no need to expose the fact that we keep them as a vector. Also, use int as the type of the "number" methods as that aligns better with Qt containers, and rename the methods. We don't need to state the fact that we've loaded the events and types at some point. Change-Id: Iaf680ec9fa10e1070ddee6bcc079800e401775f0 Reviewed-by: Tobias Hunger --- .../qmlprofiler/debugmessagesmodel.cpp | 2 +- src/plugins/qmlprofiler/flamegraphmodel.cpp | 3 +-- src/plugins/qmlprofiler/memoryusagemodel.cpp | 2 +- .../qmlprofiler/qmlprofilermodelmanager.cpp | 10 +++---- .../qmlprofiler/qmlprofilermodelmanager.h | 6 ++--- .../qmlprofiler/qmlprofilerrangemodel.cpp | 17 ++++++------ .../qmlprofiler/qmlprofilerstatewidget.cpp | 6 ++--- .../qmlprofilerstatisticsmodel.cpp | 15 +++++------ .../qmlprofiler/qmlprofilerstatisticsview.cpp | 2 +- .../qmlprofiler/qmlprofilertimelinemodel.cpp | 8 +++--- .../qmlprofiler/qmlprofilertraceclient.cpp | 4 +-- .../qmlprofiler/qmlprofilertracefile.cpp | 26 ++++++++++++++----- .../tests/debugmessagesmodel_test.cpp | 2 +- .../tests/flamegraphmodel_test.cpp | 2 +- .../tests/inputeventsmodel_test.cpp | 4 +-- .../tests/memoryusagemodel_test.cpp | 8 +++--- .../tests/pixmapcachemodel_test.cpp | 4 +-- .../tests/qmlprofileranimationsmodel_test.cpp | 2 +- .../tests/qmlprofilertool_test.cpp | 20 +++++++------- 19 files changed, 77 insertions(+), 66 deletions(-) diff --git a/src/plugins/qmlprofiler/debugmessagesmodel.cpp b/src/plugins/qmlprofiler/debugmessagesmodel.cpp index 0047d1143a4..b0217bf68d1 100644 --- a/src/plugins/qmlprofiler/debugmessagesmodel.cpp +++ b/src/plugins/qmlprofiler/debugmessagesmodel.cpp @@ -76,7 +76,7 @@ QVariantList DebugMessagesModel::labels() const QVariantMap DebugMessagesModel::details(int index) const { const QmlProfilerModelManager *manager = modelManager(); - const QmlEventType &type = manager->eventTypes()[m_data[index].typeId]; + const QmlEventType &type = manager->eventType(m_data[index].typeId); QVariantMap result; result.insert(QLatin1String("displayName"), messageType(type.detailType())); diff --git a/src/plugins/qmlprofiler/flamegraphmodel.cpp b/src/plugins/qmlprofiler/flamegraphmodel.cpp index 59e96accfed..9393b4213c6 100644 --- a/src/plugins/qmlprofiler/flamegraphmodel.cpp +++ b/src/plugins/qmlprofiler/flamegraphmodel.cpp @@ -227,8 +227,7 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const } if (stats.typeIndex != -1) { - const QVector &typeList = m_modelManager->eventTypes(); - const QmlEventType &type = typeList[stats.typeIndex]; + const QmlEventType &type = m_modelManager->eventType(stats.typeIndex); switch (role) { case FilenameRole: return type.location().filename(); diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp index bf2cc08d2c0..3257883d71d 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.cpp +++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp @@ -121,7 +121,7 @@ QVariantMap MemoryUsageModel::details(int index) const } result.insert(tr("Type"), memoryTypeName); - result.insert(tr("Location"), modelManager()->eventTypes().at(ev->typeId).displayName()); + result.insert(tr("Location"), modelManager()->eventType(ev->typeId).displayName()); return result; } diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index e8c5d362d47..7dbb10ba4ad 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -79,7 +79,7 @@ public: int numRegisteredModels = 0; int numFinishedFinalizers = 0; - uint numLoadedEvents = 0; + int numLoadedEvents = 0; quint64 availableFeatures = 0; quint64 visibleFeatures = 0; quint64 recordedFeatures = 0; @@ -183,12 +183,12 @@ bool QmlProfilerModelManager::isEmpty() const return d->file.pos() == 0; } -uint QmlProfilerModelManager::numLoadedEvents() const +int QmlProfilerModelManager::numEvents() const { return d->numLoadedEvents; } -uint QmlProfilerModelManager::numLoadedEventTypes() const +int QmlProfilerModelManager::numEventTypes() const { return d->eventTypes.count(); } @@ -254,9 +254,9 @@ void QmlProfilerModelManager::addEventType(const QmlEventType &type) } } -const QVector &QmlProfilerModelManager::eventTypes() const +const QmlEventType &QmlProfilerModelManager::eventType(int typeId) const { - return d->eventTypes; + return d->eventTypes.at(typeId); } static bool isStateful(const QmlEventType &type) diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h index 57623fd6fe1..a6ec8c4364d 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h @@ -73,8 +73,8 @@ public: Internal::QmlProfilerTextMarkModel *textMarkModel() const; bool isEmpty() const; - uint numLoadedEvents() const; - uint numLoadedEventTypes() const; + int numEvents() const; + int numEventTypes() const; int registerModelProxy(); void announceFeatures(quint64 features, EventLoader eventLoader, Finalizer finalizer); @@ -87,7 +87,7 @@ public: void addEventTypes(const QVector &types); void addEventType(const QmlEventType &type); - const QVector &eventTypes() const; + const QmlEventType &eventType(int typeId) const; bool replayEvents(qint64 rangeStart, qint64 rangeEnd, EventLoader loader) const; diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index 9e8a275c9b2..243e07a0c02 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -202,13 +202,14 @@ QVariantList QmlProfilerRangeModel::labels() const { QVariantList result; - const QVector &types = modelManager()->eventTypes(); + const QmlProfilerModelManager *manager = modelManager(); for (int i = 1; i < expandedRowCount(); i++) { // Ignore the -1 for the first row QVariantMap element; - int typeId = m_expandedRowTypes[i]; - element.insert(QLatin1String("displayName"), QVariant(types[typeId].displayName())); - element.insert(QLatin1String("description"), QVariant(types[typeId].data())); - element.insert(QLatin1String("id"), QVariant(typeId)); + const int typeId = m_expandedRowTypes[i]; + const QmlEventType &type = manager->eventType(typeId); + element.insert(QLatin1String("displayName"), type.displayName()); + element.insert(QLatin1String("description"), type.data()); + element.insert(QLatin1String("id"), typeId); result << element; } @@ -219,14 +220,14 @@ QVariantMap QmlProfilerRangeModel::details(int index) const { QVariantMap result; int id = selectionId(index); - const QVector &types = modelManager()->eventTypes(); result.insert(QStringLiteral("displayName"), tr(QmlProfilerModelManager::featureName(mainFeature()))); result.insert(tr("Duration"), Timeline::formatTime(duration(index))); - result.insert(tr("Details"), types[id].data()); - result.insert(tr("Location"), types[id].displayName()); + const QmlEventType &type = modelManager()->eventType(id); + result.insert(tr("Details"), type.data()); + result.insert(tr("Location"), type.displayName()); return result; } diff --git a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp index 56013861bbb..6b2f455f0de 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp @@ -117,7 +117,7 @@ void QmlProfilerStateWidget::updateDisplay() if (d->m_profilerState->serverRecording()) { // Heuristic to not show the number if the application will only send the events when it // stops. The number is still > 0 then because we get some StartTrace etc. - uint numEvents = d->m_modelManager->numLoadedEvents(); + uint numEvents = d->m_modelManager->numEvents(); showText(numEvents > 256 ? tr("Profiling application: %n events", 0, numEvents) : tr("Profiling application")); return; @@ -136,7 +136,7 @@ void QmlProfilerStateWidget::updateDisplay() if (state == QmlProfilerModelManager::AcquiringData) { // we don't know how much more, so progress numbers are strange here showText(tr("Loading buffered data: %n events", 0, - d->m_modelManager->numLoadedEvents())); + d->m_modelManager->numEvents())); } else if (state == QmlProfilerModelManager::ClearingData) { // when starting a second recording from the same process without aggregation showText(tr("Clearing old trace")); @@ -144,7 +144,7 @@ void QmlProfilerStateWidget::updateDisplay() } else if (state == QmlProfilerModelManager::AcquiringData) { // Application died before all data could be read showText(tr("Loading offline data: %n events", 0, - d->m_modelManager->numLoadedEvents())); + d->m_modelManager->numEvents())); } else if (state == QmlProfilerModelManager::ClearingData) { showText(tr("Clearing old trace")); } diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp index 5cdfa0d9108..13b6064eb46 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp @@ -127,9 +127,8 @@ QStringList QmlProfilerStatisticsModel::details(int typeIndex) const QString data; QString displayName; - const QVector &eventTypes = m_modelManager->eventTypes(); - if (typeIndex >= 0 && typeIndex < eventTypes.count()) { - const QmlEventType &type = eventTypes.at(typeIndex); + if (typeIndex >= 0 && typeIndex < m_modelManager->numEventTypes()) { + const QmlEventType &type = m_modelManager->eventType(typeIndex); displayName = nameForType(type.rangeType()); const QChar ellipsisChar(0x2026); @@ -272,7 +271,7 @@ QVariant QmlProfilerStatisticsModel::data(const QModelIndex &index, int role) co return dataForMainEntry(index, role); const int typeIndex = index.row(); - const QmlEventType &type = m_modelManager->eventTypes().at(typeIndex); + const QmlEventType &type = m_modelManager->eventType(typeIndex); const QmlEventStats &stats = m_data.at(typeIndex); switch (role) { @@ -448,7 +447,7 @@ void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEvent case RangeStart: stack.push(event); if (m_data.length() <= typeIndex) - m_data.resize(m_modelManager->numLoadedEventTypes()); + m_data.resize(m_modelManager->numEventTypes()); break; case RangeEnd: { // update stats @@ -610,13 +609,11 @@ QVariant QmlProfilerStatisticsRelativesModel::data(const QModelIndex &index, int const QmlStatisticsRelativesData &stats = data.at(row); QTC_ASSERT(stats.typeIndex >= 0, return QVariant()); - const QVector &eventTypes = m_modelManager->eventTypes(); - if (stats.typeIndex == QmlProfilerStatisticsModel::s_mainEntryTypeId) return dataForMainEntry(stats.duration, role, index.column()); - QTC_ASSERT(stats.typeIndex < eventTypes.size(), return QVariant()); - const QmlEventType &type = eventTypes.at(stats.typeIndex); + QTC_ASSERT(stats.typeIndex < m_modelManager->numEventTypes(), return QVariant()); + const QmlEventType &type = m_modelManager->eventType(stats.typeIndex); switch (role) { case TypeIdRole: diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp index 67e4c28baae..94849db8ff0 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp @@ -79,7 +79,7 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr this, [this, profilerModelManager](int typeIndex) { // Statistics view has an extra type for "whole program". Translate that into "invalid" for // others. - emit typeSelected((typeIndex < profilerModelManager->eventTypes().count()) + emit typeSelected((typeIndex < profilerModelManager->numEventTypes()) ? typeIndex : QmlProfilerStatisticsModel::s_invalidTypeId); }); diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp index 3089598c99a..2aeb0883ef2 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp @@ -71,7 +71,7 @@ bool QmlProfilerTimelineModel::handlesTypeId(int typeIndex) const if (typeIndex < 0) return false; - return accepted(modelManager()->eventTypes().at(typeIndex)); + return accepted(modelManager()->eventType(typeIndex)); } QmlProfilerModelManager *QmlProfilerTimelineModel::modelManager() const @@ -116,11 +116,11 @@ QVariantMap QmlProfilerTimelineModel::locationFromTypeId(int index) const if (id < 0) return result; - auto types = modelManager()->eventTypes(); - if (id >= types.length()) + const QmlProfilerModelManager *manager = modelManager(); + if (id >= manager->numEventTypes()) return result; - QmlEventLocation location = types.at(id).location(); + QmlEventLocation location = manager->eventType(id).location(); result.insert(QStringLiteral("file"), location.filename()); result.insert(QStringLiteral("line"), location.line()); diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp index ce81bd434e9..47310a41432 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp @@ -109,7 +109,7 @@ int QmlProfilerTraceClientPrivate::resolveType(const QmlTypedEvent &event) if (it != serverTypeIds.constEnd()) { typeIndex = it.value(); } else { - typeIndex = modelManager->numLoadedEventTypes(); + typeIndex = modelManager->numEventTypes(); modelManager->addEventType(event.type); serverTypeIds[event.serverTypeId] = typeIndex; } @@ -119,7 +119,7 @@ int QmlProfilerTraceClientPrivate::resolveType(const QmlTypedEvent &event) if (it != eventTypeIds.constEnd()) { typeIndex = it.value(); } else { - typeIndex = modelManager->numLoadedEventTypes(); + typeIndex = modelManager->numEventTypes(); modelManager->addEventType(event.type); eventTypeIds[event.type] = typeIndex; } diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index 972b8c2f126..ec1fe76e1d7 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -227,7 +227,19 @@ void QmlProfilerFileReader::loadQzt(QIODevice *device) stream >> data; buffer.setData(qUncompress(data)); buffer.open(QIODevice::ReadOnly); - bufferStream >> m_eventTypes; + quint32 numEventTypes; + bufferStream >> numEventTypes; + if (numEventTypes > std::numeric_limits::max()) { + emit error(tr("Excessive number of event types: %1").arg(numEventTypes)); + return; + } + QTC_ASSERT(m_eventTypes.isEmpty(), m_eventTypes.clear()); + m_eventTypes.reserve(static_cast(numEventTypes)); + QmlEventType type; + for (int typeId = 0; typeId < static_cast(numEventTypes); ++typeId) { + bufferStream >> type; + m_eventTypes.append(type); + } buffer.close(); emit typesLoaded(m_eventTypes); updateProgress(device); @@ -676,11 +688,10 @@ void QmlProfilerFileWriter::saveQtd(QIODevice *device) stream.writeStartElement(_("eventData")); stream.writeAttribute(_("totalTime"), QString::number(m_measuredTime)); - const QVector &eventTypes = m_modelManager->eventTypes(); - for (int typeIndex = 0, end = eventTypes.length(); typeIndex < end && !isCanceled(); - ++typeIndex) { + for (int typeIndex = 0, end = m_modelManager->numEventTypes(); + typeIndex < end && !isCanceled(); ++typeIndex) { - const QmlEventType &type = eventTypes[typeIndex]; + const QmlEventType &type = m_modelManager->eventType(typeIndex); stream.writeStartElement(_("event")); stream.writeAttribute(_("index"), QString::number(typeIndex)); @@ -856,7 +867,10 @@ void QmlProfilerFileWriter::saveQzt(QFile *file) buffer.open(QIODevice::WriteOnly); if (!isCanceled()) { - bufferStream << m_modelManager->eventTypes(); + const int numEventTypes = m_modelManager->numEventTypes(); + bufferStream << static_cast(numEventTypes); + for (int typeId = 0; typeId < numEventTypes; ++typeId) + bufferStream << m_modelManager->eventType(typeId); stream << qCompress(buffer.data()); buffer.close(); buffer.buffer().clear(); diff --git a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp index e402e782956..85103758a66 100644 --- a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp @@ -48,7 +48,7 @@ void DebugMessagesModelTest::initTestCase() event.setString(QString::fromLatin1("message %1").arg(i)); QmlEventType type(DebugMessage, MaximumRangeType, i % (QtMsgType::QtInfoMsg + 1), QmlEventLocation("somefile.js", i, 10 - i)); - event.setTypeIndex(manager.numLoadedEventTypes()); + event.setTypeIndex(manager.numEventTypes()); manager.addEventType(type); manager.addEvent(event); } diff --git a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp index f21dbcacf5b..c2db0182451 100644 --- a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp @@ -57,7 +57,7 @@ int FlameGraphModelTest::generateData(QmlProfilerModelManager *manager) QmlEventType type(MaximumMessage, static_cast(static_cast(Javascript) - i), -1, QmlEventLocation("somefile.js", i, 20 - i), QString("funcfunc")); - typeIndex = manager->numLoadedEventTypes(); + typeIndex = manager->numEventTypes(); manager->addEventType(type); } else { typeIndex = typeIndices[i - 5]; diff --git a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp index 77a0a02b2c4..fb6896e6f11 100644 --- a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp @@ -40,9 +40,9 @@ static InputEventType inputType(int i) InputEventsModelTest::InputEventsModelTest(QObject *parent) : QObject(parent), manager(nullptr), model(&manager) { - keyTypeId = manager.numLoadedEventTypes(); + keyTypeId = manager.numEventTypes(); manager.addEventType(QmlEventType(Event, MaximumRangeType, Key)); - mouseTypeId = manager.numLoadedEventTypes(); + mouseTypeId = manager.numEventTypes(); manager.addEventType(QmlEventType(Event, MaximumRangeType, Mouse)); } diff --git a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp index a36dfba5bc3..92d17524613 100644 --- a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp @@ -40,11 +40,11 @@ void MemoryUsageModelTest::initTestCase() qint64 timestamp = 0; - heapPageTypeId = manager.numLoadedEventTypes(); + heapPageTypeId = manager.numEventTypes(); manager.addEventType(QmlEventType(MemoryAllocation, MaximumRangeType, HeapPage)); - smallItemTypeId = manager.numLoadedEventTypes(); + smallItemTypeId = manager.numEventTypes(); manager.addEventType(QmlEventType(MemoryAllocation, MaximumRangeType, SmallItem)); - largeItemTypeId = manager.numLoadedEventTypes(); + largeItemTypeId = manager.numEventTypes(); manager.addEventType(QmlEventType(MemoryAllocation, MaximumRangeType, LargeItem)); auto addMemoryEvents = [&]() { @@ -73,7 +73,7 @@ void MemoryUsageModelTest::initTestCase() addMemoryEvents(); - rangeTypeId = manager.numLoadedEventTypes(); + rangeTypeId = manager.numEventTypes(); manager.addEventType(QmlEventType(MaximumMessage, Javascript, -1, QmlEventLocation(QString("somefile.js"), 10, 20), QString("funcfunc"))); diff --git a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp index 52325ac8e2c..c0148f2c83a 100644 --- a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp @@ -42,7 +42,7 @@ void PixmapCacheModelTest::initTestCase() manager.increaseTraceEnd(300); for (int i = 0; i < MaximumPixmapEventType; ++i) { - eventTypeIndices[i] = manager.numLoadedEventTypes(); + eventTypeIndices[i] = manager.numEventTypes(); manager.addEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i, QmlEventLocation("dings.png", 0, 0))); } @@ -57,7 +57,7 @@ void PixmapCacheModelTest::initTestCase() } for (int i = 0; i < MaximumPixmapEventType; ++i) { - eventTypeIndices[i + MaximumPixmapEventType] = manager.numLoadedEventTypes(); + eventTypeIndices[i + MaximumPixmapEventType] = manager.numEventTypes(); manager.addEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i, QmlEventLocation("blah.png", 0, 0))); } diff --git a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp index a940656d52d..6b18fde64fb 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp @@ -46,7 +46,7 @@ void QmlProfilerAnimationsModelTest::initTestCase() QmlEventType type(Event, MaximumRangeType, AnimationFrame); QmlEvent event; - event.setTypeIndex(manager.numLoadedEventTypes()); + event.setTypeIndex(manager.numEventTypes()); manager.addEventType(type); for (int i = 0; i < 10; ++i) { diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp index 62cfb0d933e..dea61ac4455 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp @@ -98,21 +98,21 @@ void QmlProfilerToolTest::testClearEvents() stateManager->setCurrentState(QmlProfilerStateManager::AppRunning); stateManager->setServerRecording(true); - QCOMPARE(modelManager->numLoadedEventTypes(), 0u); - QCOMPARE(modelManager->numLoadedEvents(), 0u); + QCOMPARE(modelManager->numEventTypes(), 0); + QCOMPARE(modelManager->numEvents(), 0); modelManager->addEventType(QmlEventType()); modelManager->addEvent(QmlEvent(0, 0, "")); - QCOMPARE(modelManager->numLoadedEventTypes(), 1u); - QCOMPARE(modelManager->numLoadedEvents(), 1u); + QCOMPARE(modelManager->numEventTypes(), 1); + QCOMPARE(modelManager->numEvents(), 1); stateManager->setServerRecording(false); - QCOMPARE(modelManager->numLoadedEventTypes(), 1u); - QCOMPARE(modelManager->numLoadedEvents(), 1u); + QCOMPARE(modelManager->numEventTypes(), 1); + QCOMPARE(modelManager->numEvents(), 1); stateManager->setServerRecording(true); // clears previous events, but not types - QCOMPARE(modelManager->numLoadedEventTypes(), 1u); - QCOMPARE(modelManager->numLoadedEvents(), 0u); + QCOMPARE(modelManager->numEventTypes(), 1); + QCOMPARE(modelManager->numEvents(), 0); modelManager->addEvent(QmlEvent(0, 0, "")); - QCOMPARE(modelManager->numLoadedEventTypes(), 1u); - QCOMPARE(modelManager->numLoadedEvents(), 1u); + QCOMPARE(modelManager->numEventTypes(), 1); + QCOMPARE(modelManager->numEvents(), 1); } } // namespace Internal