diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-05-09 09:27:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-05-11 15:41:55 +0000 |
commit | 86b368f91270fc74ff7152bf51d71961c21bbef4 (patch) | |
tree | 07d5c508c1aac4096360ce1401da7807ce382b6c /src/plugins/qmlprofiler | |
parent | 9685711cb399682523d4ef28bcfdc067aebd9fde (diff) | |
download | qt-creator-86b368f91270fc74ff7152bf51d71961c21bbef4.tar.gz |
QmlProfiler: Rename all the timeline model data structs to Item
This allows us to define a template for filling a
QmlProfilerTimelineModel without spelling out all the type names.
Change-Id: I97870287a795d95f58a949729afa715f145817bb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/debugmessagesmodel.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/debugmessagesmodel.h | 16 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/inputeventsmodel.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/inputeventsmodel.h | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/memoryusagemodel.cpp | 10 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/memoryusagemodel.h | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/pixmapcachemodel.cpp | 16 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/pixmapcachemodel.h | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofileranimationsmodel.h | 4 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerrangemodel.h | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/scenegraphtimelinemodel.h | 6 |
14 files changed, 47 insertions, 47 deletions
diff --git a/src/plugins/qmlprofiler/debugmessagesmodel.cpp b/src/plugins/qmlprofiler/debugmessagesmodel.cpp index b5268691a8..1ec11ac8f7 100644 --- a/src/plugins/qmlprofiler/debugmessagesmodel.cpp +++ b/src/plugins/qmlprofiler/debugmessagesmodel.cpp @@ -102,7 +102,7 @@ int DebugMessagesModel::collapsedRow(int index) const void DebugMessagesModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { m_data.insert(insert(event.timestamp(), 0, type.detailType()), - MessageData(event.string(), event.typeIndex())); + Item(event.string(), event.typeIndex())); if (type.detailType() > m_maximumMsgType) m_maximumMsgType = type.detailType(); } diff --git a/src/plugins/qmlprofiler/debugmessagesmodel.h b/src/plugins/qmlprofiler/debugmessagesmodel.h index 6af88796fb..121c6607e4 100644 --- a/src/plugins/qmlprofiler/debugmessagesmodel.h +++ b/src/plugins/qmlprofiler/debugmessagesmodel.h @@ -35,6 +35,13 @@ class DebugMessagesModel : public QmlProfilerTimelineModel Q_OBJECT public: + struct Item { + Item(const QString &text = QString(), int typeId = -1) : + text(text), typeId(typeId) {} + QString text; + int typeId; + }; + DebugMessagesModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent); int typeId(int index) const override; @@ -51,15 +58,8 @@ public: private: static QString messageType(uint i); - struct MessageData { - MessageData(const QString &text = QString(), int typeId = -1) : - text(text), typeId(typeId) {} - QString text; - int typeId; - }; - int m_maximumMsgType; - QVector<MessageData> m_data; + QVector<Item> m_data; }; } // namespace Internal diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp index c3cdc2fa52..386b57806a 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp @@ -81,7 +81,7 @@ QVariantMap InputEventsModel::details(int index) const result.insert(tr("Timestamp"), Timeline::formatTime(startTime(index), modelManager()->traceDuration())); QString type; - const InputEvent &event = m_data[index]; + const Item &event = m_data[index]; switch (event.type) { case InputKeyPress: type = tr("Key Press"); @@ -150,7 +150,7 @@ int InputEventsModel::collapsedRow(int index) const void InputEventsModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { m_data.insert(insert(event.timestamp(), 0, type.detailType()), - InputEvent(static_cast<InputEventType>(event.number<qint32>(0)), + Item(static_cast<InputEventType>(event.number<qint32>(0)), event.number<qint32>(1), event.number<qint32>(2))); if (type.detailType() == Mouse) { @@ -175,7 +175,7 @@ void InputEventsModel::clear() QmlProfilerTimelineModel::clear(); } -InputEventsModel::InputEvent::InputEvent(InputEventType type, int a, int b) : +InputEventsModel::Item::Item(InputEventType type, int a, int b) : type(type), a(a), b(b) { } diff --git a/src/plugins/qmlprofiler/inputeventsmodel.h b/src/plugins/qmlprofiler/inputeventsmodel.h index 17cd114336..dbd1515894 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.h +++ b/src/plugins/qmlprofiler/inputeventsmodel.h @@ -35,8 +35,8 @@ class InputEventsModel : public QmlProfilerTimelineModel Q_OBJECT public: - struct InputEvent { - InputEvent(InputEventType type = MaximumInputEventType, int a = 0, int b = 0); + struct Item { + Item(InputEventType type = MaximumInputEventType, int a = 0, int b = 0); InputEventType type; int a; int b; @@ -60,7 +60,7 @@ private: int m_keyTypeId; int m_mouseTypeId; - QVector<InputEvent> m_data; + QVector<Item> m_data; }; } // namespace Internal diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp index a9a09185f5..fa7c258b00 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.cpp +++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp @@ -109,7 +109,7 @@ static int toSameSignedInt(qint64 number) QVariantMap MemoryUsageModel::details(int index) const { QVariantMap result; - const MemoryAllocationItem *ev = &m_data[index]; + const Item *ev = &m_data[index]; if (ev->allocated >= -ev->deallocated) result.insert(QLatin1String("displayName"), tr("Memory Allocated")); @@ -181,7 +181,7 @@ void MemoryUsageModel::loadEvent(const QmlEvent &event, const QmlEventType &type m_data[m_currentUsageIndex].update(event.number<qint64>(0)); m_currentUsage = m_data[m_currentUsageIndex].size; } else { - MemoryAllocationItem allocation( + Item allocation( m_rangeStack.empty() ? event.typeIndex() : m_rangeStack.top().originTypeIndex, m_currentUsage); @@ -212,7 +212,7 @@ void MemoryUsageModel::loadEvent(const QmlEvent &event, const QmlEventType &type m_data[m_currentJSHeapIndex].update(event.number<qint64>(0)); m_currentSize = m_data[m_currentJSHeapIndex].size; } else { - MemoryAllocationItem allocation( + Item allocation( m_rangeStack.empty() ? event.typeIndex() : m_rangeStack.top().originTypeIndex, m_currentSize); @@ -279,13 +279,13 @@ bool MemoryUsageModel::handlesTypeId(int typeId) const return false; } -MemoryUsageModel::MemoryAllocationItem::MemoryAllocationItem(int typeId, qint64 baseAmount) : +MemoryUsageModel::Item::Item(int typeId, qint64 baseAmount) : size(baseAmount), allocated(0), deallocated(0), allocations(0), deallocations(0), typeId(typeId) { } -void MemoryUsageModel::MemoryAllocationItem::update(qint64 amount) +void MemoryUsageModel::Item::update(qint64 amount) { size += amount; if (amount < 0) { diff --git a/src/plugins/qmlprofiler/memoryusagemodel.h b/src/plugins/qmlprofiler/memoryusagemodel.h index d57d0855cb..f3abd35187 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.h +++ b/src/plugins/qmlprofiler/memoryusagemodel.h @@ -39,7 +39,7 @@ class MemoryUsageModel : public QmlProfilerTimelineModel Q_OBJECT public: - struct MemoryAllocationItem { + struct Item { qint64 size; qint64 allocated; qint64 deallocated; @@ -47,7 +47,7 @@ public: int deallocations; int typeId; - MemoryAllocationItem(int typeId = -1, qint64 baseAmount = 0); + Item(int typeId = -1, qint64 baseAmount = 0); void update(qint64 amount); }; @@ -86,7 +86,7 @@ private: ContinueUsage = 0x2 }; - QVector<MemoryAllocationItem> m_data; + QVector<Item> m_data; QStack<RangeStackFrame> m_rangeStack; qint64 m_maxSize = 1; qint64 m_currentSize = 0; diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.cpp b/src/plugins/qmlprofiler/pixmapcachemodel.cpp index 9fd77d7d6d..81109a6153 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.cpp +++ b/src/plugins/qmlprofiler/pixmapcachemodel.cpp @@ -114,7 +114,7 @@ QVariantList PixmapCacheModel::labels() const QVariantMap PixmapCacheModel::details(int index) const { QVariantMap result; - const PixmapCacheItem *ev = &m_data[index]; + const Item *ev = &m_data[index]; if (ev->pixmapEventType == PixmapCacheCountChanged) { result.insert(QLatin1String("displayName"), tr("Image Cached")); @@ -165,7 +165,7 @@ QVariantMap PixmapCacheModel::details(int index) const */ void PixmapCacheModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { - PixmapCacheItem newEvent; + Item newEvent; const PixmapEventType pixmapType = static_cast<PixmapEventType>(type.detailType()); newEvent.pixmapEventType = pixmapType; qint64 pixmapStartTime = event.timestamp(); @@ -407,7 +407,7 @@ void PixmapCacheModel::clear() #ifdef WITH_TESTS PixmapCacheModel::LoadState PixmapCacheModel::loadState(int index) const { - const PixmapCacheItem &item = m_data[index]; + const Item &item = m_data[index]; if (item.urlIndex == -1 || item.sizeIndex == -1) return MaximumLoadState; @@ -416,7 +416,7 @@ PixmapCacheModel::LoadState PixmapCacheModel::loadState(int index) const PixmapCacheModel::CacheState PixmapCacheModel::cacheState(int index) const { - const PixmapCacheItem &item = m_data[index]; + const Item &item = m_data[index]; if (item.urlIndex == -1 || item.sizeIndex == -1) return MaximumCacheState; @@ -425,14 +425,14 @@ PixmapCacheModel::CacheState PixmapCacheModel::cacheState(int index) const QString PixmapCacheModel::fileName(int index) const { - const PixmapCacheItem &item = m_data[index]; + const Item &item = m_data[index]; return (item.urlIndex == -1) ? QString() : m_pixmaps[item.urlIndex].url; } #endif // WITH_TESTS void PixmapCacheModel::computeMaxCacheSize() { - foreach (const PixmapCacheModel::PixmapCacheItem &event, m_data) { + foreach (const PixmapCacheModel::Item &event, m_data) { if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) { if (event.cacheSize > m_maxCacheSize) m_maxCacheSize = event.cacheSize; @@ -462,7 +462,7 @@ void PixmapCacheModel::flattenLoads() // computes "compressed row" QVector <qint64> eventEndTimes; for (int i = 0; i < count(); i++) { - PixmapCacheModel::PixmapCacheItem &event = m_data[i]; + PixmapCacheModel::Item &event = m_data[i]; if (event.pixmapEventType == PixmapCacheModel::PixmapLoadingStarted) { event.rowNumberCollapsed = 0; while (eventEndTimes.count() > event.rowNumberCollapsed && @@ -486,7 +486,7 @@ void PixmapCacheModel::flattenLoads() } int PixmapCacheModel::updateCacheCount(int lastCacheSizeEvent, - qint64 pixmapStartTime, qint64 pixSize, PixmapCacheItem &newEvent, int typeId) + qint64 pixmapStartTime, qint64 pixSize, Item &newEvent, int typeId) { newEvent.pixmapEventType = PixmapCacheCountChanged; newEvent.rowNumberCollapsed = 1; diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.h b/src/plugins/qmlprofiler/pixmapcachemodel.h index ebd08e131f..ed6cd577e8 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.h +++ b/src/plugins/qmlprofiler/pixmapcachemodel.h @@ -85,7 +85,7 @@ public: MaximumPixmapEventType }; - struct PixmapCacheItem { + struct Item { int typeId = -1; PixmapEventType pixmapEventType = MaximumPixmapEventType; int urlIndex = -1; @@ -123,9 +123,9 @@ private: void resizeUnfinishedLoads(); void flattenLoads(); int updateCacheCount(int m_lastCacheSizeEvent, qint64 startTime, qint64 pixSize, - PixmapCacheItem &newEvent, int typeId); + Item &newEvent, int typeId); - QVector<PixmapCacheItem> m_data; + QVector<Item> m_data; QVector<Pixmap> m_pixmaps; qint64 m_maxCacheSize = 1; diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp index d59cbf526d..8fef692ed3 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp @@ -76,7 +76,7 @@ void QmlProfilerAnimationsModel::loadEvent(const QmlEvent &event, const QmlEvent // Don't "fix" the framerate even if we've fixed the duration. // The server should know better after all and if it doesn't we want to see that. - QmlPaintEventData lastEvent; + Item lastEvent; lastEvent.typeId = event.typeIndex(); lastEvent.framerate = event.number<qint32>(0); lastEvent.animationcount = event.number<qint32>(1); diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h index 44e6acf964..c50722e8b4 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h @@ -43,7 +43,7 @@ class QmlProfilerAnimationsModel : public QmlProfilerTimelineModel Q_OBJECT public: - struct QmlPaintEventData { + struct Item { int framerate; int animationcount; int typeId; @@ -69,7 +69,7 @@ public: void clear() override; private: - QVector<QmlProfilerAnimationsModel::QmlPaintEventData> m_data; + QVector<Item> m_data; int m_maxGuiThreadAnimations = 0; int m_maxRenderThreadAnimations = 0; qint64 m_minNextStartTimes[2]; diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index 498b8dd4d6..01cc409134 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -70,7 +70,7 @@ void QmlProfilerRangeModel::loadEvent(const QmlEvent &event, const QmlEventType if (event.rangeStage() == RangeStart) { int index = insertStart(event.timestamp(), event.typeIndex()); m_stack.append(index); - m_data.insert(index, QmlRangeEventStartInstance()); + m_data.insert(index, Item()); } else if (event.rangeStage() == RangeEnd) { if (!m_stack.isEmpty()) { int index = m_stack.pop(); diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.h b/src/plugins/qmlprofiler/qmlprofilerrangemodel.h index 9952a8772c..161c439fe4 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.h +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.h @@ -44,8 +44,8 @@ class QmlProfilerRangeModel : public QmlProfilerTimelineModel Q_OBJECT public: - struct QmlRangeEventStartInstance { - QmlRangeEventStartInstance() : + struct Item { + Item() : displayRowExpanded(1), displayRowCollapsed(Constants::QML_MIN_LEVEL), bindingLoopHead(-1) {} @@ -84,7 +84,7 @@ private: void computeExpandedLevels(); void findBindingLoops(); - QVector<QmlRangeEventStartInstance> m_data; + QVector<Item> m_data; QStack<int> m_stack; QVector<int> m_expandedRowTypes; }; diff --git a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp index e0a289c82b..951cd3eb43 100644 --- a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp +++ b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp @@ -230,7 +230,7 @@ void SceneGraphTimelineModel::flattenLoads() QVector <qint64> eventEndTimes; for (int i = 0; i < count(); i++) { - SceneGraphEvent &event = m_data[i]; + Item &event = m_data[i]; int stage = selectionId(i); // Don't try to put render thread events in GUI row and vice versa. // Rows below those are free for all. @@ -272,7 +272,7 @@ qint64 SceneGraphTimelineModel::insert(qint64 start, qint64 duration, int typeIn return 0; m_data.insert(QmlProfilerTimelineModel::insert(start, duration, stage), - SceneGraphEvent(typeIndex, glyphCount)); + Item(typeIndex, glyphCount)); return duration; } @@ -293,7 +293,7 @@ void SceneGraphTimelineModel::clear() QmlProfilerTimelineModel::clear(); } -SceneGraphTimelineModel::SceneGraphEvent::SceneGraphEvent(int typeId, int glyphCount) : +SceneGraphTimelineModel::Item::Item(int typeId, int glyphCount) : typeId(typeId), rowNumberCollapsed(-1), glyphCount(glyphCount) { } diff --git a/src/plugins/qmlprofiler/scenegraphtimelinemodel.h b/src/plugins/qmlprofiler/scenegraphtimelinemodel.h index a4338738aa..93ef44f963 100644 --- a/src/plugins/qmlprofiler/scenegraphtimelinemodel.h +++ b/src/plugins/qmlprofiler/scenegraphtimelinemodel.h @@ -75,8 +75,8 @@ public: MaximumSceneGraphStage = MaximumTextureStage }; - struct SceneGraphEvent { - SceneGraphEvent(int typeId = -1, int glyphCount = -1); + struct Item { + Item(int typeId = -1, int glyphCount = -1); int typeId; int rowNumberCollapsed; int glyphCount; // only used for one event type @@ -105,7 +105,7 @@ private: int glyphCount = -1); static const char *threadLabel(SceneGraphStage stage); - QVector<SceneGraphEvent> m_data; + QVector<Item> m_data; }; } // namespace Internal |