diff --git a/src/libs/qmldebug/qmldebug-lib.pri b/src/libs/qmldebug/qmldebug-lib.pri index b5693ea7f2e..e9630852ba1 100644 --- a/src/libs/qmldebug/qmldebug-lib.pri +++ b/src/libs/qmldebug/qmldebug-lib.pri @@ -5,15 +5,12 @@ contains(CONFIG, dll) { } HEADERS += \ - $$PWD/qmlprofilereventlocation.h \ $$PWD/qmldebugclient.h \ $$PWD/baseenginedebugclient.h \ $$PWD/declarativeenginedebugclient.h \ $$PWD/declarativeenginedebugclientv2.h \ $$PWD/qmloutputparser.h \ $$PWD/qmldebug_global.h \ - $$PWD/qmlprofilereventtypes.h \ - $$PWD/qmlprofilertraceclient.h \ $$PWD/qpacketprotocol.h \ $$PWD/qmldebugconstants.h \ $$PWD/qdebugmessageclient.h \ @@ -28,7 +25,6 @@ SOURCES += \ $$PWD/qmldebugclient.cpp \ $$PWD/baseenginedebugclient.cpp \ $$PWD/qmloutputparser.cpp \ - $$PWD/qmlprofilertraceclient.cpp \ $$PWD/qpacketprotocol.cpp \ $$PWD/qdebugmessageclient.cpp \ $$PWD/basetoolsclient.cpp \ diff --git a/src/libs/qmldebug/qmldebug.qbs b/src/libs/qmldebug/qmldebug.qbs index c5568d56c05..457a97a09bb 100644 --- a/src/libs/qmldebug/qmldebug.qbs +++ b/src/libs/qmldebug/qmldebug.qbs @@ -30,10 +30,6 @@ QtcLibrary { "qmlenginedebugclient.h", "qmloutputparser.cpp", "qmloutputparser.h", - "qmlprofilereventlocation.h", - "qmlprofilereventtypes.h", - "qmlprofilertraceclient.cpp", - "qmlprofilertraceclient.h", "qmltoolsclient.cpp", "qmltoolsclient.h", "qpacketprotocol.cpp", diff --git a/src/plugins/qmlprofiler/debugmessagesmodel.cpp b/src/plugins/qmlprofiler/debugmessagesmodel.cpp index 9bdf39c1b51..d53f4fb5fb7 100644 --- a/src/plugins/qmlprofiler/debugmessagesmodel.cpp +++ b/src/plugins/qmlprofiler/debugmessagesmodel.cpp @@ -30,12 +30,12 @@ namespace Internal { bool DebugMessagesModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const { - return event.message == QmlDebug::DebugMessage; + return event.message == DebugMessage; } DebugMessagesModel::DebugMessagesModel(QmlProfilerModelManager *manager, QObject *parent) : - QmlProfilerTimelineModel(manager, QmlDebug::DebugMessage, QmlDebug::MaximumRangeType, - QmlDebug::ProfileDebugMessages, parent), m_maximumMsgType(-1) + QmlProfilerTimelineModel(manager, DebugMessage, MaximumRangeType, ProfileDebugMessages, parent), + m_maximumMsgType(-1) { } diff --git a/src/plugins/qmlprofiler/flamegraphmodel.cpp b/src/plugins/qmlprofiler/flamegraphmodel.cpp index 34a21562cef..45f26843fb8 100644 --- a/src/plugins/qmlprofiler/flamegraphmodel.cpp +++ b/src/plugins/qmlprofiler/flamegraphmodel.cpp @@ -53,9 +53,8 @@ FlameGraphModel::FlameGraphModel(QmlProfilerModelManager *modelManager, // We're iterating twice in loadData. modelManager->setProxyCountWeight(m_modelId, 2); - m_acceptedTypes << QmlDebug::Compiling << QmlDebug::Creating << QmlDebug::Binding - << QmlDebug::HandlingSignal << QmlDebug::Javascript; - modelManager->announceFeatures(m_modelId, QmlDebug::Constants::QML_JS_RANGE_FEATURES); + m_acceptedTypes << Compiling << Creating << Binding << HandlingSignal << Javascript; + modelManager->announceFeatures(m_modelId, Constants::QML_JS_RANGE_FEATURES); } void FlameGraphModel::clear() @@ -84,7 +83,7 @@ void FlameGraphModel::loadNotes(int typeIndex, bool emitSignal) } if (emitSignal) - emit dataChanged(QModelIndex(), QModelIndex(), QVector() << Note); + emit dataChanged(QModelIndex(), QModelIndex(), QVector() << NoteRole); } void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd) @@ -150,15 +149,15 @@ void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd) endResetModel(); } -static QString nameForType(QmlDebug::RangeType typeNumber) +static QString nameForType(RangeType typeNumber) { switch (typeNumber) { - case QmlDebug::Painting: return FlameGraphModel::tr("Paint"); - case QmlDebug::Compiling: return FlameGraphModel::tr("Compile"); - case QmlDebug::Creating: return FlameGraphModel::tr("Create"); - case QmlDebug::Binding: return FlameGraphModel::tr("Binding"); - case QmlDebug::HandlingSignal: return FlameGraphModel::tr("Signal"); - case QmlDebug::Javascript: return FlameGraphModel::tr("JavaScript"); + case Painting: return FlameGraphModel::tr("Paint"); + case Compiling: return FlameGraphModel::tr("Compile"); + case Creating: return FlameGraphModel::tr("Create"); + case Binding: return FlameGraphModel::tr("Binding"); + case HandlingSignal: return FlameGraphModel::tr("Signal"); + case Javascript: return FlameGraphModel::tr("JavaScript"); default: return QString(); } } @@ -166,8 +165,8 @@ static QString nameForType(QmlDebug::RangeType typeNumber) QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const { switch (role) { - case TypeId: return stats.typeIndex; - case Note: { + case TypeIdRole: return stats.typeIndex; + case NoteRole: { QString ret; if (!m_typeIdsWithNotes.contains(stats.typeIndex)) return ret; @@ -180,10 +179,10 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const } return ret; } - case Duration: return stats.duration; - case CallCount: return stats.calls; - case TimePerCall: return stats.duration / stats.calls; - case TimeInPercent: return stats.duration * 100 / m_stackBottom.duration; + case DurationRole: return stats.duration; + case CallCountRole: return stats.calls; + case TimePerCallRole: return stats.duration / stats.calls; + case TimeInPercentRole: return stats.duration * 100 / m_stackBottom.duration; default: break; } @@ -193,14 +192,14 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const const QmlProfilerDataModel::QmlEventTypeData &type = typeList[stats.typeIndex]; switch (role) { - case Filename: return type.location.filename; - case Line: return type.location.line; - case Column: return type.location.column; - case Type: return nameForType(type.rangeType); - case RangeType: return type.rangeType; - case Details: return type.data.isEmpty() ? + case FilenameRole: return type.location.filename; + case LineRole: return type.location.line; + case ColumnRole: return type.location.column; + case TypeRole: return nameForType(type.rangeType); + case RangeTypeRole: return type.rangeType; + case DetailsRole: return type.data.isEmpty() ? FlameGraphModel::tr("Source code not available") : type.data; - case Location: return type.displayName; + case LocationRole: return type.displayName; default: return QVariant(); } } else { @@ -277,18 +276,18 @@ QVariant FlameGraphModel::data(const QModelIndex &index, int role) const QHash FlameGraphModel::roleNames() const { QHash names = QAbstractItemModel::roleNames(); - names[TypeId] = "typeId"; - names[Type] = "type"; - names[Duration] = "duration"; - names[CallCount] = "callCount"; - names[Details] = "details"; - names[Filename] = "filename"; - names[Line] = "line"; - names[Column] = "column"; - names[Note] = "note"; - names[TimePerCall] = "timePerCall"; - names[TimeInPercent] = "timeInPercent"; - names[RangeType] = "rangeType"; + names[TypeIdRole] = "typeId"; + names[TypeRole] = "type"; + names[DurationRole] = "duration"; + names[CallCountRole] = "callCount"; + names[DetailsRole] = "details"; + names[FilenameRole] = "filename"; + names[LineRole] = "line"; + names[ColumnRole] = "column"; + names[NoteRole] = "note"; + names[TimePerCallRole] = "timePerCall"; + names[TimeInPercentRole] = "timeInPercent"; + names[RangeTypeRole] = "rangeType"; return names; } diff --git a/src/plugins/qmlprofiler/flamegraphmodel.h b/src/plugins/qmlprofiler/flamegraphmodel.h index 9619d7a5e84..d5815321d46 100644 --- a/src/plugins/qmlprofiler/flamegraphmodel.h +++ b/src/plugins/qmlprofiler/flamegraphmodel.h @@ -25,10 +25,10 @@ #pragma once -#include -#include -#include -#include +#include "qmlprofilerdatamodel.h" +#include "qmlprofilernotesmodel.h" +#include "qmlprofilereventtypes.h" +#include "qmlprofilereventlocation.h" #include #include @@ -55,19 +55,19 @@ class FlameGraphModel : public QAbstractItemModel Q_ENUMS(Role) public: enum Role { - TypeId = Qt::UserRole + 1, // Sort by data, not by displayed string - Type, - Duration, - CallCount, - Details, - Filename, - Line, - Column, - Note, - TimePerCall, - TimeInPercent, - RangeType, - Location, + TypeIdRole = Qt::UserRole + 1, // Sort by data, not by displayed string + TypeRole, + DurationRole, + CallCountRole, + DetailsRole, + FilenameRole, + LineRole, + ColumnRole, + NoteRole, + TimePerCallRole, + TimeInPercentRole, + RangeTypeRole, + LocationRole, MaxRole }; @@ -100,7 +100,7 @@ private: int m_modelId; QmlProfilerModelManager *m_modelManager; - QList m_acceptedTypes; + QList m_acceptedTypes; QSet m_typeIdsWithNotes; }; diff --git a/src/plugins/qmlprofiler/flamegraphview.cpp b/src/plugins/qmlprofiler/flamegraphview.cpp index 9a0c887080f..e8c02d64551 100644 --- a/src/plugins/qmlprofiler/flamegraphview.cpp +++ b/src/plugins/qmlprofiler/flamegraphview.cpp @@ -91,8 +91,8 @@ void FlameGraphView::selectByTypeId(int typeIndex) void FlameGraphView::onVisibleFeaturesChanged(quint64 features) { int rangeTypeMask = 0; - for (int rangeType = 0; rangeType < QmlDebug::MaximumRangeType; ++rangeType) { - if (features & (1ULL << QmlDebug::featureFromRangeType(QmlDebug::RangeType(rangeType)))) + for (int rangeType = 0; rangeType < MaximumRangeType; ++rangeType) { + if (features & (1ULL << featureFromRangeType(RangeType(rangeType)))) rangeTypeMask |= (1 << rangeType); } m_content->rootObject()->setProperty("visibleRangeTypes", rangeTypeMask); diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp index bba96576c81..010d5d21bbe 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp @@ -25,7 +25,7 @@ #include "inputeventsmodel.h" #include "qmlprofilermodelmanager.h" -#include "qmldebug/qmlprofilereventtypes.h" +#include "qmlprofilereventtypes.h" #include #include @@ -35,15 +35,14 @@ namespace QmlProfiler { namespace Internal { InputEventsModel::InputEventsModel(QmlProfilerModelManager *manager, QObject *parent) : - QmlProfilerTimelineModel(manager, QmlDebug::Event, QmlDebug::MaximumRangeType, - QmlDebug::ProfileInputEvents, parent), + QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileInputEvents, parent), m_keyTypeId(-1), m_mouseTypeId(-1) { } int InputEventsModel::typeId(int index) const { - return selectionId(index) == QmlDebug::Mouse ? m_mouseTypeId : m_keyTypeId; + return selectionId(index) == Mouse ? m_mouseTypeId : m_keyTypeId; } QColor InputEventsModel::color(int index) const @@ -57,12 +56,12 @@ QVariantList InputEventsModel::labels() const QVariantMap element; element.insert(QLatin1String("description"), QVariant(tr("Mouse Events"))); - element.insert(QLatin1String("id"), QVariant(QmlDebug::Mouse)); + element.insert(QLatin1String("id"), QVariant(Mouse)); result << element; element.clear(); element.insert(QLatin1String("description"), QVariant(tr("Keyboard Events"))); - element.insert(QLatin1String("id"), QVariant(QmlDebug::Key)); + element.insert(QLatin1String("id"), QVariant(Key)); result << element; return result; @@ -80,9 +79,9 @@ QVariantMap InputEventsModel::details(int index) const QString type; const InputEvent &event = m_data[index]; switch (event.type) { - case QmlDebug::InputKeyPress: + case InputKeyPress: type = tr("Key Press"); - case QmlDebug::InputKeyRelease: + case InputKeyRelease: if (type.isEmpty()) type = tr("Key Release"); if (event.a != 0) { @@ -93,31 +92,31 @@ QVariantMap InputEventsModel::details(int index) const QLatin1String(metaEnum("KeyboardModifiers").valueToKeys(event.b))); } break; - case QmlDebug::InputMouseDoubleClick: + case InputMouseDoubleClick: type = tr("Double Click"); - case QmlDebug::InputMousePress: + case InputMousePress: if (type.isEmpty()) type = tr("Mouse Press"); - case QmlDebug::InputMouseRelease: + case InputMouseRelease: if (type.isEmpty()) type = tr("Mouse Release"); result.insert(tr("Button"), QLatin1String(metaEnum("MouseButtons").valueToKey(event.a))); result.insert(tr("Result"), QLatin1String(metaEnum("MouseButtons").valueToKeys(event.b))); break; - case QmlDebug::InputMouseMove: + case InputMouseMove: type = tr("Mouse Move"); result.insert(tr("X"), QString::number(event.a)); result.insert(tr("Y"), QString::number(event.b)); break; - case QmlDebug::InputMouseWheel: + case InputMouseWheel: type = tr("Mouse Wheel"); result.insert(tr("Angle X"), QString::number(event.a)); result.insert(tr("Angle Y"), QString::number(event.b)); break; - case QmlDebug::InputKeyUnknown: + case InputKeyUnknown: type = tr("Keyboard Event"); break; - case QmlDebug::InputMouseUnknown: + case InputMouseUnknown: type = tr("Mouse Event"); break; default: @@ -132,7 +131,7 @@ QVariantMap InputEventsModel::details(int index) const int InputEventsModel::expandedRow(int index) const { - return selectionId(index) == QmlDebug::Mouse ? 1 : 2; + return selectionId(index) == Mouse ? 1 : 2; } int InputEventsModel::collapsedRow(int index) const @@ -154,10 +153,10 @@ void InputEventsModel::loadData() continue; m_data.insert(insert(event.startTime(), 0, type.detailType), - InputEvent(static_cast(event.numericData(0)), + InputEvent(static_cast(event.numericData(0)), event.numericData(1), event.numericData(2))); - if (type.detailType == QmlDebug::Mouse) { + if (type.detailType == Mouse) { if (m_mouseTypeId == -1) m_mouseTypeId = event.typeIndex(); } else if (m_keyTypeId == -1) { @@ -180,10 +179,10 @@ void InputEventsModel::clear() bool InputEventsModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const { return QmlProfilerTimelineModel::accepted(event) && - (event.detailType == QmlDebug::Mouse || event.detailType == QmlDebug::Key); + (event.detailType == Mouse || event.detailType == Key); } -InputEventsModel::InputEvent::InputEvent(QmlDebug::InputEventType type, int a, int b) : +InputEventsModel::InputEvent::InputEvent(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 b67c981cfb7..0bb1d86b7bb 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.h +++ b/src/plugins/qmlprofiler/inputeventsmodel.h @@ -39,9 +39,8 @@ protected: public: struct InputEvent { - InputEvent(QmlDebug::InputEventType type = QmlDebug::MaximumInputEventType, int a = 0, - int b = 0); - QmlDebug::InputEventType type; + InputEvent(InputEventType type = MaximumInputEventType, int a = 0, int b = 0); + InputEventType type; int a; int b; }; diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp index 913b2cfad13..7f247d93004 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.cpp +++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp @@ -25,7 +25,7 @@ #include "memoryusagemodel.h" #include "qmlprofilermodelmanager.h" -#include "qmldebug/qmlprofilereventtypes.h" +#include "qmlprofilereventtypes.h" #include @@ -33,11 +33,10 @@ namespace QmlProfiler { namespace Internal { MemoryUsageModel::MemoryUsageModel(QmlProfilerModelManager *manager, QObject *parent) : - QmlProfilerTimelineModel(manager, QmlDebug::MemoryAllocation, QmlDebug::MaximumRangeType, - QmlDebug::ProfileMemory, parent) + QmlProfilerTimelineModel(manager, MemoryAllocation, MaximumRangeType, ProfileMemory, parent) { m_maxSize = 1; - announceFeatures((1ULL << mainFeature()) | QmlDebug::Constants::QML_JS_RANGE_FEATURES); + announceFeatures((1ULL << mainFeature()) | Constants::QML_JS_RANGE_FEATURES); } int MemoryUsageModel::rowMaxValue(int rowNumber) const @@ -49,7 +48,7 @@ int MemoryUsageModel::rowMaxValue(int rowNumber) const int MemoryUsageModel::expandedRow(int index) const { int type = selectionId(index); - return (type == QmlDebug::HeapPage || type == QmlDebug::LargeItem) ? 1 : 2; + return (type == HeapPage || type == LargeItem) ? 1 : 2; } int MemoryUsageModel::collapsedRow(int index) const @@ -82,7 +81,7 @@ QVariantMap MemoryUsageModel::location(int index) const int originType = m_data[index].originTypeIndex; if (originType > -1) { - const QmlDebug::QmlEventLocation &location = + const QmlEventLocation &location = modelManager()->qmlModel()->getEventTypes().at(originType).location; result.insert(file, location.filename); @@ -99,12 +98,12 @@ QVariantList MemoryUsageModel::labels() const QVariantMap element; element.insert(QLatin1String("description"), QVariant(tr("Memory Allocation"))); - element.insert(QLatin1String("id"), QVariant(QmlDebug::HeapPage)); + element.insert(QLatin1String("id"), QVariant(HeapPage)); result << element; element.clear(); element.insert(QLatin1String("description"), QVariant(tr("Memory Usage"))); - element.insert(QLatin1String("id"), QVariant(QmlDebug::SmallItem)); + element.insert(QLatin1String("id"), QVariant(SmallItem)); result << element; return result; @@ -113,7 +112,7 @@ QVariantList MemoryUsageModel::labels() const QVariantMap MemoryUsageModel::details(int index) const { QVariantMap result; - const MemoryAllocation *ev = &m_data[index]; + const MemoryAllocationItem *ev = &m_data[index]; if (ev->allocated >= -ev->deallocated) result.insert(QLatin1String("displayName"), tr("Memory Allocated")); @@ -166,14 +165,14 @@ void MemoryUsageModel::loadData() while (!rangeStack.empty() && rangeStack.top().endTime < event.startTime()) rangeStack.pop(); if (!accepted(type)) { - if (type.rangeType != QmlDebug::MaximumRangeType) { + if (type.rangeType != MaximumRangeType) { rangeStack.push(RangeStackFrame(event.typeIndex(), event.startTime(), event.startTime() + event.duration())); } continue; } - if (type.detailType == QmlDebug::SmallItem || type.detailType == QmlDebug::LargeItem) { + if (type.detailType == SmallItem || type.detailType == LargeItem) { if (!rangeStack.empty() && currentUsageIndex > -1 && type.detailType == selectionId(currentUsageIndex) && m_data[currentUsageIndex].originTypeIndex == rangeStack.top().originTypeIndex && @@ -181,7 +180,7 @@ void MemoryUsageModel::loadData() m_data[currentUsageIndex].update(event.numericData(0)); currentUsage = m_data[currentUsageIndex].size; } else { - MemoryAllocation allocation(event.typeIndex(), currentUsage, + MemoryAllocationItem allocation(event.typeIndex(), currentUsage, rangeStack.empty() ? -1 : rangeStack.top().originTypeIndex); allocation.update(event.numericData(0)); currentUsage = allocation.size; @@ -190,12 +189,12 @@ void MemoryUsageModel::loadData() insertEnd(currentUsageIndex, event.startTime() - startTime(currentUsageIndex) - 1); } - currentUsageIndex = insertStart(event.startTime(), QmlDebug::SmallItem); + currentUsageIndex = insertStart(event.startTime(), SmallItem); m_data.insert(currentUsageIndex, allocation); } } - if (type.detailType == QmlDebug::HeapPage || type.detailType == QmlDebug::LargeItem) { + if (type.detailType == HeapPage || type.detailType == LargeItem) { if (!rangeStack.empty() && currentJSHeapIndex > -1 && type.detailType == selectionId(currentJSHeapIndex) && m_data[currentJSHeapIndex].originTypeIndex == @@ -204,7 +203,7 @@ void MemoryUsageModel::loadData() m_data[currentJSHeapIndex].update(event.numericData(0)); currentSize = m_data[currentJSHeapIndex].size; } else { - MemoryAllocation allocation(event.typeIndex(), currentSize, + MemoryAllocationItem allocation(event.typeIndex(), currentSize, rangeStack.empty() ? -1 : rangeStack.top().originTypeIndex); allocation.update(event.numericData(0)); currentSize = allocation.size; @@ -246,22 +245,22 @@ void MemoryUsageModel::clear() QString MemoryUsageModel::memoryTypeName(int type) { switch (type) { - case QmlDebug::HeapPage: return tr("Heap Allocation"); - case QmlDebug::LargeItem: return tr("Large Item Allocation"); - case QmlDebug::SmallItem: return tr("Heap Usage"); - case QmlDebug::MaximumMemoryType: return tr("Total"); + case HeapPage: return tr("Heap Allocation"); + case LargeItem: return tr("Large Item Allocation"); + case SmallItem: return tr("Heap Usage"); + case MaximumMemoryType: return tr("Total"); default: return tr("Unknown"); } } -MemoryUsageModel::MemoryAllocation::MemoryAllocation(int type, qint64 baseAmount, +MemoryUsageModel::MemoryAllocationItem::MemoryAllocationItem(int type, qint64 baseAmount, int originTypeIndex) : typeId(type), size(baseAmount), allocated(0), deallocated(0), allocations(0), deallocations(0), originTypeIndex(originTypeIndex) { } -void MemoryUsageModel::MemoryAllocation::update(qint64 amount) +void MemoryUsageModel::MemoryAllocationItem::update(qint64 amount) { size += amount; if (amount < 0) { diff --git a/src/plugins/qmlprofiler/memoryusagemodel.h b/src/plugins/qmlprofiler/memoryusagemodel.h index c8a834567be..a8748cc2400 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 MemoryAllocation { + struct MemoryAllocationItem { int typeId; qint64 size; qint64 allocated; @@ -48,7 +48,7 @@ public: int deallocations; int originTypeIndex; - MemoryAllocation(int typeId = -1, qint64 baseAmount = 0, int originTypeIndex = -1); + MemoryAllocationItem(int typeId = -1, qint64 baseAmount = 0, int originTypeIndex = -1); void update(qint64 amount); }; @@ -74,7 +74,7 @@ protected: private: static QString memoryTypeName(int type); - QVector m_data; + QVector m_data; qint64 m_maxSize; }; diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.cpp b/src/plugins/qmlprofiler/pixmapcachemodel.cpp index 1355c14fd03..895dc7ce39b 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.cpp +++ b/src/plugins/qmlprofiler/pixmapcachemodel.cpp @@ -25,14 +25,14 @@ #include "pixmapcachemodel.h" #include "qmlprofilermodelmanager.h" -#include "qmldebug/qmlprofilereventtypes.h" +#include "qmlprofilereventtypes.h" namespace QmlProfiler { namespace Internal { PixmapCacheModel::PixmapCacheModel(QmlProfilerModelManager *manager, QObject *parent) : - QmlProfilerTimelineModel(manager, QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType, - QmlDebug::ProfilePixmapCache, parent) + QmlProfilerTimelineModel(manager, PixmapCacheEvent, MaximumRangeType, ProfilePixmapCache, + parent) { m_maxCacheSize = 1; } @@ -113,7 +113,7 @@ QVariantList PixmapCacheModel::labels() const QVariantMap PixmapCacheModel::details(int index) const { QVariantMap result; - const PixmapCacheEvent *ev = &m_data[index]; + const PixmapCacheItem *ev = &m_data[index]; if (ev->pixmapEventType == PixmapCacheCountChanged) { result.insert(QLatin1String("displayName"), tr("Image Cached")); @@ -180,7 +180,7 @@ void PixmapCacheModel::loadData() if (!accepted(type)) continue; - PixmapCacheEvent newEvent; + PixmapCacheItem newEvent; newEvent.pixmapEventType = static_cast(type.detailType); qint64 pixmapStartTime = event.startTime(); @@ -425,7 +425,7 @@ void PixmapCacheModel::clear() void PixmapCacheModel::computeMaxCacheSize() { m_maxCacheSize = 1; - foreach (const PixmapCacheModel::PixmapCacheEvent &event, m_data) { + foreach (const PixmapCacheModel::PixmapCacheItem &event, m_data) { if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) { if (event.cacheSize > m_maxCacheSize) m_maxCacheSize = event.cacheSize; @@ -451,7 +451,7 @@ void PixmapCacheModel::flattenLoads() // computes "compressed row" QVector eventEndTimes; for (int i = 0; i < count(); i++) { - PixmapCacheModel::PixmapCacheEvent &event = m_data[i]; + PixmapCacheModel::PixmapCacheItem &event = m_data[i]; if (event.pixmapEventType == PixmapCacheModel::PixmapLoadingStarted) { event.rowNumberCollapsed = 0; while (eventEndTimes.count() > event.rowNumberCollapsed && @@ -475,7 +475,7 @@ void PixmapCacheModel::flattenLoads() } int PixmapCacheModel::updateCacheCount(int lastCacheSizeEvent, - qint64 pixmapStartTime, qint64 pixSize, PixmapCacheEvent &newEvent, int typeId) + qint64 pixmapStartTime, qint64 pixSize, PixmapCacheItem &newEvent, int typeId) { newEvent.pixmapEventType = PixmapCacheCountChanged; newEvent.rowNumberCollapsed = 1; diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.h b/src/plugins/qmlprofiler/pixmapcachemodel.h index ca0aa22f32d..e058de6ae80 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.h +++ b/src/plugins/qmlprofiler/pixmapcachemodel.h @@ -82,7 +82,7 @@ public: MaximumPixmapEventType }; - struct PixmapCacheEvent { + struct PixmapCacheItem { int typeId; PixmapEventType pixmapEventType; int urlIndex; @@ -114,9 +114,9 @@ private: void resizeUnfinishedLoads(); void flattenLoads(); int updateCacheCount(int lastCacheSizeEvent, qint64 startTime, qint64 pixSize, - PixmapCacheEvent &newEvent, int typeId); + PixmapCacheItem &newEvent, int typeId); - QVector m_data; + QVector m_data; QVector m_pixmaps; qint64 m_maxCacheSize; diff --git a/src/plugins/qmlprofiler/qml/FlameGraphView.qml b/src/plugins/qmlprofiler/qml/FlameGraphView.qml index e834d1fad27..9dd3387f968 100644 --- a/src/plugins/qmlprofiler/qml/FlameGraphView.qml +++ b/src/plugins/qmlprofiler/qml/FlameGraphView.qml @@ -59,19 +59,19 @@ ScrollView { width: parent.width height: depth * itemHeight model: flameGraphModel - sizeRole: FlameGraphModel.Duration + sizeRole: FlameGraphModel.DurationRole sizeThreshold: 0.002 y: flickable.height > height ? flickable.height - height : 0 delegate: Item { id: flamegraphItem - property int typeId: FlameGraph.data(FlameGraphModel.TypeId) || -1 + property int typeId: FlameGraph.data(FlameGraphModel.TypeIdRole) || -1 property bool isBindingLoop: parent.checkBindingLoop(typeId) property int level: parent.level + (rangeTypeVisible ? 1 : 0) property bool isSelected: typeId !== -1 && typeId === root.selectedTypeId - property bool rangeTypeVisible: root.visibleRangeTypes & - (1 << FlameGraph.data(FlameGraphModel.RangeType)) + property bool rangeTypeVisible: + root.visibleRangeTypes & (1 << FlameGraph.data(FlameGraphModel.RangeTypeRole)) onIsSelectedChanged: { if (isSelected && (tooltip.selectedNode === null || @@ -93,8 +93,8 @@ ScrollView { // Functions, not properties to limit the initial overhead when creating the nodes, // and because FlameGraph.data(...) cannot be notified anyway. - function title() { return FlameGraph.data(FlameGraphModel.Type) || ""; } - function note() { return FlameGraph.data(FlameGraphModel.Note) || ""; } + function title() { return FlameGraph.data(FlameGraphModel.TypeRole) || ""; } + function note() { return FlameGraph.data(FlameGraphModel.NoteRole) || ""; } function details() { var model = []; function addDetail(name, index, format) { @@ -128,14 +128,14 @@ ScrollView { model.push(qsTr("Details")); model.push(qsTr("Various Events")); } else { - addDetail(qsTr("Details"), FlameGraphModel.Details, noop); - addDetail(qsTr("Type"), FlameGraphModel.Type, noop); - addDetail(qsTr("Calls"), FlameGraphModel.CallCount, noop); - addDetail(qsTr("Total Time"), FlameGraphModel.Duration, printTime); - addDetail(qsTr("Mean Time"), FlameGraphModel.TimePerCall, printTime); - addDetail(qsTr("In Percent"), FlameGraphModel.TimeInPercent, + addDetail(qsTr("Details"), FlameGraphModel.DetailsRole, noop); + addDetail(qsTr("Type"), FlameGraphModel.TypeRole, noop); + addDetail(qsTr("Calls"), FlameGraphModel.CallCountRole, noop); + addDetail(qsTr("Total Time"), FlameGraphModel.DurationRole, printTime); + addDetail(qsTr("Mean Time"), FlameGraphModel.TimePerCallRole, printTime); + addDetail(qsTr("In Percent"), FlameGraphModel.TimeInPercentRole, addPercent); - addDetail(qsTr("Location"), FlameGraphModel.Location, noop); + addDetail(qsTr("Location"), FlameGraphModel.LocationRole, noop); } return model; } @@ -184,9 +184,12 @@ ScrollView { if (!flamegraphItem.FlameGraph.dataValid) return ""; - return flamegraphItem.FlameGraph.data(FlameGraphModel.Details) + " (" + - flamegraphItem.FlameGraph.data(FlameGraphModel.Type) + ", " + - flamegraphItem.FlameGraph.data(FlameGraphModel.TimeInPercent) + "%)"; + return flamegraphItem.FlameGraph.data(FlameGraphModel.DetailsRole) + + " (" + + flamegraphItem.FlameGraph.data(FlameGraphModel.TypeRole) + + ", " + + flamegraphItem.FlameGraph.data( + FlameGraphModel.TimeInPercentRole) + "%)"; } } @@ -206,12 +209,15 @@ ScrollView { onClicked: { if (flamegraphItem.FlameGraph.dataValid) { tooltip.selectedNode = flamegraphItem; - root.typeSelected( - flamegraphItem.FlameGraph.data(FlameGraphModel.TypeId)); + root.typeSelected(flamegraphItem.FlameGraph.data( + FlameGraphModel.TypeIdRole)); root.gotoSourceLocation( - flamegraphItem.FlameGraph.data(FlameGraphModel.Filename), - flamegraphItem.FlameGraph.data(FlameGraphModel.Line), - flamegraphItem.FlameGraph.data(FlameGraphModel.Column)); + flamegraphItem.FlameGraph.data( + FlameGraphModel.FilenameRole), + flamegraphItem.FlameGraph.data( + FlameGraphModel.LineRole), + flamegraphItem.FlameGraph.data( + FlameGraphModel.ColumnRole)); } } } diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro index e8bf900b3b1..b0c5a3b529d 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.pro +++ b/src/plugins/qmlprofiler/qmlprofiler.pro @@ -35,6 +35,7 @@ SOURCES += \ qmlprofilerstatisticsview.cpp \ qmlprofilertimelinemodel.cpp \ qmlprofilertool.cpp \ + qmlprofilertraceclient.cpp \ qmlprofilertracefile.cpp \ qmlprofilertraceview.cpp \ qmlprofilerviewmanager.cpp \ @@ -58,7 +59,9 @@ HEADERS += \ qmlprofilerconstants.h \ qmlprofilerdatamodel.h \ qmlprofilerdetailsrewriter.h \ + qmlprofilereventlocation.h \ qmlprofilereventsview.h \ + qmlprofilereventtypes.h \ qmlprofilermodelmanager.h \ qmlprofilernotesmodel.h \ qmlprofileroptionspage.h \ @@ -74,6 +77,7 @@ HEADERS += \ qmlprofilerstatisticsview.h \ qmlprofilertimelinemodel.h \ qmlprofilertool.h \ + qmlprofilertraceclient.h \ qmlprofilertracefile.h \ qmlprofilertraceview.h \ qmlprofilerviewmanager.h \ diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs index 304422a3691..7ab2feb1593 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.qbs +++ b/src/plugins/qmlprofiler/qmlprofiler.qbs @@ -36,7 +36,9 @@ QtcPlugin { "qmlprofilerconfigwidget.ui", "qmlprofilerconstants.h", "qmlprofilerdatamodel.cpp", "qmlprofilerdatamodel.h", "qmlprofilerdetailsrewriter.cpp", "qmlprofilerdetailsrewriter.h", + "qmlprofilereventlocation.h", "qmlprofilereventsview.h", + "qmlprofilereventtypes.h", "qmlprofilermodelmanager.cpp", "qmlprofilermodelmanager.h", "qmlprofilernotesmodel.cpp", "qmlprofilernotesmodel.h", "qmlprofileroptionspage.cpp", "qmlprofileroptionspage.h", @@ -52,6 +54,7 @@ QtcPlugin { "qmlprofilerstatisticsview.cpp", "qmlprofilerstatisticsview.h", "qmlprofilertimelinemodel.cpp", "qmlprofilertimelinemodel.h", "qmlprofilertool.cpp", "qmlprofilertool.h", + "qmlprofilertraceclient.cpp", "qmlprofilertraceclient.h", "qmlprofilertracefile.cpp", "qmlprofilertracefile.h", "qmlprofilertraceview.cpp", "qmlprofilertraceview.h", "qmlprofilerviewmanager.cpp", "qmlprofilerviewmanager.h", diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp index 33a6f996ceb..65479c0429b 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp @@ -42,8 +42,7 @@ namespace Internal { QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager, QObject *parent) : - QmlProfilerTimelineModel(manager, QmlDebug::Event, QmlDebug::MaximumRangeType, - QmlDebug::ProfileAnimations, parent) + QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileAnimations, parent) { m_maxGuiThreadAnimations = m_maxRenderThreadAnimations = 0; } @@ -57,8 +56,7 @@ void QmlProfilerAnimationsModel::clear() bool QmlProfilerAnimationsModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const { - return QmlProfilerTimelineModel::accepted(event) && - event.detailType== QmlDebug::AnimationFrame; + return QmlProfilerTimelineModel::accepted(event) && event.detailType == AnimationFrame; } void QmlProfilerAnimationsModel::loadData() @@ -71,7 +69,7 @@ void QmlProfilerAnimationsModel::loadData() const QVector &referenceList = simpleModel->getEvents(); const QVector &typeList = simpleModel->getEventTypes(); - QmlDebug::AnimationThread lastThread; + AnimationThread lastThread; QmlPaintEventData lastEvent; qint64 minNextStartTimes[] = {0, 0}; @@ -80,7 +78,7 @@ void QmlProfilerAnimationsModel::loadData() if (!accepted(type)) continue; - lastThread = (QmlDebug::AnimationThread)event.numericData(2); + lastThread = (AnimationThread)event.numericData(2); // initial estimation of the event duration: 1/framerate qint64 estimatedDuration = event.numericData(0) > 0 ? 1e9/event.numericData(0) : 1; @@ -105,7 +103,7 @@ void QmlProfilerAnimationsModel::loadData() m_data.insert(insert(realStartTime, realEndTime - realStartTime, lastThread), lastEvent); - if (lastThread == QmlDebug::GuiThread) + if (lastThread == GuiThread) m_maxGuiThreadAnimations = qMax(lastEvent.animationcount, m_maxGuiThreadAnimations); else m_maxRenderThreadAnimations = qMax(lastEvent.animationcount, @@ -124,7 +122,7 @@ void QmlProfilerAnimationsModel::loadData() int QmlProfilerAnimationsModel::rowFromThreadId(int threadId) const { - return (threadId == QmlDebug::GuiThread || m_maxGuiThreadAnimations == 0) ? 1 : 2; + return (threadId == GuiThread || m_maxGuiThreadAnimations == 0) ? 1 : 2; } int QmlProfilerAnimationsModel::rowMaxValue(int rowNumber) const @@ -166,7 +164,7 @@ QColor QmlProfilerAnimationsModel::color(int index) const float QmlProfilerAnimationsModel::relativeHeight(int index) const { - return (float)m_data[index].animationcount / (float)(selectionId(index) == QmlDebug::GuiThread ? + return (float)m_data[index].animationcount / (float)(selectionId(index) == GuiThread ? m_maxGuiThreadAnimations : m_maxRenderThreadAnimations); } @@ -179,7 +177,7 @@ QVariantList QmlProfilerAnimationsModel::labels() const QVariantMap element; element.insert(QLatin1String("displayName"), QVariant(tr("Animations"))); element.insert(QLatin1String("description"), QVariant(tr("GUI Thread"))); - element.insert(QLatin1String("id"), QVariant(QmlDebug::GuiThread)); + element.insert(QLatin1String("id"), QVariant(GuiThread)); result << element; } @@ -187,7 +185,7 @@ QVariantList QmlProfilerAnimationsModel::labels() const QVariantMap element; element.insert(QLatin1String("displayName"), QVariant(tr("Animations"))); element.insert(QLatin1String("description"), QVariant(tr("Render Thread"))); - element.insert(QLatin1String("id"), QVariant(QmlDebug::RenderThread)); + element.insert(QLatin1String("id"), QVariant(RenderThread)); result << element; } @@ -202,8 +200,8 @@ QVariantMap QmlProfilerAnimationsModel::details(int index) const result.insert(tr("Duration"), QmlProfilerDataModel::formatTime(duration(index))); result.insert(tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate)); result.insert(tr("Animations"), QString::fromLatin1("%1").arg(m_data[index].animationcount)); - result.insert(tr("Context"), tr(selectionId(index) == QmlDebug::GuiThread ? "GUI Thread" : - "Render Thread")); + result.insert(tr("Context"), tr(selectionId(index) == GuiThread ? "GUI Thread" : + "Render Thread")); return result; } diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h index ba0b0f7ece0..049a39d2330 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h @@ -25,17 +25,14 @@ #pragma once -#include #include "qmlprofilertimelinemodel.h" -#include -#include -//#include -//#include -#include -//#include +#include "qmlprofilereventtypes.h" +#include "qmlprofilereventlocation.h" #include "qmlprofilerdatamodel.h" -#include +#include +#include +#include namespace QmlProfiler { class QmlProfilerModelManager; diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index fc04703726a..8321a50b2b1 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -26,16 +26,14 @@ #include "qmlprofilerclientmanager.h" #include "qmlprofilertool.h" #include "qmlprofilerplugin.h" - -#include +#include "qmlprofilertraceclient.h" +#include "qmlprofilermodelmanager.h" #include #include #include #include -#include "qmlprofilermodelmanager.h" - using namespace QmlDebug; using namespace Core; diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.h b/src/plugins/qmlprofiler/qmlprofilerclientmanager.h index cc1490b6843..2d6c7a9ec70 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.h @@ -26,7 +26,7 @@ #pragma once #include "qmlprofilerstatemanager.h" -#include +#include "qmlprofilereventlocation.h" #include #include diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index 675b2e65881..72eadc8be3b 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -27,8 +27,8 @@ #include "qmlprofilermodelmanager.h" #include "qmlprofilernotesmodel.h" #include "qmlprofilerdetailsrewriter.h" +#include "qmlprofilereventtypes.h" -#include #include #include #include @@ -68,7 +68,7 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event) details = event.data; details = details.replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified(); if (details.isEmpty()) { - if (event.rangeType == QmlDebug::Javascript) + if (event.rangeType == Javascript) details = QmlProfilerDataModel::tr("anonymous function"); } else { QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)")); @@ -79,7 +79,7 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event) details.startsWith(QLatin1String("qrc:/"))) details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1); } - } else if (event.rangeType == QmlDebug::Painting) { + } else if (event.rangeType == Painting) { // QtQuick1 animations always run in GUI thread. details = QmlProfilerDataModel::tr("GUI Thread"); } @@ -231,7 +231,7 @@ void QmlProfilerDataModel::processData() // request further details from files // - if (event->rangeType != QmlDebug::Binding && event->rangeType != QmlDebug::HandlingSignal) + if (event->rangeType != Binding && event->rangeType != HandlingSignal) continue; // This skips anonymous bindings in Qt4.8 (we don't have valid location data for them) @@ -251,19 +251,17 @@ void QmlProfilerDataModel::processData() emit requestReload(); } -void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, - int detailType, qint64 startTime, - qint64 duration, const QString &data, - const QmlDebug::QmlEventLocation &location, - qint64 ndata1, qint64 ndata2, qint64 ndata3, - qint64 ndata4, qint64 ndata5) +void QmlProfilerDataModel::addQmlEvent(Message message, RangeType rangeType, int detailType, + qint64 startTime, qint64 duration, const QString &data, + const QmlEventLocation &location, qint64 ndata1, + qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5) { Q_D(QmlProfilerDataModel); QString displayName; QmlEventTypeData typeData(displayName, location, message, rangeType, detailType, - message == QmlDebug::DebugMessage ? QString() : data); - QmlEventData eventData = (message == QmlDebug::DebugMessage) ? + message == DebugMessage ? QString() : data); + QmlEventData eventData = (message == DebugMessage) ? QmlEventData(startTime, duration, -1, data) : QmlEventData(startTime, duration, -1, ndata1, ndata2, ndata3, ndata4, ndata5); diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.h b/src/plugins/qmlprofiler/qmlprofilerdatamodel.h index e3ffa78f50f..cbb29df3b7a 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.h +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.h @@ -26,8 +26,9 @@ #pragma once #include "qmlprofilermodelmanager.h" +#include "qmlprofilereventtypes.h" +#include "qmlprofilereventlocation.h" -#include #include namespace QmlProfiler { @@ -38,18 +39,17 @@ class QMLPROFILER_EXPORT QmlProfilerDataModel : public QObject public: struct QmlEventTypeData { QmlEventTypeData(const QString &displayName = QString(), - const QmlDebug::QmlEventLocation &location = QmlDebug::QmlEventLocation(), - QmlDebug::Message message = QmlDebug::MaximumMessage, - QmlDebug::RangeType rangeType = QmlDebug::MaximumRangeType, + const QmlEventLocation &location = QmlEventLocation(), + Message message = MaximumMessage, RangeType rangeType = MaximumRangeType, int detailType = -1, const QString &data = QString()) : displayName(displayName), location(location), message(message), rangeType(rangeType), detailType(detailType), data(data) {} QString displayName; - QmlDebug::QmlEventLocation location; - QmlDebug::Message message; - QmlDebug::RangeType rangeType; + QmlEventLocation location; + Message message; + RangeType rangeType; int detailType; // can be EventType, BindingType, PixmapEventType or SceneGraphFrameType QString data; }; @@ -215,9 +215,9 @@ public: int count() const; void clear(); bool isEmpty() const; - void addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, int bindingType, + void addQmlEvent(Message message, RangeType rangeType, int bindingType, qint64 startTime, qint64 duration, const QString &data, - const QmlDebug::QmlEventLocation &location, qint64 ndata1, qint64 ndata2, + const QmlEventLocation &location, qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5); qint64 lastTimeMark() const; diff --git a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp index f2ce13c544f..192f7dbf0b4 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp @@ -35,7 +35,7 @@ namespace QmlProfiler { namespace Internal { struct PendingEvent { - QmlDebug::QmlEventLocation location; + QmlEventLocation location; QString localFile; int requestId; }; @@ -118,7 +118,7 @@ QmlProfilerDetailsRewriter::~QmlProfilerDetailsRewriter() } void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId, - const QmlDebug::QmlEventLocation &location) + const QmlEventLocation &location) { QString localFile; if (!d->m_filesCache.contains(location.filename)) { @@ -157,7 +157,7 @@ void QmlProfilerDetailsRewriter::reloadDocuments() } void QmlProfilerDetailsRewriter::rewriteDetailsForLocation(QTextStream &textDoc, - QmlJS::Document::Ptr doc, int requestId, const QmlDebug::QmlEventLocation &location) + QmlJS::Document::Ptr doc, int requestId, const QmlEventLocation &location) { PropertyVisitor propertyVisitor; QmlJS::AST::Node *node = propertyVisitor(doc->ast(), location.line, location.column); diff --git a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.h b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.h index b80c0d8e387..0706a6a9ebc 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.h +++ b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.h @@ -25,12 +25,13 @@ #pragma once -#include +#include "qmlprofilereventlocation.h" -#include #include #include +#include + namespace QmlProfiler { namespace Internal { @@ -45,10 +46,10 @@ public: private: void rewriteDetailsForLocation(QTextStream &textDoc, QmlJS::Document::Ptr doc, int requestId, - const QmlDebug::QmlEventLocation &location); + const QmlEventLocation &location); public slots: - void requestDetailsForLocation(int requestId, const QmlDebug::QmlEventLocation &location); + void requestDetailsForLocation(int requestId, const QmlEventLocation &location); void reloadDocuments(); void documentReady(QmlJS::Document::Ptr doc); signals: diff --git a/src/libs/qmldebug/qmlprofilereventlocation.h b/src/plugins/qmlprofiler/qmlprofilereventlocation.h similarity index 88% rename from src/libs/qmldebug/qmlprofilereventlocation.h rename to src/plugins/qmlprofiler/qmlprofilereventlocation.h index 21de6d9305a..ee651b99260 100644 --- a/src/libs/qmldebug/qmlprofilereventlocation.h +++ b/src/plugins/qmlprofiler/qmlprofilereventlocation.h @@ -25,16 +25,18 @@ #pragma once -#include "qmldebug_global.h" +#include "qmlprofiler_global.h" #include -namespace QmlDebug { +namespace QmlProfiler { -struct QMLDEBUG_EXPORT QmlEventLocation +struct QMLPROFILER_EXPORT QmlEventLocation { QmlEventLocation() : line(-1),column(-1) {} - QmlEventLocation(const QString &file, int lineNumber, int columnNumber) : filename(file), line(lineNumber), column(columnNumber) {} + QmlEventLocation(const QString &file, int lineNumber, int columnNumber) : filename(file), + line(lineNumber), column(columnNumber) + {} QString filename; int line; int column; diff --git a/src/libs/qmldebug/qmlprofilereventtypes.h b/src/plugins/qmlprofiler/qmlprofilereventtypes.h similarity index 98% rename from src/libs/qmldebug/qmlprofilereventtypes.h rename to src/plugins/qmlprofiler/qmlprofilereventtypes.h index 7a9eefe1799..dce0cf1d449 100644 --- a/src/libs/qmldebug/qmlprofilereventtypes.h +++ b/src/plugins/qmlprofiler/qmlprofilereventtypes.h @@ -27,7 +27,7 @@ #include -namespace QmlDebug { +namespace QmlProfiler { enum Message { Event, @@ -179,4 +179,4 @@ const quint64 QML_JS_RANGE_FEATURES = (1 << ProfileCompiling) | (1 << ProfileJavaScript); } -} // namespace QmlDebug +} // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index 154e8448049..e03726a99ea 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -55,7 +55,7 @@ static const char *ProfileFeatureNames[] = { QT_TRANSLATE_NOOP("MainView", "Debug Messages") }; -Q_STATIC_ASSERT(sizeof(ProfileFeatureNames) == sizeof(char *) * QmlDebug::MaximumProfileFeature); +Q_STATIC_ASSERT(sizeof(ProfileFeatureNames) == sizeof(char *) * MaximumProfileFeature); ///////////////////////////////////////////////////////////////////// QmlProfilerTraceTime::QmlProfilerTraceTime(QObject *parent) : @@ -274,22 +274,15 @@ void QmlProfilerModelManager::setRecordedFeatures(quint64 features) } } -const char *QmlProfilerModelManager::featureName(QmlDebug::ProfileFeature feature) +const char *QmlProfilerModelManager::featureName(ProfileFeature feature) { return ProfileFeatureNames[feature]; } -void QmlProfilerModelManager::addQmlEvent(QmlDebug::Message message, - QmlDebug::RangeType rangeType, - int detailType, - qint64 startTime, - qint64 length, - const QString &data, - const QmlDebug::QmlEventLocation &location, - qint64 ndata1, - qint64 ndata2, - qint64 ndata3, - qint64 ndata4, +void QmlProfilerModelManager::addQmlEvent(Message message, RangeType rangeType, int detailType, + qint64 startTime, qint64 length, const QString &data, + const QmlEventLocation &location, qint64 ndata1, + qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5) { // If trace start time was not explicitly set, use the first event @@ -302,11 +295,11 @@ void QmlProfilerModelManager::addQmlEvent(QmlDebug::Message message, } void QmlProfilerModelManager::addDebugMessage(QtMsgType type, qint64 timestamp, const QString &text, - const QmlDebug::QmlEventLocation &location) + const QmlEventLocation &location) { if (state() == AcquiringData) - d->model->addQmlEvent(QmlDebug::DebugMessage, QmlDebug::MaximumRangeType, type, timestamp, - 0, text, location, 0, 0, 0, 0, 0); + d->model->addQmlEvent(DebugMessage, MaximumRangeType, type, timestamp, 0, text, location, 0, + 0, 0, 0, 0); } void QmlProfilerModelManager::acquiringDone() diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h index d0cfd34b24a..335f68e5648 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h @@ -26,9 +26,9 @@ #pragma once #include "qmlprofiler_global.h" +#include "qmlprofilereventtypes.h" +#include "qmlprofilereventlocation.h" -#include -#include #include #include @@ -107,7 +107,7 @@ public: void acquiringDone(); void processingDone(); - static const char *featureName(QmlDebug::ProfileFeature feature); + static const char *featureName(ProfileFeature feature); signals: void error(const QString &error); @@ -116,7 +116,7 @@ signals: void loadFinished(); void saveFinished(); - void requestDetailsForLocation(int eventType, const QmlDebug::QmlEventLocation &location); + void requestDetailsForLocation(int eventType, const QmlEventLocation &location); void availableFeaturesChanged(quint64 features); void visibleFeaturesChanged(quint64 features); void recordedFeaturesChanged(quint64 features); @@ -125,12 +125,11 @@ public slots: void clear(); void prepareForWriting(); - void addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, int bindingType, - qint64 startTime, qint64 length, const QString &data, - const QmlDebug::QmlEventLocation &location, + void addQmlEvent(Message message, RangeType rangeType, int bindingType, qint64 startTime, + qint64 length, const QString &data, const QmlEventLocation &location, qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5); void addDebugMessage(QtMsgType type, qint64 timestamp, const QString &text, - const QmlDebug::QmlEventLocation &location); + const QmlEventLocation &location); void save(const QString &filename); void load(const QString &filename); diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index 740c340a06c..f93e0482600 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -44,10 +44,9 @@ namespace QmlProfiler { namespace Internal { -QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, - QmlDebug::RangeType range, QObject *parent) : - QmlProfilerTimelineModel(manager, QmlDebug::MaximumMessage, range, - QmlDebug::featureFromRangeType(range), parent) +QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range, + QObject *parent) : + QmlProfilerTimelineModel(manager, MaximumMessage, range, featureFromRangeType(range), parent) { m_expandedRowTypes << -1; } @@ -62,7 +61,7 @@ void QmlProfilerRangeModel::clear() bool QmlProfilerRangeModel::supportsBindingLoops() const { - return rangeType() == QmlDebug::Binding || rangeType() == QmlDebug::HandlingSignal; + return rangeType() == Binding || rangeType() == HandlingSignal; } void QmlProfilerRangeModel::loadData() @@ -113,7 +112,7 @@ void QmlProfilerRangeModel::computeNestingContracted() int i; int eventCount = count(); - int nestingLevels = QmlDebug::Constants::QML_MIN_LEVEL; + int nestingLevels = Constants::QML_MIN_LEVEL; int collapsedRowCount = nestingLevels + 1; QVector nestingEndTimes; nestingEndTimes.fill(0, nestingLevels + 1); @@ -128,7 +127,7 @@ void QmlProfilerRangeModel::computeNestingContracted() if (nestingLevels == collapsedRowCount) ++collapsedRowCount; } else { - while (nestingLevels > QmlDebug::Constants::QML_MIN_LEVEL && + while (nestingLevels > Constants::QML_MIN_LEVEL && nestingEndTimes[nestingLevels-1] <= st) nestingLevels--; } diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.h b/src/plugins/qmlprofiler/qmlprofilerrangemodel.h index 043f8773c48..67ee663ce5c 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.h +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.h @@ -26,10 +26,11 @@ #pragma once #include "qmlprofilertimelinemodel.h" -#include -#include -#include #include "qmlprofilerdatamodel.h" +#include "qmlprofilereventtypes.h" +#include "qmlprofilereventlocation.h" + +#include #include namespace QmlProfiler { @@ -44,8 +45,8 @@ public: struct QmlRangeEventStartInstance { QmlRangeEventStartInstance() : - displayRowExpanded(QmlDebug::Constants::QML_MIN_LEVEL), - displayRowCollapsed(QmlDebug::Constants::QML_MIN_LEVEL), + displayRowExpanded(Constants::QML_MIN_LEVEL), + displayRowCollapsed(Constants::QML_MIN_LEVEL), bindingLoopHead(-1) {} // not-expanded, per type @@ -54,8 +55,7 @@ public: int bindingLoopHead; }; - QmlProfilerRangeModel(QmlProfilerModelManager *manager, QmlDebug::RangeType range, - QObject *parent = 0); + QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range, QObject *parent = 0); Q_INVOKABLE int expandedRow(int index) const; Q_INVOKABLE int collapsedRow(int index) const; diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp index 644bda9f500..79d1c6ebb2f 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp @@ -54,7 +54,7 @@ public: int modelId; - QList acceptedTypes; + QList acceptedTypes; QSet eventsInBindingLoop; QHash notes; }; @@ -73,9 +73,9 @@ QmlProfilerStatisticsModel::QmlProfilerStatisticsModel(QmlProfilerModelManager * // We're iterating twice in loadData. modelManager->setProxyCountWeight(d->modelId, 2); - d->acceptedTypes << QmlDebug::Compiling << QmlDebug::Creating << QmlDebug::Binding << QmlDebug::HandlingSignal << QmlDebug::Javascript; + d->acceptedTypes << Compiling << Creating << Binding << HandlingSignal << Javascript; - modelManager->announceFeatures(d->modelId, QmlDebug::Constants::QML_JS_RANGE_FEATURES); + modelManager->announceFeatures(d->modelId, Constants::QML_JS_RANGE_FEATURES); } QmlProfilerStatisticsModel::~QmlProfilerStatisticsModel() @@ -83,7 +83,7 @@ QmlProfilerStatisticsModel::~QmlProfilerStatisticsModel() delete d; } -void QmlProfilerStatisticsModel::setEventTypeAccepted(QmlDebug::RangeType type, bool accepted) +void QmlProfilerStatisticsModel::setEventTypeAccepted(RangeType type, bool accepted) { if (accepted && !d->acceptedTypes.contains(type)) d->acceptedTypes << type; @@ -91,7 +91,7 @@ void QmlProfilerStatisticsModel::setEventTypeAccepted(QmlDebug::RangeType type, d->acceptedTypes.removeOne(type); } -bool QmlProfilerStatisticsModel::eventTypeAccepted(QmlDebug::RangeType type) const +bool QmlProfilerStatisticsModel::eventTypeAccepted(RangeType type) const { return d->acceptedTypes.contains(type); } @@ -357,7 +357,7 @@ void QmlProfilerStatisticsParentsModel::loadData() // for level computation QHash endtimesPerLevel; - int level = QmlDebug::Constants::QML_MIN_LEVEL; + int level = Constants::QML_MIN_LEVEL; endtimesPerLevel[0] = 0; const QSet &eventsInBindingLoop = m_statisticsModel->eventsInBindingLoop(); @@ -375,14 +375,14 @@ void QmlProfilerStatisticsParentsModel::loadData() if (endtimesPerLevel[level] > event.startTime()) { level++; } else { - while (level > QmlDebug::Constants::QML_MIN_LEVEL && + while (level > Constants::QML_MIN_LEVEL && endtimesPerLevel[level-1] <= event.startTime()) level--; } endtimesPerLevel[level] = event.startTime() + event.duration(); int parentTypeIndex = -1; - if (level > QmlDebug::Constants::QML_MIN_LEVEL && lastParent.contains(level-1)) + if (level > Constants::QML_MIN_LEVEL && lastParent.contains(level-1)) parentTypeIndex = lastParent[level-1]; QmlStatisticsRelativesMap &relativesMap = m_data[event.typeIndex()]; @@ -419,7 +419,7 @@ void QmlProfilerStatisticsChildrenModel::loadData() // for level computation QHash endtimesPerLevel; - int level = QmlDebug::Constants::QML_MIN_LEVEL; + int level = Constants::QML_MIN_LEVEL; endtimesPerLevel[0] = 0; const QSet &eventsInBindingLoop = m_statisticsModel->eventsInBindingLoop(); @@ -437,7 +437,7 @@ void QmlProfilerStatisticsChildrenModel::loadData() if (endtimesPerLevel[level] > event.startTime()) { level++; } else { - while (level > QmlDebug::Constants::QML_MIN_LEVEL && + while (level > Constants::QML_MIN_LEVEL && endtimesPerLevel[level-1] <= event.startTime()) level--; } @@ -445,7 +445,7 @@ void QmlProfilerStatisticsChildrenModel::loadData() int parentId = -1; - if (level > QmlDebug::Constants::QML_MIN_LEVEL && lastParent.contains(level-1)) + if (level > Constants::QML_MIN_LEVEL && lastParent.contains(level-1)) parentId = lastParent[level-1]; QmlStatisticsRelativesMap &relativesMap = m_data[parentId]; diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h index a709553fcac..8f5e32e4171 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h @@ -27,11 +27,12 @@ #include "qmlprofilerdatamodel.h" #include "qmlprofilernotesmodel.h" -#include -#include -#include +#include "qmlprofilereventtypes.h" +#include "qmlprofilereventlocation.h" + #include #include +#include namespace QmlProfiler { class QmlProfilerModelManager; @@ -60,8 +61,8 @@ public: QmlProfilerStatisticsModel(QmlProfilerModelManager *modelManager, QObject *parent = 0); ~QmlProfilerStatisticsModel(); - void setEventTypeAccepted(QmlDebug::RangeType type, bool accepted); - bool eventTypeAccepted(QmlDebug::RangeType) const; + void setEventTypeAccepted(RangeType type, bool accepted); + bool eventTypeAccepted(RangeType) const; const QHash &getData() const; const QVector &getTypes() const; @@ -136,7 +137,6 @@ public: QmlProfilerStatisticsParentsModel(QmlProfilerModelManager *modelManager, QmlProfilerStatisticsModel *statisticsModel, QObject *parent = 0); - protected: virtual void loadData(); }; diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp index 89455fc2d6f..43c8d026bd8 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.cpp @@ -48,8 +48,6 @@ #include #include -using namespace QmlDebug; - namespace QmlProfiler { namespace Internal { @@ -335,7 +333,7 @@ void QmlProfilerStatisticsView::onVisibleFeaturesChanged(quint64 features) for (int i = 0; i < MaximumRangeType; ++i) { RangeType range = static_cast(i); quint64 featureFlag = 1ULL << featureFromRangeType(range); - if (QmlDebug::Constants::QML_JS_RANGE_FEATURES & featureFlag) + if (Constants::QML_JS_RANGE_FEATURES & featureFlag) d->model->setEventTypeAccepted(range, features & featureFlag); } d->model->limitToRange(d->rangeStart, d->rangeEnd); diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.h b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.h index bf31bdd164e..522ccf0fcc1 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsview.h +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsview.h @@ -29,8 +29,8 @@ #include "qmlprofilerstatisticsmodel.h" #include "qmlprofilerviewmanager.h" #include "qmlprofilereventsview.h" +#include "qmlprofilereventtypes.h" -#include #include #include @@ -116,7 +116,7 @@ public: void copyTableToClipboard() const; void copyRowToClipboard() const; - static QString nameForType(QmlDebug::RangeType typeNumber); + static QString nameForType(RangeType typeNumber); int selectedTypeId() const; diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp index 8c1a87b3a6b..7e1f9136124 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.cpp @@ -28,10 +28,8 @@ namespace QmlProfiler { QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, - QmlDebug::Message message, - QmlDebug::RangeType rangeType, - QmlDebug::ProfileFeature mainFeature, - QObject *parent) : + Message message, RangeType rangeType, + ProfileFeature mainFeature, QObject *parent) : TimelineModel(modelManager->registerModelProxy(), parent), m_message(message), m_rangeType(rangeType), m_mainFeature(mainFeature), m_modelManager(modelManager) @@ -44,17 +42,17 @@ QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *mode announceFeatures(1ULL << m_mainFeature); } -QmlDebug::RangeType QmlProfilerTimelineModel::rangeType() const +RangeType QmlProfilerTimelineModel::rangeType() const { return m_rangeType; } -QmlDebug::Message QmlProfilerTimelineModel::message() const +Message QmlProfilerTimelineModel::message() const { return m_message; } -QmlDebug::ProfileFeature QmlProfilerTimelineModel::mainFeature() const +ProfileFeature QmlProfilerTimelineModel::mainFeature() const { return m_mainFeature; } @@ -133,7 +131,7 @@ QVariantMap QmlProfilerTimelineModel::locationFromTypeId(int index) const if (id >= types.length()) return result; - const QmlDebug::QmlEventLocation &location = types.at(id).location; + const QmlEventLocation &location = types.at(id).location; result.insert(QStringLiteral("file"), location.filename); result.insert(QStringLiteral("line"), location.line); diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h index 8f4efd44295..a16bb12925b 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h @@ -34,20 +34,19 @@ namespace QmlProfiler { class QMLPROFILER_EXPORT QmlProfilerTimelineModel : public Timeline::TimelineModel { Q_OBJECT - Q_PROPERTY(QmlDebug::RangeType rangeType READ rangeType CONSTANT) - Q_PROPERTY(QmlDebug::Message message READ message CONSTANT) + Q_PROPERTY(RangeType rangeType READ rangeType CONSTANT) + Q_PROPERTY(Message message READ message CONSTANT) Q_PROPERTY(QmlProfilerModelManager *modelManager READ modelManager CONSTANT) public: - QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, - QmlDebug::Message message, QmlDebug::RangeType rangeType, - QmlDebug::ProfileFeature mainFeature, QObject *parent); + QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, Message message, + RangeType rangeType, ProfileFeature mainFeature, QObject *parent); QmlProfilerModelManager *modelManager() const; - QmlDebug::RangeType rangeType() const; - QmlDebug::Message message() const; - QmlDebug::ProfileFeature mainFeature() const; + RangeType rangeType() const; + Message message() const; + ProfileFeature mainFeature() const; virtual bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const; bool handlesTypeId(int typeId) const; @@ -66,9 +65,9 @@ protected: void announceFeatures(quint64 features) const; private: - const QmlDebug::Message m_message; - const QmlDebug::RangeType m_rangeType; - const QmlDebug::ProfileFeature m_mainFeature; + const Message m_message; + const RangeType m_rangeType; + const ProfileFeature m_mainFeature; QmlProfilerModelManager *const m_modelManager; }; diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 4083fe35bfc..80eb44c32bf 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -86,7 +86,6 @@ using namespace Core::Constants; using namespace Debugger; using namespace Debugger::Constants; using namespace QmlProfiler::Constants; -using namespace QmlDebug; using namespace ProjectExplorer; namespace QmlProfiler { diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index 29ca5beb5f2..8d279580da8 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -27,7 +27,7 @@ #include "qmlprofiler_global.h" #include "qmlprofilerconstants.h" -#include "qmldebug/qmlprofilereventtypes.h" +#include "qmlprofilereventtypes.h" #include #include @@ -98,7 +98,7 @@ private: void updateRunActions(); void clearDisplay(); void populateFileFinder(QString projectDirectory = QString(), QString activeSysroot = QString()); - template + template void updateFeatures(quint64 features); bool checkForUnsavedNotes(); void restoreFeatureVisibility(); diff --git a/src/libs/qmldebug/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp similarity index 91% rename from src/libs/qmldebug/qmlprofilertraceclient.cpp rename to src/plugins/qmlprofiler/qmlprofilertraceclient.cpp index 56ad8780650..e020a6c5107 100644 --- a/src/libs/qmldebug/qmlprofilertraceclient.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp @@ -24,15 +24,15 @@ ****************************************************************************/ #include "qmlprofilertraceclient.h" -#include "qmlenginecontrolclient.h" -#include "qdebugmessageclient.h" -#include "qpacketprotocol.h" +#include +#include +#include -namespace QmlDebug { +namespace QmlProfiler { class QmlProfilerTraceClientPrivate { public: - QmlProfilerTraceClientPrivate(QmlProfilerTraceClient *_q, QmlDebugConnection *client) + QmlProfilerTraceClientPrivate(QmlProfilerTraceClient *_q, QmlDebug::QmlDebugConnection *client) : q(_q) , engineControl(client) , inProgressRanges(0) @@ -46,11 +46,11 @@ public: } void sendRecordingStatus(int engineId); - bool updateFeatures(QmlDebug::ProfileFeature feature); + bool updateFeatures(ProfileFeature feature); QmlProfilerTraceClient *q; - QmlEngineControlClient engineControl; - QScopedPointer messageClient; + QmlDebug::QmlEngineControlClient engineControl; + QScopedPointer messageClient; qint64 inProgressRanges; QStack rangeStartTimes[MaximumRangeType]; QStack rangeDatas[MaximumRangeType]; @@ -64,25 +64,26 @@ public: quint32 flushInterval; }; -} // namespace QmlDebug +} // namespace QmlProfiler -using namespace QmlDebug; +using namespace QmlProfiler; void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId) { - QPacket stream(q->connection()->currentDataStreamVersion()); + QmlDebug::QPacket stream(q->connection()->currentDataStreamVersion()); stream << recording << engineId; // engineId -1 is OK. It means "all of them" if (recording) stream << requestedFeatures << flushInterval; q->sendMessage(stream.data()); } -QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features) +QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client, + quint64 features) : QmlDebugClient(QLatin1String("CanvasFrameRate"), client) , d(new QmlProfilerTraceClientPrivate(this, client)) { setRequestedFeatures(features); - connect(&d->engineControl, &QmlEngineControlClient::engineAboutToBeAdded, + connect(&d->engineControl, &QmlDebug::QmlEngineControlClient::engineAboutToBeAdded, this, &QmlProfilerTraceClient::newEngine); } @@ -143,13 +144,14 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features) { d->requestedFeatures = features; if (features & static_cast(1) << ProfileDebugMessages) { - d->messageClient.reset(new QDebugMessageClient(connection())); - connect(d->messageClient.data(), &QDebugMessageClient::message, this, [this](QtMsgType type, - const QString &text, const QmlDebug::QDebugContextInfo &context) + d->messageClient.reset(new QmlDebug::QDebugMessageClient(connection())); + connect(d->messageClient.data(), &QmlDebug::QDebugMessageClient::message, this, + [this](QtMsgType type, const QString &text, + const QmlDebug::QDebugContextInfo &context) { d->updateFeatures(ProfileDebugMessages); emit debugMessage(type, context.timestamp, text, - QmlDebug::QmlEventLocation(context.file, context.line, 1)); + QmlEventLocation(context.file, context.line, 1)); }); } else { d->messageClient.reset(); @@ -189,7 +191,7 @@ void QmlProfilerTraceClient::stateChanged(State status) void QmlProfilerTraceClient::messageReceived(const QByteArray &data) { - QPacket stream(connection()->currentDataStreamVersion(), data); + QmlDebug::QPacket stream(connection()->currentDataStreamVersion(), data); qint64 time; int messageType; diff --git a/src/libs/qmldebug/qmlprofilertraceclient.h b/src/plugins/qmlprofiler/qmlprofilertraceclient.h similarity index 81% rename from src/libs/qmldebug/qmlprofilertraceclient.h rename to src/plugins/qmlprofiler/qmlprofilertraceclient.h index adaf93971cc..3d148a83158 100644 --- a/src/libs/qmldebug/qmlprofilertraceclient.h +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.h @@ -25,15 +25,16 @@ #pragma once -#include "qmldebugclient.h" #include "qmlprofilereventtypes.h" #include "qmlprofilereventlocation.h" -#include "qmldebug_global.h" +#include "qmlprofiler_global.h" + +#include #include #include -namespace QmlDebug { +namespace QmlProfiler { class QMLDEBUG_EXPORT QmlProfilerTraceClient : public QmlDebug::QmlDebugClient { @@ -44,7 +45,7 @@ class QMLDEBUG_EXPORT QmlProfilerTraceClient : public QmlDebug::QmlDebugClient using QObject::event; public: - QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features); + QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client, quint64 features); ~QmlProfilerTraceClient(); bool isRecording() const; @@ -61,12 +62,11 @@ signals: void complete(qint64 maximumTime); void traceFinished(qint64 time, const QList &engineIds); void traceStarted(qint64 time, const QList &engineIds); - void rangedEvent(QmlDebug::Message, QmlDebug::RangeType, int detailType, qint64 startTime, - qint64 length, const QString &data, - const QmlDebug::QmlEventLocation &location, qint64 param1, qint64 param2, - qint64 param3, qint64 param4, qint64 param5); + void rangedEvent(Message, RangeType, int detailType, qint64 startTime, qint64 length, + const QString &data, const QmlEventLocation &location, qint64 param1, + qint64 param2, qint64 param3, qint64 param4, qint64 param5); void debugMessage(QtMsgType type, qint64 timestamp, const QString &text, - const QmlDebug::QmlEventLocation &location); + const QmlEventLocation &location); void recordingChanged(bool arg); void recordedFeaturesChanged(quint64 features); void newEngine(int engineId); @@ -84,4 +84,4 @@ private: class QmlProfilerTraceClientPrivate *d; }; -} // namespace QmlDebug +} // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index afe6186967b..567b167bdfc 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -25,6 +25,7 @@ #include "qmlprofilertracefile.h" + #include #include @@ -33,9 +34,8 @@ #include #include -// import QmlEventType, QmlBindingType enums, QmlEventLocation -using namespace QmlDebug; - +namespace QmlProfiler { +namespace Internal { const char PROFILER_FILE_VERSION[] = "1.02"; @@ -48,7 +48,7 @@ static const char *RANGE_TYPE_STRINGS[] = { "Javascript" }; -Q_STATIC_ASSERT(sizeof(RANGE_TYPE_STRINGS) == QmlDebug::MaximumRangeType * sizeof(const char *)); +Q_STATIC_ASSERT(sizeof(RANGE_TYPE_STRINGS) == MaximumRangeType * sizeof(const char *)); static const char *MESSAGE_STRINGS[] = { // So far only pixmap and scenegraph are used. The others are padding. @@ -64,7 +64,7 @@ static const char *MESSAGE_STRINGS[] = { "DebugMessage" }; -Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == QmlDebug::MaximumMessage * sizeof(const char *)); +Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == MaximumMessage * sizeof(const char *)); #define _(X) QLatin1String(X) @@ -72,9 +72,6 @@ Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == QmlDebug::MaximumMessage * sizeof(con // "be strict in your output but tolerant in your inputs" // -namespace QmlProfiler { -namespace Internal { - static QPair qmlTypeAsEnum(const QString &typeString) { QPair ret(MaximumMessage, MaximumRangeType); @@ -195,7 +192,7 @@ quint64 QmlProfilerFileReader::loadedFeatures() const return m_loadedFeatures; } -QmlDebug::ProfileFeature featureFromEvent(const QmlProfilerDataModel::QmlEventTypeData &event) { +ProfileFeature featureFromEvent(const QmlProfilerDataModel::QmlEventTypeData &event) { if (event.rangeType < MaximumRangeType) return featureFromRangeType(event.rangeType); diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.h b/src/plugins/qmlprofiler/qmlprofilertracefile.h index 433224d380a..2da149d40cc 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.h +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.h @@ -25,16 +25,15 @@ #pragma once +#include "qmlprofilereventlocation.h" +#include "qmlprofilereventtypes.h" +#include "qmlprofilerdatamodel.h" + #include #include #include #include -#include -#include - -#include "qmlprofilerdatamodel.h" - QT_FORWARD_DECLARE_CLASS(QIODevice) QT_FORWARD_DECLARE_CLASS(QXmlStreamReader) diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 165f15f1e49..7d2b5c3fe9d 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -68,8 +68,6 @@ #include -using namespace QmlDebug; - namespace QmlProfiler { namespace Internal { diff --git a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp index 50bbdcbc60c..1607d4a8583 100644 --- a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp +++ b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp @@ -25,7 +25,7 @@ #include "scenegraphtimelinemodel.h" #include "qmlprofilermodelmanager.h" -#include "qmldebug/qmlprofilereventtypes.h" +#include "qmlprofilereventtypes.h" #include #include @@ -75,8 +75,7 @@ Q_STATIC_ASSERT(sizeof(StageLabels) == SceneGraphTimelineModel::SceneGraphTimelineModel(QmlProfilerModelManager *manager, QObject *parent) : - QmlProfilerTimelineModel(manager, QmlDebug::SceneGraphFrame, QmlDebug::MaximumRangeType, - QmlDebug::ProfileSceneGraph, parent) + QmlProfilerTimelineModel(manager, SceneGraphFrame, MaximumRangeType, ProfileSceneGraph, parent) { } @@ -145,8 +144,8 @@ void SceneGraphTimelineModel::loadData() if (!accepted(type)) continue; - switch ((QmlDebug::SceneGraphFrameType)type.detailType) { - case QmlDebug::SceneGraphRendererFrame: { + switch ((SceneGraphFrameType)type.detailType) { + case SceneGraphRendererFrame: { // Breakdown of render times. We repeat "render" here as "net" render time. It would // look incomplete if that was left out as the printf profiler lists it, too, and people // are apparently comparing that. Unfortunately it is somewhat redundant as the other @@ -159,19 +158,19 @@ void SceneGraphTimelineModel::loadData() insert(startTime, event.numericData(3), event.typeIndex(), RenderRender); break; } - case QmlDebug::SceneGraphAdaptationLayerFrame: { + case SceneGraphAdaptationLayerFrame: { qint64 startTime = event.startTime() - event.numericData(1) - event.numericData(2); startTime += insert(startTime, event.numericData(1), event.typeIndex(), GlyphRender, event.numericData(0)); insert(startTime, event.numericData(2), event.typeIndex(), GlyphStore, event.numericData(0)); break; } - case QmlDebug::SceneGraphContextFrame: { + case SceneGraphContextFrame: { insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), Material); break; } - case QmlDebug::SceneGraphRenderLoopFrame: { + case SceneGraphRenderLoopFrame: { qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) - event.numericData(2); startTime += insert(startTime, event.numericData(0), event.typeIndex(), @@ -181,7 +180,7 @@ void SceneGraphTimelineModel::loadData() insert(startTime, event.numericData(2), event.typeIndex(), Swap); break; } - case QmlDebug::SceneGraphTexturePrepare: { + case SceneGraphTexturePrepare: { qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) - event.numericData(2) - event.numericData(3) - event.numericData(4); startTime += insert(startTime, event.numericData(0), event.typeIndex(), TextureBind); @@ -191,12 +190,12 @@ void SceneGraphTimelineModel::loadData() insert(startTime, event.numericData(4), event.typeIndex(), TextureMipmap); break; } - case QmlDebug::SceneGraphTextureDeletion: { + case SceneGraphTextureDeletion: { insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), TextureDeletion); break; } - case QmlDebug::SceneGraphPolishAndSync: { + case SceneGraphPolishAndSync: { qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) - event.numericData(2) - event.numericData(3); @@ -206,13 +205,13 @@ void SceneGraphTimelineModel::loadData() insert(startTime, event.numericData(3), event.typeIndex(), Animations); break; } - case QmlDebug::SceneGraphWindowsAnimations: { + case SceneGraphWindowsAnimations: { // GUI thread, separate animations stage insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), Animations); break; } - case QmlDebug::SceneGraphPolishFrame: { + case SceneGraphPolishFrame: { // GUI thread, separate polish stage insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), Polish);