aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-05-04 17:19:08 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-05-08 16:11:25 +0000
commit6e0373adb36185c602d06548fef51c68a4e94855 (patch)
tree6f13d5ef03bbdce2c7406eb01e00763246b2d3f0 /src/plugins/qmlprofiler
parent447befac61d1c320c5ccf510e5c4525b319917ba (diff)
Tracing: Move the type storage out of the trace manager
When we replay events we want to keep this constant and pass it to the event receivers as separate entity. This way we can move the replaying to a separate thread. When loading we will have a similar situation, but then the loading thread will create a new type storage and later assign that to the trace manager. Change-Id: I11402ed1e0663da6da5b61b15bba40e1a62adc4b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp150
-rw-r--r--src/plugins/qmlprofiler/qmlprofilermodelmanager.h6
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceclient.cpp8
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertracefile.cpp26
-rw-r--r--src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp2
-rw-r--r--src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp10
-rw-r--r--src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp6
-rw-r--r--src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp12
-rw-r--r--src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp8
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp5
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp7
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp7
12 files changed, 139 insertions, 108 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
index 42b5f280c43..f859a0f027a 100644
--- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
@@ -61,14 +61,25 @@ static const char *ProfileFeatureNames[] = {
Q_STATIC_ASSERT(sizeof(ProfileFeatureNames) == sizeof(char *) * MaximumProfileFeature);
+class QmlProfilerEventTypeStorage : public Timeline::TraceEventTypeStorage
+{
+public:
+ const Timeline::TraceEventType &get(int typeId) const override;
+ void set(int typeId, Timeline::TraceEventType &&type) override;
+ int append(Timeline::TraceEventType &&type) override;
+ int size() const override;
+ void clear() override;
+
+private:
+ std::vector<QmlEventType> m_types;
+};
+
class QmlProfilerModelManager::QmlProfilerModelManagerPrivate
{
public:
QmlProfilerModelManagerPrivate() : file("qmlprofiler-data") {}
Internal::QmlProfilerTextMarkModel *textMarkModel = nullptr;
-
- QVector<QmlEventType> eventTypes;
Internal::QmlProfilerDetailsRewriter *detailsRewriter = nullptr;
Timeline::TraceStashFile<QmlEvent> file;
@@ -79,12 +90,12 @@ public:
void addEventType(const QmlEventType &eventType);
void handleError(const QString &message);
- void rewriteType(int typeIndex);
int resolveStackTop();
};
QmlProfilerModelManager::QmlProfilerModelManager(QObject *parent) :
- Timeline::TimelineTraceManager(parent), d(new QmlProfilerModelManagerPrivate)
+ Timeline::TimelineTraceManager(std::make_unique<QmlProfilerEventTypeStorage>(), parent),
+ d(new QmlProfilerModelManagerPrivate)
{
setNotesModel(new QmlProfilerNotesModel(this));
d->textMarkModel = new Internal::QmlProfilerTextMarkModel(this);
@@ -133,17 +144,9 @@ void QmlProfilerModelManager::addEvents(const QVector<QmlEvent> &events)
addEvent(event);
}
-void QmlProfilerModelManager::addEventTypes(const QVector<QmlEventType> &types)
-{
- for (const QmlEventType &type : types) {
- d->addEventType(type);
- TimelineTraceManager::addEventType(type);
- }
-}
-
const QmlEventType &QmlProfilerModelManager::eventType(int typeId) const
{
- return d->eventTypes.at(typeId);
+ return static_cast<const QmlEventType &>(TimelineTraceManager::eventType(typeId));
}
void QmlProfilerModelManager::replayEvents(TraceEventLoader loader, Initializer initializer,
@@ -175,7 +178,7 @@ void QmlProfilerModelManager::replayQmlEvents(QmlEventLoader loader,
if (future.isCanceled())
return false;
- loader(event, d->eventTypes[event.typeIndex()]);
+ loader(event, eventType(event.typeIndex()));
return true;
});
@@ -238,41 +241,12 @@ void QmlProfilerModelManager::QmlProfilerModelManagerPrivate::writeToStream(cons
file.append(event);
}
-void QmlProfilerModelManager::QmlProfilerModelManagerPrivate::addEventType(const QmlEventType &type)
-{
- const int typeId = eventTypes.count();
- eventTypes.append(type);
- rewriteType(typeId);
- const QmlEventLocation &location = type.location();
- if (location.isValid()) {
- textMarkModel->addTextMarkId(typeId, QmlEventLocation(
- detailsRewriter->getLocalFile(location.filename()),
- location.line(), location.column()));
- }
-}
-
void QmlProfilerModelManager::QmlProfilerModelManagerPrivate::handleError(const QString &message)
{
// What to do here?
qWarning() << message;
}
-void QmlProfilerModelManager::QmlProfilerModelManagerPrivate::rewriteType(int typeIndex)
-{
- QmlEventType &type = eventTypes[typeIndex];
- type.setDisplayName(getDisplayName(type));
- type.setData(getInitialDetails(type));
-
- const QmlEventLocation &location = type.location();
- // There is no point in looking for invalid locations
- if (!location.isValid())
- return;
-
- // Only bindings and signal handlers need rewriting
- if (type.rangeType() == Binding || type.rangeType() == HandlingSignal)
- detailsRewriter->requestDetailsForLocation(typeIndex, location);
-}
-
const char *QmlProfilerModelManager::featureName(ProfileFeature feature)
{
return ProfileFeatureNames[feature];
@@ -302,8 +276,10 @@ QString QmlProfilerModelManager::findLocalFile(const QString &remoteFile)
void QmlProfilerModelManager::detailsChanged(int typeId, const QString &newString)
{
- QTC_ASSERT(typeId < d->eventTypes.count(), return);
- d->eventTypes[typeId].setData(newString);
+ QTC_ASSERT(typeId < numEventTypes(), return);
+ QmlEventType type = eventType(typeId);
+ type.setData(newString);
+ setEventType(typeId, std::move(type));
emit typeDetailsChanged(typeId);
}
@@ -323,11 +299,6 @@ void QmlProfilerModelManager::restrictByFilter(QmlProfilerModelManager::QmlEvent
});
}
-const Timeline::TraceEventType &QmlProfilerModelManager::lookupType(int typeIndex) const
-{
- return eventType(typeIndex);
-}
-
void QmlProfilerModelManager::clearEventStorage()
{
TimelineTraceManager::clearEventStorage();
@@ -336,18 +307,50 @@ void QmlProfilerModelManager::clearEventStorage()
emit error(tr("Failed to reset temporary trace file"));
}
-void QmlProfilerModelManager::clearTypeStorage()
+int QmlProfilerModelManager::appendEventType(QmlEventType &&type)
{
- TimelineTraceManager::clearTypeStorage();
- d->eventTypes.clear();
+ type.setDisplayName(getDisplayName(type));
+ type.setData(getInitialDetails(type));
+
+ const QmlEventLocation &location = type.location();
+ if (location.isValid()) {
+ const RangeType rangeType = type.rangeType();
+ const QmlEventLocation localLocation(d->detailsRewriter->getLocalFile(location.filename()),
+ location.line(), location.column());
+
+ // location and type are invalid after this
+ const int typeIndex = TimelineTraceManager::appendEventType(std::move(type));
+
+ // Only bindings and signal handlers need rewriting
+ if (rangeType == Binding || rangeType == HandlingSignal)
+ d->detailsRewriter->requestDetailsForLocation(typeIndex, location);
+ d->textMarkModel->addTextMarkId(typeIndex, localLocation);
+ return typeIndex;
+ } else {
+ // There is no point in looking for invalid locations; just add the type
+ return TimelineTraceManager::appendEventType(std::move(type));
+ }
}
-void QmlProfilerModelManager::addEventType(const QmlEventType &type)
+void QmlProfilerModelManager::setEventType(int typeIndex, QmlEventType &&type)
{
- d->addEventType(type);
- TimelineTraceManager::addEventType(type);
+ type.setDisplayName(getDisplayName(type));
+ type.setData(getInitialDetails(type));
+
+ const QmlEventLocation &location = type.location();
+ if (location.isValid()) {
+ // Only bindings and signal handlers need rewriting
+ if (type.rangeType() == Binding || type.rangeType() == HandlingSignal)
+ d->detailsRewriter->requestDetailsForLocation(typeIndex, location);
+ d->textMarkModel->addTextMarkId(typeIndex, QmlEventLocation(
+ d->detailsRewriter->getLocalFile(location.filename()),
+ location.line(), location.column()));
+ }
+
+ TimelineTraceManager::setEventType(typeIndex, std::move(type));
}
+
void QmlProfilerModelManager::addEvent(const QmlEvent &event)
{
d->writeToStream(event);
@@ -442,4 +445,39 @@ Timeline::TimelineTraceFile *QmlProfilerModelManager::createTraceFile()
return new Internal::QmlProfilerTraceFile(this);
}
+const Timeline::TraceEventType &QmlProfilerEventTypeStorage::get(int typeId) const
+{
+ Q_ASSERT(typeId >= 0);
+ return m_types.at(static_cast<size_t>(typeId));
+}
+
+void QmlProfilerEventTypeStorage::set(int typeId, Timeline::TraceEventType &&type)
+{
+ Q_ASSERT(typeId >= 0);
+ const size_t index = static_cast<size_t>(typeId);
+ if (m_types.size() <= index)
+ m_types.resize(index + 1);
+ m_types[index] = std::move(static_cast<QmlEventType &&>(type));
+}
+
+int QmlProfilerEventTypeStorage::append(Timeline::TraceEventType &&type)
+{
+ const size_t index = m_types.size();
+ m_types.push_back(std::move(static_cast<QmlEventType &&>(type)));
+ QTC_ASSERT(index <= std::numeric_limits<int>::max(), return std::numeric_limits<int>::max());
+ return static_cast<int>(index);
+}
+
+int QmlProfilerEventTypeStorage::size() const
+{
+ const size_t size = m_types.size();
+ QTC_ASSERT(size <= std::numeric_limits<int>::max(), return std::numeric_limits<int>::max());
+ return static_cast<int>(size);
+}
+
+void QmlProfilerEventTypeStorage::clear()
+{
+ m_types.clear();
+}
+
} // namespace QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h
index b7180b36fab..8b4350f80b4 100644
--- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h
+++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h
@@ -62,7 +62,6 @@ public:
Clearer clearer = nullptr);
void addEvents(const QVector<QmlEvent> &events);
- void addEventTypes(const QVector<QmlEventType> &types);
const QmlEventType &eventType(int typeId) const;
void replayQmlEvents(QmlEventLoader loader, Initializer initializer, Finalizer finalizer,
@@ -75,7 +74,8 @@ public:
static const char *featureName(ProfileFeature feature);
- void addEventType(const QmlEventType &type);
+ int appendEventType(QmlEventType &&type);
+ void setEventType(int typeId, QmlEventType &&type);
void addEvent(const QmlEvent &event);
void restrictToRange(qint64 start, qint64 end);
@@ -92,9 +92,7 @@ private:
void restrictByFilter(QmlEventFilter filter);
void clearEventStorage() override;
- void clearTypeStorage() override;
- const Timeline::TraceEventType &lookupType(int typeId) const override;
Timeline::TimelineTraceFile *createTraceFile() override;
void replayEvents(TraceEventLoader loader, Initializer initializer, Finalizer finalizer,
ErrorHandler errorHandler, QFutureInterface<void> &future) const override;
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
index 47310a41432..7db75acbec1 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
@@ -109,8 +109,9 @@ int QmlProfilerTraceClientPrivate::resolveType(const QmlTypedEvent &event)
if (it != serverTypeIds.constEnd()) {
typeIndex = it.value();
} else {
- typeIndex = modelManager->numEventTypes();
- modelManager->addEventType(event.type);
+ // We can potentially move the type away here, as we don't need to access it anymore,
+ // but that requires some more refactoring.
+ typeIndex = modelManager->appendEventType(QmlEventType(event.type));
serverTypeIds[event.serverTypeId] = typeIndex;
}
} else {
@@ -119,8 +120,7 @@ int QmlProfilerTraceClientPrivate::resolveType(const QmlTypedEvent &event)
if (it != eventTypeIds.constEnd()) {
typeIndex = it.value();
} else {
- typeIndex = modelManager->numEventTypes();
- modelManager->addEventType(event.type);
+ typeIndex = modelManager->appendEventType(QmlEventType(event.type));
eventTypeIds[event.type] = typeIndex;
}
}
diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
index 4a79b36bed9..9844b30c5cc 100644
--- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
@@ -229,25 +229,24 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
QByteArray data;
setDeviceProgress(device);
+ QmlProfilerModelManager *manager = modelManager();
if (!isCanceled()) {
stream >> data;
buffer.setData(qUncompress(data));
buffer.open(QIODevice::ReadOnly);
- QVector<QmlEventType> eventTypes;
quint32 numEventTypes;
bufferStream >> numEventTypes;
if (numEventTypes > quint32(std::numeric_limits<int>::max())) {
emit error(tr("Excessive number of event types: %1").arg(numEventTypes));
return;
}
- eventTypes.reserve(static_cast<int>(numEventTypes));
- QmlEventType type;
+
for (int typeId = 0; typeId < static_cast<int>(numEventTypes); ++typeId) {
+ QmlEventType type;
bufferStream >> type;
- eventTypes.append(type);
+ manager->setEventType(typeId, std::move(type));
}
buffer.close();
- modelManager()->addEventTypes(eventTypes);
setDeviceProgress(device);
}
@@ -275,7 +274,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
emit error(tr("Invalid type index %1").arg(event.typeIndex()));
return;
}
- addFeature(modelManager()->eventType(event.typeIndex()).feature());
+ addFeature(manager->eventType(event.typeIndex()).feature());
if (event.timestamp() < 0)
event.setTimestamp(0);
} else if (bufferStream.status() == QDataStream::ReadPastEnd) {
@@ -288,7 +287,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
}
eventBuffer.append(event);
}
- modelManager()->addEvents(eventBuffer);
+ manager->addEvents(eventBuffer);
eventBuffer.clear();
buffer.close();
setDeviceProgress(device);
@@ -297,7 +296,7 @@ void QmlProfilerTraceFile::loadQzt(QIODevice *device)
if (isCanceled()) {
emit canceled();
} else {
- modelManager()->addEvents(eventBuffer);
+ manager->addEvents(eventBuffer);
emit success();
}
}
@@ -316,7 +315,6 @@ void QmlProfilerTraceFile::addStageProgress(QmlProfilerTraceFile::ProgressValues
void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream)
{
QTC_ASSERT(stream.name() == _("eventData"), return);
- QVector<QmlEventType> eventTypes;
int typeIndex = -1;
@@ -421,12 +419,11 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream)
case QXmlStreamReader::EndElement: {
if (elementName == _("event")) {
if (typeIndex >= 0) {
- if (typeIndex >= eventTypes.length())
- eventTypes.resize(typeIndex + 1);
- QmlEventType type(messageAndRange.first, messageAndRange.second, detailType,
- QmlEventLocation(filename, line, column), data, displayName);
- eventTypes[typeIndex] = type;
+ QmlEventType type(messageAndRange.first, messageAndRange.second,
+ detailType, QmlEventLocation(filename, line, column),
+ data, displayName);
const quint8 feature = type.feature();
+ modelManager()->setEventType(typeIndex, std::move(type));
if (feature != MaximumProfileFeature)
addFeature(feature);
}
@@ -435,7 +432,6 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream)
if (elementName == _("eventData")) {
// done reading eventData
- modelManager()->addEventTypes(eventTypes);
return;
}
break;
diff --git a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp
index ddd9c80c3c4..3d71534a99e 100644
--- a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp
@@ -49,7 +49,7 @@ void DebugMessagesModelTest::initTestCase()
QmlEventType type(DebugMessage, MaximumRangeType, i % (QtMsgType::QtInfoMsg + 1),
QmlEventLocation("somefile.js", i, 10 - i));
event.setTypeIndex(manager.numEventTypes());
- manager.addEventType(type);
+ manager.appendEventType(std::move(type));
manager.addEvent(event);
}
manager.finalize();
diff --git a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
index 4f5139ceece..152fdef75c3 100644
--- a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp
@@ -55,11 +55,11 @@ int FlameGraphModelTest::generateData(QmlProfilerModelManager *manager,
while (i < 10) {
int typeIndex = -1;
if (i < 5) {
- QmlEventType type(MaximumMessage,
- static_cast<RangeType>(static_cast<int>(Javascript) - i),
- -1, QmlEventLocation("somefile.js", i, 20 - i), QString("funcfunc"));
- typeIndex = manager->numEventTypes();
- manager->addEventType(type);
+ typeIndex = manager->appendEventType(
+ QmlEventType(MaximumMessage,
+ static_cast<RangeType>(static_cast<int>(Javascript) - i), -1,
+ QmlEventLocation("somefile.js", i, 20 - i),
+ QString("funcfunc")));
} else {
typeIndex = typeIndices[i - 5];
}
diff --git a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp
index 5979e1e9669..1749eaa0324 100644
--- a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp
@@ -41,10 +41,8 @@ static InputEventType inputType(int i)
InputEventsModelTest::InputEventsModelTest(QObject *parent) :
QObject(parent), model(&manager, &aggregator)
{
- keyTypeId = manager.numEventTypes();
- manager.addEventType(QmlEventType(Event, MaximumRangeType, Key));
- mouseTypeId = manager.numEventTypes();
- manager.addEventType(QmlEventType(Event, MaximumRangeType, Mouse));
+ keyTypeId = manager.appendEventType(QmlEventType(Event, MaximumRangeType, Key));
+ mouseTypeId = manager.appendEventType(QmlEventType(Event, MaximumRangeType, Mouse));
}
void InputEventsModelTest::initTestCase()
diff --git a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp
index 49c23cfb08b..e7d2d2e8cc2 100644
--- a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp
@@ -41,11 +41,11 @@ void MemoryUsageModelTest::initTestCase()
heapPageTypeId = manager.numEventTypes();
- manager.addEventType(QmlEventType(MemoryAllocation, MaximumRangeType, HeapPage));
+ manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, HeapPage));
smallItemTypeId = manager.numEventTypes();
- manager.addEventType(QmlEventType(MemoryAllocation, MaximumRangeType, SmallItem));
+ manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, SmallItem));
largeItemTypeId = manager.numEventTypes();
- manager.addEventType(QmlEventType(MemoryAllocation, MaximumRangeType, LargeItem));
+ manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, LargeItem));
auto addMemoryEvents = [&]() {
QmlEvent event;
@@ -74,9 +74,9 @@ void MemoryUsageModelTest::initTestCase()
addMemoryEvents();
rangeTypeId = manager.numEventTypes();
- manager.addEventType(QmlEventType(MaximumMessage, Javascript, -1,
- QmlEventLocation(QString("somefile.js"), 10, 20),
- QString("funcfunc")));
+ manager.appendEventType(QmlEventType(MaximumMessage, Javascript, -1,
+ QmlEventLocation(QString("somefile.js"), 10, 20),
+ QString("funcfunc")));
QmlEvent event;
event.setRangeStage(RangeStart);
diff --git a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp
index 5174e0833c0..d8cfd4ec5b1 100644
--- a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp
@@ -43,8 +43,8 @@ void PixmapCacheModelTest::initTestCase()
for (int i = 0; i < MaximumPixmapEventType; ++i) {
eventTypeIndices[i] = manager.numEventTypes();
- manager.addEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i,
- QmlEventLocation("dings.png", 0, 0)));
+ manager.appendEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i,
+ QmlEventLocation("dings.png", 0, 0)));
}
// random data, should still result in consistent model.
@@ -58,8 +58,8 @@ void PixmapCacheModelTest::initTestCase()
for (int i = 0; i < MaximumPixmapEventType; ++i) {
eventTypeIndices[i + MaximumPixmapEventType] = manager.numEventTypes();
- manager.addEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i,
- QmlEventLocation("blah.png", 0, 0)));
+ manager.appendEventType(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 4e67785273b..03fd9e7e9c5 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp
@@ -44,10 +44,9 @@ void QmlProfilerAnimationsModelTest::initTestCase()
{
manager.initialize();
- QmlEventType type(Event, MaximumRangeType, AnimationFrame);
QmlEvent event;
- event.setTypeIndex(manager.numEventTypes());
- manager.addEventType(type);
+ event.setTypeIndex(manager.appendEventType(
+ QmlEventType(Event, MaximumRangeType, AnimationFrame)));
for (int i = 0; i < 10; ++i) {
event.setTimestamp(i);
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp
index 268be44562c..1047eff430e 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp
@@ -50,16 +50,17 @@ DummyModel::DummyModel(QmlProfilerModelManager *manager,
void DummyModel::loadData()
{
QmlEventType type(MaximumMessage, Binding);
- modelManager()->addEventType(type);
+ const int typeIndex = modelManager()->appendEventType(QmlEventType(type));
+ QCOMPARE(typeIndex, 0);
for (int i = 0; i < 10; ++i) {
- QmlEvent event(i, 0, {});
+ QmlEvent event(i, typeIndex, {});
event.setRangeStage(RangeStart);
loadEvent(event, type);
}
for (int i = 10; i < 20; ++i) {
- QmlEvent event(i, 0, {});
+ QmlEvent event(i, typeIndex, {});
event.setRangeStage(RangeEnd);
loadEvent(event, type);
}
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp
index dea61ac4455..a010c55c4a5 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp
@@ -100,8 +100,9 @@ void QmlProfilerToolTest::testClearEvents()
stateManager->setServerRecording(true);
QCOMPARE(modelManager->numEventTypes(), 0);
QCOMPARE(modelManager->numEvents(), 0);
- modelManager->addEventType(QmlEventType());
- modelManager->addEvent(QmlEvent(0, 0, ""));
+ const int typeIndex = modelManager->appendEventType(QmlEventType());
+ QCOMPARE(typeIndex, 0);
+ modelManager->addEvent(QmlEvent(0, typeIndex, ""));
QCOMPARE(modelManager->numEventTypes(), 1);
QCOMPARE(modelManager->numEvents(), 1);
stateManager->setServerRecording(false);
@@ -110,7 +111,7 @@ void QmlProfilerToolTest::testClearEvents()
stateManager->setServerRecording(true); // clears previous events, but not types
QCOMPARE(modelManager->numEventTypes(), 1);
QCOMPARE(modelManager->numEvents(), 0);
- modelManager->addEvent(QmlEvent(0, 0, ""));
+ modelManager->addEvent(QmlEvent(0, typeIndex, ""));
QCOMPARE(modelManager->numEventTypes(), 1);
QCOMPARE(modelManager->numEvents(), 1);
}