Move QmlProfiler specific files from qmldebug to qmlprofiler

These file were not used anywhere else and had no business to be in
qmldebug to begin with. Moving them allows us to drop a number of
namespace qualifications and forces us to rename a few local symbols
in other classes in order to avoid name clashes.

Change-Id: I658ed455eec027cbaddacf2980d2ea6827ae6205
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-05-02 12:18:57 +02:00
parent 08655de4a5
commit e5a38bacc4
43 changed files with 320 additions and 345 deletions

View File

@@ -5,15 +5,12 @@ contains(CONFIG, dll) {
} }
HEADERS += \ HEADERS += \
$$PWD/qmlprofilereventlocation.h \
$$PWD/qmldebugclient.h \ $$PWD/qmldebugclient.h \
$$PWD/baseenginedebugclient.h \ $$PWD/baseenginedebugclient.h \
$$PWD/declarativeenginedebugclient.h \ $$PWD/declarativeenginedebugclient.h \
$$PWD/declarativeenginedebugclientv2.h \ $$PWD/declarativeenginedebugclientv2.h \
$$PWD/qmloutputparser.h \ $$PWD/qmloutputparser.h \
$$PWD/qmldebug_global.h \ $$PWD/qmldebug_global.h \
$$PWD/qmlprofilereventtypes.h \
$$PWD/qmlprofilertraceclient.h \
$$PWD/qpacketprotocol.h \ $$PWD/qpacketprotocol.h \
$$PWD/qmldebugconstants.h \ $$PWD/qmldebugconstants.h \
$$PWD/qdebugmessageclient.h \ $$PWD/qdebugmessageclient.h \
@@ -28,7 +25,6 @@ SOURCES += \
$$PWD/qmldebugclient.cpp \ $$PWD/qmldebugclient.cpp \
$$PWD/baseenginedebugclient.cpp \ $$PWD/baseenginedebugclient.cpp \
$$PWD/qmloutputparser.cpp \ $$PWD/qmloutputparser.cpp \
$$PWD/qmlprofilertraceclient.cpp \
$$PWD/qpacketprotocol.cpp \ $$PWD/qpacketprotocol.cpp \
$$PWD/qdebugmessageclient.cpp \ $$PWD/qdebugmessageclient.cpp \
$$PWD/basetoolsclient.cpp \ $$PWD/basetoolsclient.cpp \

View File

@@ -30,10 +30,6 @@ QtcLibrary {
"qmlenginedebugclient.h", "qmlenginedebugclient.h",
"qmloutputparser.cpp", "qmloutputparser.cpp",
"qmloutputparser.h", "qmloutputparser.h",
"qmlprofilereventlocation.h",
"qmlprofilereventtypes.h",
"qmlprofilertraceclient.cpp",
"qmlprofilertraceclient.h",
"qmltoolsclient.cpp", "qmltoolsclient.cpp",
"qmltoolsclient.h", "qmltoolsclient.h",
"qpacketprotocol.cpp", "qpacketprotocol.cpp",

View File

@@ -30,12 +30,12 @@ namespace Internal {
bool DebugMessagesModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const bool DebugMessagesModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
{ {
return event.message == QmlDebug::DebugMessage; return event.message == DebugMessage;
} }
DebugMessagesModel::DebugMessagesModel(QmlProfilerModelManager *manager, QObject *parent) : DebugMessagesModel::DebugMessagesModel(QmlProfilerModelManager *manager, QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::DebugMessage, QmlDebug::MaximumRangeType, QmlProfilerTimelineModel(manager, DebugMessage, MaximumRangeType, ProfileDebugMessages, parent),
QmlDebug::ProfileDebugMessages, parent), m_maximumMsgType(-1) m_maximumMsgType(-1)
{ {
} }

View File

@@ -53,9 +53,8 @@ FlameGraphModel::FlameGraphModel(QmlProfilerModelManager *modelManager,
// We're iterating twice in loadData. // We're iterating twice in loadData.
modelManager->setProxyCountWeight(m_modelId, 2); modelManager->setProxyCountWeight(m_modelId, 2);
m_acceptedTypes << QmlDebug::Compiling << QmlDebug::Creating << QmlDebug::Binding m_acceptedTypes << Compiling << Creating << Binding << HandlingSignal << Javascript;
<< QmlDebug::HandlingSignal << QmlDebug::Javascript; modelManager->announceFeatures(m_modelId, Constants::QML_JS_RANGE_FEATURES);
modelManager->announceFeatures(m_modelId, QmlDebug::Constants::QML_JS_RANGE_FEATURES);
} }
void FlameGraphModel::clear() void FlameGraphModel::clear()
@@ -84,7 +83,7 @@ void FlameGraphModel::loadNotes(int typeIndex, bool emitSignal)
} }
if (emitSignal) if (emitSignal)
emit dataChanged(QModelIndex(), QModelIndex(), QVector<int>() << Note); emit dataChanged(QModelIndex(), QModelIndex(), QVector<int>() << NoteRole);
} }
void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd) void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd)
@@ -150,15 +149,15 @@ void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd)
endResetModel(); endResetModel();
} }
static QString nameForType(QmlDebug::RangeType typeNumber) static QString nameForType(RangeType typeNumber)
{ {
switch (typeNumber) { switch (typeNumber) {
case QmlDebug::Painting: return FlameGraphModel::tr("Paint"); case Painting: return FlameGraphModel::tr("Paint");
case QmlDebug::Compiling: return FlameGraphModel::tr("Compile"); case Compiling: return FlameGraphModel::tr("Compile");
case QmlDebug::Creating: return FlameGraphModel::tr("Create"); case Creating: return FlameGraphModel::tr("Create");
case QmlDebug::Binding: return FlameGraphModel::tr("Binding"); case Binding: return FlameGraphModel::tr("Binding");
case QmlDebug::HandlingSignal: return FlameGraphModel::tr("Signal"); case HandlingSignal: return FlameGraphModel::tr("Signal");
case QmlDebug::Javascript: return FlameGraphModel::tr("JavaScript"); case Javascript: return FlameGraphModel::tr("JavaScript");
default: return QString(); default: return QString();
} }
} }
@@ -166,8 +165,8 @@ static QString nameForType(QmlDebug::RangeType typeNumber)
QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
{ {
switch (role) { switch (role) {
case TypeId: return stats.typeIndex; case TypeIdRole: return stats.typeIndex;
case Note: { case NoteRole: {
QString ret; QString ret;
if (!m_typeIdsWithNotes.contains(stats.typeIndex)) if (!m_typeIdsWithNotes.contains(stats.typeIndex))
return ret; return ret;
@@ -180,10 +179,10 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
} }
return ret; return ret;
} }
case Duration: return stats.duration; case DurationRole: return stats.duration;
case CallCount: return stats.calls; case CallCountRole: return stats.calls;
case TimePerCall: return stats.duration / stats.calls; case TimePerCallRole: return stats.duration / stats.calls;
case TimeInPercent: return stats.duration * 100 / m_stackBottom.duration; case TimeInPercentRole: return stats.duration * 100 / m_stackBottom.duration;
default: break; default: break;
} }
@@ -193,14 +192,14 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
const QmlProfilerDataModel::QmlEventTypeData &type = typeList[stats.typeIndex]; const QmlProfilerDataModel::QmlEventTypeData &type = typeList[stats.typeIndex];
switch (role) { switch (role) {
case Filename: return type.location.filename; case FilenameRole: return type.location.filename;
case Line: return type.location.line; case LineRole: return type.location.line;
case Column: return type.location.column; case ColumnRole: return type.location.column;
case Type: return nameForType(type.rangeType); case TypeRole: return nameForType(type.rangeType);
case RangeType: return type.rangeType; case RangeTypeRole: return type.rangeType;
case Details: return type.data.isEmpty() ? case DetailsRole: return type.data.isEmpty() ?
FlameGraphModel::tr("Source code not available") : type.data; FlameGraphModel::tr("Source code not available") : type.data;
case Location: return type.displayName; case LocationRole: return type.displayName;
default: return QVariant(); default: return QVariant();
} }
} else { } else {
@@ -277,18 +276,18 @@ QVariant FlameGraphModel::data(const QModelIndex &index, int role) const
QHash<int, QByteArray> FlameGraphModel::roleNames() const QHash<int, QByteArray> FlameGraphModel::roleNames() const
{ {
QHash<int, QByteArray> names = QAbstractItemModel::roleNames(); QHash<int, QByteArray> names = QAbstractItemModel::roleNames();
names[TypeId] = "typeId"; names[TypeIdRole] = "typeId";
names[Type] = "type"; names[TypeRole] = "type";
names[Duration] = "duration"; names[DurationRole] = "duration";
names[CallCount] = "callCount"; names[CallCountRole] = "callCount";
names[Details] = "details"; names[DetailsRole] = "details";
names[Filename] = "filename"; names[FilenameRole] = "filename";
names[Line] = "line"; names[LineRole] = "line";
names[Column] = "column"; names[ColumnRole] = "column";
names[Note] = "note"; names[NoteRole] = "note";
names[TimePerCall] = "timePerCall"; names[TimePerCallRole] = "timePerCall";
names[TimeInPercent] = "timeInPercent"; names[TimeInPercentRole] = "timeInPercent";
names[RangeType] = "rangeType"; names[RangeTypeRole] = "rangeType";
return names; return names;
} }

View File

@@ -25,10 +25,10 @@
#pragma once #pragma once
#include <qmlprofiler/qmlprofilerdatamodel.h> #include "qmlprofilerdatamodel.h"
#include <qmlprofiler/qmlprofilernotesmodel.h> #include "qmlprofilernotesmodel.h"
#include <qmldebug/qmlprofilereventtypes.h> #include "qmlprofilereventtypes.h"
#include <qmldebug/qmlprofilereventlocation.h> #include "qmlprofilereventlocation.h"
#include <QSet> #include <QSet>
#include <QVector> #include <QVector>
@@ -55,19 +55,19 @@ class FlameGraphModel : public QAbstractItemModel
Q_ENUMS(Role) Q_ENUMS(Role)
public: public:
enum Role { enum Role {
TypeId = Qt::UserRole + 1, // Sort by data, not by displayed string TypeIdRole = Qt::UserRole + 1, // Sort by data, not by displayed string
Type, TypeRole,
Duration, DurationRole,
CallCount, CallCountRole,
Details, DetailsRole,
Filename, FilenameRole,
Line, LineRole,
Column, ColumnRole,
Note, NoteRole,
TimePerCall, TimePerCallRole,
TimeInPercent, TimeInPercentRole,
RangeType, RangeTypeRole,
Location, LocationRole,
MaxRole MaxRole
}; };
@@ -100,7 +100,7 @@ private:
int m_modelId; int m_modelId;
QmlProfilerModelManager *m_modelManager; QmlProfilerModelManager *m_modelManager;
QList<QmlDebug::RangeType> m_acceptedTypes; QList<RangeType> m_acceptedTypes;
QSet<int> m_typeIdsWithNotes; QSet<int> m_typeIdsWithNotes;
}; };

View File

@@ -91,8 +91,8 @@ void FlameGraphView::selectByTypeId(int typeIndex)
void FlameGraphView::onVisibleFeaturesChanged(quint64 features) void FlameGraphView::onVisibleFeaturesChanged(quint64 features)
{ {
int rangeTypeMask = 0; int rangeTypeMask = 0;
for (int rangeType = 0; rangeType < QmlDebug::MaximumRangeType; ++rangeType) { for (int rangeType = 0; rangeType < MaximumRangeType; ++rangeType) {
if (features & (1ULL << QmlDebug::featureFromRangeType(QmlDebug::RangeType(rangeType)))) if (features & (1ULL << featureFromRangeType(RangeType(rangeType))))
rangeTypeMask |= (1 << rangeType); rangeTypeMask |= (1 << rangeType);
} }
m_content->rootObject()->setProperty("visibleRangeTypes", rangeTypeMask); m_content->rootObject()->setProperty("visibleRangeTypes", rangeTypeMask);

View File

@@ -25,7 +25,7 @@
#include "inputeventsmodel.h" #include "inputeventsmodel.h"
#include "qmlprofilermodelmanager.h" #include "qmlprofilermodelmanager.h"
#include "qmldebug/qmlprofilereventtypes.h" #include "qmlprofilereventtypes.h"
#include <QKeyEvent> #include <QKeyEvent>
#include <QMouseEvent> #include <QMouseEvent>
@@ -35,15 +35,14 @@ namespace QmlProfiler {
namespace Internal { namespace Internal {
InputEventsModel::InputEventsModel(QmlProfilerModelManager *manager, QObject *parent) : InputEventsModel::InputEventsModel(QmlProfilerModelManager *manager, QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::Event, QmlDebug::MaximumRangeType, QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileInputEvents, parent),
QmlDebug::ProfileInputEvents, parent),
m_keyTypeId(-1), m_mouseTypeId(-1) m_keyTypeId(-1), m_mouseTypeId(-1)
{ {
} }
int InputEventsModel::typeId(int index) const 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 QColor InputEventsModel::color(int index) const
@@ -57,12 +56,12 @@ QVariantList InputEventsModel::labels() const
QVariantMap element; QVariantMap element;
element.insert(QLatin1String("description"), QVariant(tr("Mouse Events"))); element.insert(QLatin1String("description"), QVariant(tr("Mouse Events")));
element.insert(QLatin1String("id"), QVariant(QmlDebug::Mouse)); element.insert(QLatin1String("id"), QVariant(Mouse));
result << element; result << element;
element.clear(); element.clear();
element.insert(QLatin1String("description"), QVariant(tr("Keyboard Events"))); element.insert(QLatin1String("description"), QVariant(tr("Keyboard Events")));
element.insert(QLatin1String("id"), QVariant(QmlDebug::Key)); element.insert(QLatin1String("id"), QVariant(Key));
result << element; result << element;
return result; return result;
@@ -80,9 +79,9 @@ QVariantMap InputEventsModel::details(int index) const
QString type; QString type;
const InputEvent &event = m_data[index]; const InputEvent &event = m_data[index];
switch (event.type) { switch (event.type) {
case QmlDebug::InputKeyPress: case InputKeyPress:
type = tr("Key Press"); type = tr("Key Press");
case QmlDebug::InputKeyRelease: case InputKeyRelease:
if (type.isEmpty()) if (type.isEmpty())
type = tr("Key Release"); type = tr("Key Release");
if (event.a != 0) { if (event.a != 0) {
@@ -93,31 +92,31 @@ QVariantMap InputEventsModel::details(int index) const
QLatin1String(metaEnum("KeyboardModifiers").valueToKeys(event.b))); QLatin1String(metaEnum("KeyboardModifiers").valueToKeys(event.b)));
} }
break; break;
case QmlDebug::InputMouseDoubleClick: case InputMouseDoubleClick:
type = tr("Double Click"); type = tr("Double Click");
case QmlDebug::InputMousePress: case InputMousePress:
if (type.isEmpty()) if (type.isEmpty())
type = tr("Mouse Press"); type = tr("Mouse Press");
case QmlDebug::InputMouseRelease: case InputMouseRelease:
if (type.isEmpty()) if (type.isEmpty())
type = tr("Mouse Release"); type = tr("Mouse Release");
result.insert(tr("Button"), QLatin1String(metaEnum("MouseButtons").valueToKey(event.a))); result.insert(tr("Button"), QLatin1String(metaEnum("MouseButtons").valueToKey(event.a)));
result.insert(tr("Result"), QLatin1String(metaEnum("MouseButtons").valueToKeys(event.b))); result.insert(tr("Result"), QLatin1String(metaEnum("MouseButtons").valueToKeys(event.b)));
break; break;
case QmlDebug::InputMouseMove: case InputMouseMove:
type = tr("Mouse Move"); type = tr("Mouse Move");
result.insert(tr("X"), QString::number(event.a)); result.insert(tr("X"), QString::number(event.a));
result.insert(tr("Y"), QString::number(event.b)); result.insert(tr("Y"), QString::number(event.b));
break; break;
case QmlDebug::InputMouseWheel: case InputMouseWheel:
type = tr("Mouse Wheel"); type = tr("Mouse Wheel");
result.insert(tr("Angle X"), QString::number(event.a)); result.insert(tr("Angle X"), QString::number(event.a));
result.insert(tr("Angle Y"), QString::number(event.b)); result.insert(tr("Angle Y"), QString::number(event.b));
break; break;
case QmlDebug::InputKeyUnknown: case InputKeyUnknown:
type = tr("Keyboard Event"); type = tr("Keyboard Event");
break; break;
case QmlDebug::InputMouseUnknown: case InputMouseUnknown:
type = tr("Mouse Event"); type = tr("Mouse Event");
break; break;
default: default:
@@ -132,7 +131,7 @@ QVariantMap InputEventsModel::details(int index) const
int InputEventsModel::expandedRow(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 int InputEventsModel::collapsedRow(int index) const
@@ -154,10 +153,10 @@ void InputEventsModel::loadData()
continue; continue;
m_data.insert(insert(event.startTime(), 0, type.detailType), m_data.insert(insert(event.startTime(), 0, type.detailType),
InputEvent(static_cast<QmlDebug::InputEventType>(event.numericData(0)), InputEvent(static_cast<InputEventType>(event.numericData(0)),
event.numericData(1), event.numericData(2))); event.numericData(1), event.numericData(2)));
if (type.detailType == QmlDebug::Mouse) { if (type.detailType == Mouse) {
if (m_mouseTypeId == -1) if (m_mouseTypeId == -1)
m_mouseTypeId = event.typeIndex(); m_mouseTypeId = event.typeIndex();
} else if (m_keyTypeId == -1) { } else if (m_keyTypeId == -1) {
@@ -180,10 +179,10 @@ void InputEventsModel::clear()
bool InputEventsModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const bool InputEventsModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
{ {
return QmlProfilerTimelineModel::accepted(event) && 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) type(type), a(a), b(b)
{ {
} }

View File

@@ -39,9 +39,8 @@ protected:
public: public:
struct InputEvent { struct InputEvent {
InputEvent(QmlDebug::InputEventType type = QmlDebug::MaximumInputEventType, int a = 0, InputEvent(InputEventType type = MaximumInputEventType, int a = 0, int b = 0);
int b = 0); InputEventType type;
QmlDebug::InputEventType type;
int a; int a;
int b; int b;
}; };

View File

@@ -25,7 +25,7 @@
#include "memoryusagemodel.h" #include "memoryusagemodel.h"
#include "qmlprofilermodelmanager.h" #include "qmlprofilermodelmanager.h"
#include "qmldebug/qmlprofilereventtypes.h" #include "qmlprofilereventtypes.h"
#include <QStack> #include <QStack>
@@ -33,11 +33,10 @@ namespace QmlProfiler {
namespace Internal { namespace Internal {
MemoryUsageModel::MemoryUsageModel(QmlProfilerModelManager *manager, QObject *parent) : MemoryUsageModel::MemoryUsageModel(QmlProfilerModelManager *manager, QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::MemoryAllocation, QmlDebug::MaximumRangeType, QmlProfilerTimelineModel(manager, MemoryAllocation, MaximumRangeType, ProfileMemory, parent)
QmlDebug::ProfileMemory, parent)
{ {
m_maxSize = 1; 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 int MemoryUsageModel::rowMaxValue(int rowNumber) const
@@ -49,7 +48,7 @@ int MemoryUsageModel::rowMaxValue(int rowNumber) const
int MemoryUsageModel::expandedRow(int index) const int MemoryUsageModel::expandedRow(int index) const
{ {
int type = selectionId(index); 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 int MemoryUsageModel::collapsedRow(int index) const
@@ -82,7 +81,7 @@ QVariantMap MemoryUsageModel::location(int index) const
int originType = m_data[index].originTypeIndex; int originType = m_data[index].originTypeIndex;
if (originType > -1) { if (originType > -1) {
const QmlDebug::QmlEventLocation &location = const QmlEventLocation &location =
modelManager()->qmlModel()->getEventTypes().at(originType).location; modelManager()->qmlModel()->getEventTypes().at(originType).location;
result.insert(file, location.filename); result.insert(file, location.filename);
@@ -99,12 +98,12 @@ QVariantList MemoryUsageModel::labels() const
QVariantMap element; QVariantMap element;
element.insert(QLatin1String("description"), QVariant(tr("Memory Allocation"))); element.insert(QLatin1String("description"), QVariant(tr("Memory Allocation")));
element.insert(QLatin1String("id"), QVariant(QmlDebug::HeapPage)); element.insert(QLatin1String("id"), QVariant(HeapPage));
result << element; result << element;
element.clear(); element.clear();
element.insert(QLatin1String("description"), QVariant(tr("Memory Usage"))); element.insert(QLatin1String("description"), QVariant(tr("Memory Usage")));
element.insert(QLatin1String("id"), QVariant(QmlDebug::SmallItem)); element.insert(QLatin1String("id"), QVariant(SmallItem));
result << element; result << element;
return result; return result;
@@ -113,7 +112,7 @@ QVariantList MemoryUsageModel::labels() const
QVariantMap MemoryUsageModel::details(int index) const QVariantMap MemoryUsageModel::details(int index) const
{ {
QVariantMap result; QVariantMap result;
const MemoryAllocation *ev = &m_data[index]; const MemoryAllocationItem *ev = &m_data[index];
if (ev->allocated >= -ev->deallocated) if (ev->allocated >= -ev->deallocated)
result.insert(QLatin1String("displayName"), tr("Memory Allocated")); result.insert(QLatin1String("displayName"), tr("Memory Allocated"));
@@ -166,14 +165,14 @@ void MemoryUsageModel::loadData()
while (!rangeStack.empty() && rangeStack.top().endTime < event.startTime()) while (!rangeStack.empty() && rangeStack.top().endTime < event.startTime())
rangeStack.pop(); rangeStack.pop();
if (!accepted(type)) { if (!accepted(type)) {
if (type.rangeType != QmlDebug::MaximumRangeType) { if (type.rangeType != MaximumRangeType) {
rangeStack.push(RangeStackFrame(event.typeIndex(), event.startTime(), rangeStack.push(RangeStackFrame(event.typeIndex(), event.startTime(),
event.startTime() + event.duration())); event.startTime() + event.duration()));
} }
continue; continue;
} }
if (type.detailType == QmlDebug::SmallItem || type.detailType == QmlDebug::LargeItem) { if (type.detailType == SmallItem || type.detailType == LargeItem) {
if (!rangeStack.empty() && currentUsageIndex > -1 && if (!rangeStack.empty() && currentUsageIndex > -1 &&
type.detailType == selectionId(currentUsageIndex) && type.detailType == selectionId(currentUsageIndex) &&
m_data[currentUsageIndex].originTypeIndex == rangeStack.top().originTypeIndex && m_data[currentUsageIndex].originTypeIndex == rangeStack.top().originTypeIndex &&
@@ -181,7 +180,7 @@ void MemoryUsageModel::loadData()
m_data[currentUsageIndex].update(event.numericData(0)); m_data[currentUsageIndex].update(event.numericData(0));
currentUsage = m_data[currentUsageIndex].size; currentUsage = m_data[currentUsageIndex].size;
} else { } else {
MemoryAllocation allocation(event.typeIndex(), currentUsage, MemoryAllocationItem allocation(event.typeIndex(), currentUsage,
rangeStack.empty() ? -1 : rangeStack.top().originTypeIndex); rangeStack.empty() ? -1 : rangeStack.top().originTypeIndex);
allocation.update(event.numericData(0)); allocation.update(event.numericData(0));
currentUsage = allocation.size; currentUsage = allocation.size;
@@ -190,12 +189,12 @@ void MemoryUsageModel::loadData()
insertEnd(currentUsageIndex, insertEnd(currentUsageIndex,
event.startTime() - startTime(currentUsageIndex) - 1); event.startTime() - startTime(currentUsageIndex) - 1);
} }
currentUsageIndex = insertStart(event.startTime(), QmlDebug::SmallItem); currentUsageIndex = insertStart(event.startTime(), SmallItem);
m_data.insert(currentUsageIndex, allocation); 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 && if (!rangeStack.empty() && currentJSHeapIndex > -1 &&
type.detailType == selectionId(currentJSHeapIndex) && type.detailType == selectionId(currentJSHeapIndex) &&
m_data[currentJSHeapIndex].originTypeIndex == m_data[currentJSHeapIndex].originTypeIndex ==
@@ -204,7 +203,7 @@ void MemoryUsageModel::loadData()
m_data[currentJSHeapIndex].update(event.numericData(0)); m_data[currentJSHeapIndex].update(event.numericData(0));
currentSize = m_data[currentJSHeapIndex].size; currentSize = m_data[currentJSHeapIndex].size;
} else { } else {
MemoryAllocation allocation(event.typeIndex(), currentSize, MemoryAllocationItem allocation(event.typeIndex(), currentSize,
rangeStack.empty() ? -1 : rangeStack.top().originTypeIndex); rangeStack.empty() ? -1 : rangeStack.top().originTypeIndex);
allocation.update(event.numericData(0)); allocation.update(event.numericData(0));
currentSize = allocation.size; currentSize = allocation.size;
@@ -246,22 +245,22 @@ void MemoryUsageModel::clear()
QString MemoryUsageModel::memoryTypeName(int type) QString MemoryUsageModel::memoryTypeName(int type)
{ {
switch (type) { switch (type) {
case QmlDebug::HeapPage: return tr("Heap Allocation"); case HeapPage: return tr("Heap Allocation");
case QmlDebug::LargeItem: return tr("Large Item Allocation"); case LargeItem: return tr("Large Item Allocation");
case QmlDebug::SmallItem: return tr("Heap Usage"); case SmallItem: return tr("Heap Usage");
case QmlDebug::MaximumMemoryType: return tr("Total"); case MaximumMemoryType: return tr("Total");
default: return tr("Unknown"); default: return tr("Unknown");
} }
} }
MemoryUsageModel::MemoryAllocation::MemoryAllocation(int type, qint64 baseAmount, MemoryUsageModel::MemoryAllocationItem::MemoryAllocationItem(int type, qint64 baseAmount,
int originTypeIndex) : int originTypeIndex) :
typeId(type), size(baseAmount), allocated(0), deallocated(0), allocations(0), deallocations(0), typeId(type), size(baseAmount), allocated(0), deallocated(0), allocations(0), deallocations(0),
originTypeIndex(originTypeIndex) originTypeIndex(originTypeIndex)
{ {
} }
void MemoryUsageModel::MemoryAllocation::update(qint64 amount) void MemoryUsageModel::MemoryAllocationItem::update(qint64 amount)
{ {
size += amount; size += amount;
if (amount < 0) { if (amount < 0) {

View File

@@ -39,7 +39,7 @@ class MemoryUsageModel : public QmlProfilerTimelineModel
Q_OBJECT Q_OBJECT
public: public:
struct MemoryAllocation { struct MemoryAllocationItem {
int typeId; int typeId;
qint64 size; qint64 size;
qint64 allocated; qint64 allocated;
@@ -48,7 +48,7 @@ public:
int deallocations; int deallocations;
int originTypeIndex; 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); void update(qint64 amount);
}; };
@@ -74,7 +74,7 @@ protected:
private: private:
static QString memoryTypeName(int type); static QString memoryTypeName(int type);
QVector<MemoryAllocation> m_data; QVector<MemoryAllocationItem> m_data;
qint64 m_maxSize; qint64 m_maxSize;
}; };

View File

@@ -25,14 +25,14 @@
#include "pixmapcachemodel.h" #include "pixmapcachemodel.h"
#include "qmlprofilermodelmanager.h" #include "qmlprofilermodelmanager.h"
#include "qmldebug/qmlprofilereventtypes.h" #include "qmlprofilereventtypes.h"
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
PixmapCacheModel::PixmapCacheModel(QmlProfilerModelManager *manager, QObject *parent) : PixmapCacheModel::PixmapCacheModel(QmlProfilerModelManager *manager, QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType, QmlProfilerTimelineModel(manager, PixmapCacheEvent, MaximumRangeType, ProfilePixmapCache,
QmlDebug::ProfilePixmapCache, parent) parent)
{ {
m_maxCacheSize = 1; m_maxCacheSize = 1;
} }
@@ -113,7 +113,7 @@ QVariantList PixmapCacheModel::labels() const
QVariantMap PixmapCacheModel::details(int index) const QVariantMap PixmapCacheModel::details(int index) const
{ {
QVariantMap result; QVariantMap result;
const PixmapCacheEvent *ev = &m_data[index]; const PixmapCacheItem *ev = &m_data[index];
if (ev->pixmapEventType == PixmapCacheCountChanged) { if (ev->pixmapEventType == PixmapCacheCountChanged) {
result.insert(QLatin1String("displayName"), tr("Image Cached")); result.insert(QLatin1String("displayName"), tr("Image Cached"));
@@ -180,7 +180,7 @@ void PixmapCacheModel::loadData()
if (!accepted(type)) if (!accepted(type))
continue; continue;
PixmapCacheEvent newEvent; PixmapCacheItem newEvent;
newEvent.pixmapEventType = static_cast<PixmapEventType>(type.detailType); newEvent.pixmapEventType = static_cast<PixmapEventType>(type.detailType);
qint64 pixmapStartTime = event.startTime(); qint64 pixmapStartTime = event.startTime();
@@ -425,7 +425,7 @@ void PixmapCacheModel::clear()
void PixmapCacheModel::computeMaxCacheSize() void PixmapCacheModel::computeMaxCacheSize()
{ {
m_maxCacheSize = 1; m_maxCacheSize = 1;
foreach (const PixmapCacheModel::PixmapCacheEvent &event, m_data) { foreach (const PixmapCacheModel::PixmapCacheItem &event, m_data) {
if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) { if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) {
if (event.cacheSize > m_maxCacheSize) if (event.cacheSize > m_maxCacheSize)
m_maxCacheSize = event.cacheSize; m_maxCacheSize = event.cacheSize;
@@ -451,7 +451,7 @@ void PixmapCacheModel::flattenLoads()
// computes "compressed row" // computes "compressed row"
QVector <qint64> eventEndTimes; QVector <qint64> eventEndTimes;
for (int i = 0; i < count(); i++) { for (int i = 0; i < count(); i++) {
PixmapCacheModel::PixmapCacheEvent &event = m_data[i]; PixmapCacheModel::PixmapCacheItem &event = m_data[i];
if (event.pixmapEventType == PixmapCacheModel::PixmapLoadingStarted) { if (event.pixmapEventType == PixmapCacheModel::PixmapLoadingStarted) {
event.rowNumberCollapsed = 0; event.rowNumberCollapsed = 0;
while (eventEndTimes.count() > event.rowNumberCollapsed && while (eventEndTimes.count() > event.rowNumberCollapsed &&
@@ -475,7 +475,7 @@ void PixmapCacheModel::flattenLoads()
} }
int PixmapCacheModel::updateCacheCount(int lastCacheSizeEvent, 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.pixmapEventType = PixmapCacheCountChanged;
newEvent.rowNumberCollapsed = 1; newEvent.rowNumberCollapsed = 1;

View File

@@ -82,7 +82,7 @@ public:
MaximumPixmapEventType MaximumPixmapEventType
}; };
struct PixmapCacheEvent { struct PixmapCacheItem {
int typeId; int typeId;
PixmapEventType pixmapEventType; PixmapEventType pixmapEventType;
int urlIndex; int urlIndex;
@@ -114,9 +114,9 @@ private:
void resizeUnfinishedLoads(); void resizeUnfinishedLoads();
void flattenLoads(); void flattenLoads();
int updateCacheCount(int lastCacheSizeEvent, qint64 startTime, qint64 pixSize, int updateCacheCount(int lastCacheSizeEvent, qint64 startTime, qint64 pixSize,
PixmapCacheEvent &newEvent, int typeId); PixmapCacheItem &newEvent, int typeId);
QVector<PixmapCacheEvent> m_data; QVector<PixmapCacheItem> m_data;
QVector<Pixmap> m_pixmaps; QVector<Pixmap> m_pixmaps;
qint64 m_maxCacheSize; qint64 m_maxCacheSize;

View File

@@ -59,19 +59,19 @@ ScrollView {
width: parent.width width: parent.width
height: depth * itemHeight height: depth * itemHeight
model: flameGraphModel model: flameGraphModel
sizeRole: FlameGraphModel.Duration sizeRole: FlameGraphModel.DurationRole
sizeThreshold: 0.002 sizeThreshold: 0.002
y: flickable.height > height ? flickable.height - height : 0 y: flickable.height > height ? flickable.height - height : 0
delegate: Item { delegate: Item {
id: flamegraphItem 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 bool isBindingLoop: parent.checkBindingLoop(typeId)
property int level: parent.level + (rangeTypeVisible ? 1 : 0) property int level: parent.level + (rangeTypeVisible ? 1 : 0)
property bool isSelected: typeId !== -1 && typeId === root.selectedTypeId property bool isSelected: typeId !== -1 && typeId === root.selectedTypeId
property bool rangeTypeVisible: root.visibleRangeTypes & property bool rangeTypeVisible:
(1 << FlameGraph.data(FlameGraphModel.RangeType)) root.visibleRangeTypes & (1 << FlameGraph.data(FlameGraphModel.RangeTypeRole))
onIsSelectedChanged: { onIsSelectedChanged: {
if (isSelected && (tooltip.selectedNode === null || if (isSelected && (tooltip.selectedNode === null ||
@@ -93,8 +93,8 @@ ScrollView {
// Functions, not properties to limit the initial overhead when creating the nodes, // Functions, not properties to limit the initial overhead when creating the nodes,
// and because FlameGraph.data(...) cannot be notified anyway. // and because FlameGraph.data(...) cannot be notified anyway.
function title() { return FlameGraph.data(FlameGraphModel.Type) || ""; } function title() { return FlameGraph.data(FlameGraphModel.TypeRole) || ""; }
function note() { return FlameGraph.data(FlameGraphModel.Note) || ""; } function note() { return FlameGraph.data(FlameGraphModel.NoteRole) || ""; }
function details() { function details() {
var model = []; var model = [];
function addDetail(name, index, format) { function addDetail(name, index, format) {
@@ -128,14 +128,14 @@ ScrollView {
model.push(qsTr("Details")); model.push(qsTr("Details"));
model.push(qsTr("Various Events")); model.push(qsTr("Various Events"));
} else { } else {
addDetail(qsTr("Details"), FlameGraphModel.Details, noop); addDetail(qsTr("Details"), FlameGraphModel.DetailsRole, noop);
addDetail(qsTr("Type"), FlameGraphModel.Type, noop); addDetail(qsTr("Type"), FlameGraphModel.TypeRole, noop);
addDetail(qsTr("Calls"), FlameGraphModel.CallCount, noop); addDetail(qsTr("Calls"), FlameGraphModel.CallCountRole, noop);
addDetail(qsTr("Total Time"), FlameGraphModel.Duration, printTime); addDetail(qsTr("Total Time"), FlameGraphModel.DurationRole, printTime);
addDetail(qsTr("Mean Time"), FlameGraphModel.TimePerCall, printTime); addDetail(qsTr("Mean Time"), FlameGraphModel.TimePerCallRole, printTime);
addDetail(qsTr("In Percent"), FlameGraphModel.TimeInPercent, addDetail(qsTr("In Percent"), FlameGraphModel.TimeInPercentRole,
addPercent); addPercent);
addDetail(qsTr("Location"), FlameGraphModel.Location, noop); addDetail(qsTr("Location"), FlameGraphModel.LocationRole, noop);
} }
return model; return model;
} }
@@ -184,9 +184,12 @@ ScrollView {
if (!flamegraphItem.FlameGraph.dataValid) if (!flamegraphItem.FlameGraph.dataValid)
return "<others>"; return "<others>";
return flamegraphItem.FlameGraph.data(FlameGraphModel.Details) + " (" + return flamegraphItem.FlameGraph.data(FlameGraphModel.DetailsRole)
flamegraphItem.FlameGraph.data(FlameGraphModel.Type) + ", " + + " ("
flamegraphItem.FlameGraph.data(FlameGraphModel.TimeInPercent) + "%)"; + flamegraphItem.FlameGraph.data(FlameGraphModel.TypeRole)
+ ", "
+ flamegraphItem.FlameGraph.data(
FlameGraphModel.TimeInPercentRole) + "%)";
} }
} }
@@ -206,12 +209,15 @@ ScrollView {
onClicked: { onClicked: {
if (flamegraphItem.FlameGraph.dataValid) { if (flamegraphItem.FlameGraph.dataValid) {
tooltip.selectedNode = flamegraphItem; tooltip.selectedNode = flamegraphItem;
root.typeSelected( root.typeSelected(flamegraphItem.FlameGraph.data(
flamegraphItem.FlameGraph.data(FlameGraphModel.TypeId)); FlameGraphModel.TypeIdRole));
root.gotoSourceLocation( root.gotoSourceLocation(
flamegraphItem.FlameGraph.data(FlameGraphModel.Filename), flamegraphItem.FlameGraph.data(
flamegraphItem.FlameGraph.data(FlameGraphModel.Line), FlameGraphModel.FilenameRole),
flamegraphItem.FlameGraph.data(FlameGraphModel.Column)); flamegraphItem.FlameGraph.data(
FlameGraphModel.LineRole),
flamegraphItem.FlameGraph.data(
FlameGraphModel.ColumnRole));
} }
} }
} }

View File

@@ -35,6 +35,7 @@ SOURCES += \
qmlprofilerstatisticsview.cpp \ qmlprofilerstatisticsview.cpp \
qmlprofilertimelinemodel.cpp \ qmlprofilertimelinemodel.cpp \
qmlprofilertool.cpp \ qmlprofilertool.cpp \
qmlprofilertraceclient.cpp \
qmlprofilertracefile.cpp \ qmlprofilertracefile.cpp \
qmlprofilertraceview.cpp \ qmlprofilertraceview.cpp \
qmlprofilerviewmanager.cpp \ qmlprofilerviewmanager.cpp \
@@ -58,7 +59,9 @@ HEADERS += \
qmlprofilerconstants.h \ qmlprofilerconstants.h \
qmlprofilerdatamodel.h \ qmlprofilerdatamodel.h \
qmlprofilerdetailsrewriter.h \ qmlprofilerdetailsrewriter.h \
qmlprofilereventlocation.h \
qmlprofilereventsview.h \ qmlprofilereventsview.h \
qmlprofilereventtypes.h \
qmlprofilermodelmanager.h \ qmlprofilermodelmanager.h \
qmlprofilernotesmodel.h \ qmlprofilernotesmodel.h \
qmlprofileroptionspage.h \ qmlprofileroptionspage.h \
@@ -74,6 +77,7 @@ HEADERS += \
qmlprofilerstatisticsview.h \ qmlprofilerstatisticsview.h \
qmlprofilertimelinemodel.h \ qmlprofilertimelinemodel.h \
qmlprofilertool.h \ qmlprofilertool.h \
qmlprofilertraceclient.h \
qmlprofilertracefile.h \ qmlprofilertracefile.h \
qmlprofilertraceview.h \ qmlprofilertraceview.h \
qmlprofilerviewmanager.h \ qmlprofilerviewmanager.h \

View File

@@ -36,7 +36,9 @@ QtcPlugin {
"qmlprofilerconfigwidget.ui", "qmlprofilerconstants.h", "qmlprofilerconfigwidget.ui", "qmlprofilerconstants.h",
"qmlprofilerdatamodel.cpp", "qmlprofilerdatamodel.h", "qmlprofilerdatamodel.cpp", "qmlprofilerdatamodel.h",
"qmlprofilerdetailsrewriter.cpp", "qmlprofilerdetailsrewriter.h", "qmlprofilerdetailsrewriter.cpp", "qmlprofilerdetailsrewriter.h",
"qmlprofilereventlocation.h",
"qmlprofilereventsview.h", "qmlprofilereventsview.h",
"qmlprofilereventtypes.h",
"qmlprofilermodelmanager.cpp", "qmlprofilermodelmanager.h", "qmlprofilermodelmanager.cpp", "qmlprofilermodelmanager.h",
"qmlprofilernotesmodel.cpp", "qmlprofilernotesmodel.h", "qmlprofilernotesmodel.cpp", "qmlprofilernotesmodel.h",
"qmlprofileroptionspage.cpp", "qmlprofileroptionspage.h", "qmlprofileroptionspage.cpp", "qmlprofileroptionspage.h",
@@ -52,6 +54,7 @@ QtcPlugin {
"qmlprofilerstatisticsview.cpp", "qmlprofilerstatisticsview.h", "qmlprofilerstatisticsview.cpp", "qmlprofilerstatisticsview.h",
"qmlprofilertimelinemodel.cpp", "qmlprofilertimelinemodel.h", "qmlprofilertimelinemodel.cpp", "qmlprofilertimelinemodel.h",
"qmlprofilertool.cpp", "qmlprofilertool.h", "qmlprofilertool.cpp", "qmlprofilertool.h",
"qmlprofilertraceclient.cpp", "qmlprofilertraceclient.h",
"qmlprofilertracefile.cpp", "qmlprofilertracefile.h", "qmlprofilertracefile.cpp", "qmlprofilertracefile.h",
"qmlprofilertraceview.cpp", "qmlprofilertraceview.h", "qmlprofilertraceview.cpp", "qmlprofilertraceview.h",
"qmlprofilerviewmanager.cpp", "qmlprofilerviewmanager.h", "qmlprofilerviewmanager.cpp", "qmlprofilerviewmanager.h",

View File

@@ -42,8 +42,7 @@ namespace Internal {
QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager, QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager,
QObject *parent) : QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::Event, QmlDebug::MaximumRangeType, QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileAnimations, parent)
QmlDebug::ProfileAnimations, parent)
{ {
m_maxGuiThreadAnimations = m_maxRenderThreadAnimations = 0; m_maxGuiThreadAnimations = m_maxRenderThreadAnimations = 0;
} }
@@ -57,8 +56,7 @@ void QmlProfilerAnimationsModel::clear()
bool QmlProfilerAnimationsModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const bool QmlProfilerAnimationsModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
{ {
return QmlProfilerTimelineModel::accepted(event) && return QmlProfilerTimelineModel::accepted(event) && event.detailType == AnimationFrame;
event.detailType== QmlDebug::AnimationFrame;
} }
void QmlProfilerAnimationsModel::loadData() void QmlProfilerAnimationsModel::loadData()
@@ -71,7 +69,7 @@ void QmlProfilerAnimationsModel::loadData()
const QVector<QmlProfilerDataModel::QmlEventData> &referenceList = simpleModel->getEvents(); const QVector<QmlProfilerDataModel::QmlEventData> &referenceList = simpleModel->getEvents();
const QVector<QmlProfilerDataModel::QmlEventTypeData> &typeList = simpleModel->getEventTypes(); const QVector<QmlProfilerDataModel::QmlEventTypeData> &typeList = simpleModel->getEventTypes();
QmlDebug::AnimationThread lastThread; AnimationThread lastThread;
QmlPaintEventData lastEvent; QmlPaintEventData lastEvent;
qint64 minNextStartTimes[] = {0, 0}; qint64 minNextStartTimes[] = {0, 0};
@@ -80,7 +78,7 @@ void QmlProfilerAnimationsModel::loadData()
if (!accepted(type)) if (!accepted(type))
continue; continue;
lastThread = (QmlDebug::AnimationThread)event.numericData(2); lastThread = (AnimationThread)event.numericData(2);
// initial estimation of the event duration: 1/framerate // initial estimation of the event duration: 1/framerate
qint64 estimatedDuration = event.numericData(0) > 0 ? 1e9/event.numericData(0) : 1; 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); m_data.insert(insert(realStartTime, realEndTime - realStartTime, lastThread), lastEvent);
if (lastThread == QmlDebug::GuiThread) if (lastThread == GuiThread)
m_maxGuiThreadAnimations = qMax(lastEvent.animationcount, m_maxGuiThreadAnimations); m_maxGuiThreadAnimations = qMax(lastEvent.animationcount, m_maxGuiThreadAnimations);
else else
m_maxRenderThreadAnimations = qMax(lastEvent.animationcount, m_maxRenderThreadAnimations = qMax(lastEvent.animationcount,
@@ -124,7 +122,7 @@ void QmlProfilerAnimationsModel::loadData()
int QmlProfilerAnimationsModel::rowFromThreadId(int threadId) const 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 int QmlProfilerAnimationsModel::rowMaxValue(int rowNumber) const
@@ -166,7 +164,7 @@ QColor QmlProfilerAnimationsModel::color(int index) const
float QmlProfilerAnimationsModel::relativeHeight(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_maxGuiThreadAnimations :
m_maxRenderThreadAnimations); m_maxRenderThreadAnimations);
} }
@@ -179,7 +177,7 @@ QVariantList QmlProfilerAnimationsModel::labels() const
QVariantMap element; QVariantMap element;
element.insert(QLatin1String("displayName"), QVariant(tr("Animations"))); element.insert(QLatin1String("displayName"), QVariant(tr("Animations")));
element.insert(QLatin1String("description"), QVariant(tr("GUI Thread"))); element.insert(QLatin1String("description"), QVariant(tr("GUI Thread")));
element.insert(QLatin1String("id"), QVariant(QmlDebug::GuiThread)); element.insert(QLatin1String("id"), QVariant(GuiThread));
result << element; result << element;
} }
@@ -187,7 +185,7 @@ QVariantList QmlProfilerAnimationsModel::labels() const
QVariantMap element; QVariantMap element;
element.insert(QLatin1String("displayName"), QVariant(tr("Animations"))); element.insert(QLatin1String("displayName"), QVariant(tr("Animations")));
element.insert(QLatin1String("description"), QVariant(tr("Render Thread"))); element.insert(QLatin1String("description"), QVariant(tr("Render Thread")));
element.insert(QLatin1String("id"), QVariant(QmlDebug::RenderThread)); element.insert(QLatin1String("id"), QVariant(RenderThread));
result << element; result << element;
} }
@@ -202,8 +200,8 @@ QVariantMap QmlProfilerAnimationsModel::details(int index) const
result.insert(tr("Duration"), QmlProfilerDataModel::formatTime(duration(index))); result.insert(tr("Duration"), QmlProfilerDataModel::formatTime(duration(index)));
result.insert(tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate)); 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("Animations"), QString::fromLatin1("%1").arg(m_data[index].animationcount));
result.insert(tr("Context"), tr(selectionId(index) == QmlDebug::GuiThread ? "GUI Thread" : result.insert(tr("Context"), tr(selectionId(index) == GuiThread ? "GUI Thread" :
"Render Thread")); "Render Thread"));
return result; return result;
} }

View File

@@ -25,17 +25,14 @@
#pragma once #pragma once
#include <QObject>
#include "qmlprofilertimelinemodel.h" #include "qmlprofilertimelinemodel.h"
#include <qmldebug/qmlprofilereventtypes.h> #include "qmlprofilereventtypes.h"
#include <qmldebug/qmlprofilereventlocation.h> #include "qmlprofilereventlocation.h"
//#include <QHash>
//#include <QVector>
#include <QVariantList>
//#include <QVariantMap>
#include "qmlprofilerdatamodel.h" #include "qmlprofilerdatamodel.h"
#include <QColor>
#include <QVariantList>
#include <QColor>
#include <QObject>
namespace QmlProfiler { namespace QmlProfiler {
class QmlProfilerModelManager; class QmlProfilerModelManager;

View File

@@ -26,16 +26,14 @@
#include "qmlprofilerclientmanager.h" #include "qmlprofilerclientmanager.h"
#include "qmlprofilertool.h" #include "qmlprofilertool.h"
#include "qmlprofilerplugin.h" #include "qmlprofilerplugin.h"
#include "qmlprofilertraceclient.h"
#include <qmldebug/qmlprofilertraceclient.h> #include "qmlprofilermodelmanager.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QPointer> #include <QPointer>
#include <QTimer> #include <QTimer>
#include <QMessageBox> #include <QMessageBox>
#include "qmlprofilermodelmanager.h"
using namespace QmlDebug; using namespace QmlDebug;
using namespace Core; using namespace Core;

View File

@@ -26,7 +26,7 @@
#pragma once #pragma once
#include "qmlprofilerstatemanager.h" #include "qmlprofilerstatemanager.h"
#include <qmldebug/qmlprofilereventlocation.h> #include "qmlprofilereventlocation.h"
#include <utils/port.h> #include <utils/port.h>
#include <QObject> #include <QObject>

View File

@@ -27,8 +27,8 @@
#include "qmlprofilermodelmanager.h" #include "qmlprofilermodelmanager.h"
#include "qmlprofilernotesmodel.h" #include "qmlprofilernotesmodel.h"
#include "qmlprofilerdetailsrewriter.h" #include "qmlprofilerdetailsrewriter.h"
#include "qmlprofilereventtypes.h"
#include <qmldebug/qmlprofilereventtypes.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QUrl> #include <QUrl>
#include <QDebug> #include <QDebug>
@@ -68,7 +68,7 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event)
details = event.data; details = event.data;
details = details.replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified(); details = details.replace(QLatin1Char('\n'),QLatin1Char(' ')).simplified();
if (details.isEmpty()) { if (details.isEmpty()) {
if (event.rangeType == QmlDebug::Javascript) if (event.rangeType == Javascript)
details = QmlProfilerDataModel::tr("anonymous function"); details = QmlProfilerDataModel::tr("anonymous function");
} else { } else {
QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)")); QRegExp rewrite(QLatin1String("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)"));
@@ -79,7 +79,7 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event)
details.startsWith(QLatin1String("qrc:/"))) details.startsWith(QLatin1String("qrc:/")))
details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1); 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. // QtQuick1 animations always run in GUI thread.
details = QmlProfilerDataModel::tr("GUI Thread"); details = QmlProfilerDataModel::tr("GUI Thread");
} }
@@ -231,7 +231,7 @@ void QmlProfilerDataModel::processData()
// request further details from files // request further details from files
// //
if (event->rangeType != QmlDebug::Binding && event->rangeType != QmlDebug::HandlingSignal) if (event->rangeType != Binding && event->rangeType != HandlingSignal)
continue; continue;
// This skips anonymous bindings in Qt4.8 (we don't have valid location data for them) // 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(); emit requestReload();
} }
void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, void QmlProfilerDataModel::addQmlEvent(Message message, RangeType rangeType, int detailType,
int detailType, qint64 startTime, qint64 startTime, qint64 duration, const QString &data,
qint64 duration, const QString &data, const QmlEventLocation &location, qint64 ndata1,
const QmlDebug::QmlEventLocation &location, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5)
qint64 ndata1, qint64 ndata2, qint64 ndata3,
qint64 ndata4, qint64 ndata5)
{ {
Q_D(QmlProfilerDataModel); Q_D(QmlProfilerDataModel);
QString displayName; QString displayName;
QmlEventTypeData typeData(displayName, location, message, rangeType, detailType, QmlEventTypeData typeData(displayName, location, message, rangeType, detailType,
message == QmlDebug::DebugMessage ? QString() : data); message == DebugMessage ? QString() : data);
QmlEventData eventData = (message == QmlDebug::DebugMessage) ? QmlEventData eventData = (message == DebugMessage) ?
QmlEventData(startTime, duration, -1, data) : QmlEventData(startTime, duration, -1, data) :
QmlEventData(startTime, duration, -1, ndata1, ndata2, ndata3, ndata4, ndata5); QmlEventData(startTime, duration, -1, ndata1, ndata2, ndata3, ndata4, ndata5);

View File

@@ -26,8 +26,9 @@
#pragma once #pragma once
#include "qmlprofilermodelmanager.h" #include "qmlprofilermodelmanager.h"
#include "qmlprofilereventtypes.h"
#include "qmlprofilereventlocation.h"
#include <qmldebug/qmlprofilereventtypes.h>
#include <utils/fileinprojectfinder.h> #include <utils/fileinprojectfinder.h>
namespace QmlProfiler { namespace QmlProfiler {
@@ -38,18 +39,17 @@ class QMLPROFILER_EXPORT QmlProfilerDataModel : public QObject
public: public:
struct QmlEventTypeData { struct QmlEventTypeData {
QmlEventTypeData(const QString &displayName = QString(), QmlEventTypeData(const QString &displayName = QString(),
const QmlDebug::QmlEventLocation &location = QmlDebug::QmlEventLocation(), const QmlEventLocation &location = QmlEventLocation(),
QmlDebug::Message message = QmlDebug::MaximumMessage, Message message = MaximumMessage, RangeType rangeType = MaximumRangeType,
QmlDebug::RangeType rangeType = QmlDebug::MaximumRangeType,
int detailType = -1, const QString &data = QString()) : int detailType = -1, const QString &data = QString()) :
displayName(displayName), location(location), message(message), rangeType(rangeType), displayName(displayName), location(location), message(message), rangeType(rangeType),
detailType(detailType), data(data) detailType(detailType), data(data)
{} {}
QString displayName; QString displayName;
QmlDebug::QmlEventLocation location; QmlEventLocation location;
QmlDebug::Message message; Message message;
QmlDebug::RangeType rangeType; RangeType rangeType;
int detailType; // can be EventType, BindingType, PixmapEventType or SceneGraphFrameType int detailType; // can be EventType, BindingType, PixmapEventType or SceneGraphFrameType
QString data; QString data;
}; };
@@ -215,9 +215,9 @@ public:
int count() const; int count() const;
void clear(); void clear();
bool isEmpty() const; 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, 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 ndata3, qint64 ndata4, qint64 ndata5);
qint64 lastTimeMark() const; qint64 lastTimeMark() const;

View File

@@ -35,7 +35,7 @@ namespace QmlProfiler {
namespace Internal { namespace Internal {
struct PendingEvent { struct PendingEvent {
QmlDebug::QmlEventLocation location; QmlEventLocation location;
QString localFile; QString localFile;
int requestId; int requestId;
}; };
@@ -118,7 +118,7 @@ QmlProfilerDetailsRewriter::~QmlProfilerDetailsRewriter()
} }
void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId, void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId,
const QmlDebug::QmlEventLocation &location) const QmlEventLocation &location)
{ {
QString localFile; QString localFile;
if (!d->m_filesCache.contains(location.filename)) { if (!d->m_filesCache.contains(location.filename)) {
@@ -157,7 +157,7 @@ void QmlProfilerDetailsRewriter::reloadDocuments()
} }
void QmlProfilerDetailsRewriter::rewriteDetailsForLocation(QTextStream &textDoc, 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; PropertyVisitor propertyVisitor;
QmlJS::AST::Node *node = propertyVisitor(doc->ast(), location.line, location.column); QmlJS::AST::Node *node = propertyVisitor(doc->ast(), location.line, location.column);

View File

@@ -25,12 +25,13 @@
#pragma once #pragma once
#include <QObject> #include "qmlprofilereventlocation.h"
#include <qmldebug/qmlprofilereventlocation.h>
#include <qmljs/qmljsdocument.h> #include <qmljs/qmljsdocument.h>
#include <utils/fileinprojectfinder.h> #include <utils/fileinprojectfinder.h>
#include <QObject>
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
@@ -45,10 +46,10 @@ public:
private: private:
void rewriteDetailsForLocation(QTextStream &textDoc, QmlJS::Document::Ptr doc, int requestId, void rewriteDetailsForLocation(QTextStream &textDoc, QmlJS::Document::Ptr doc, int requestId,
const QmlDebug::QmlEventLocation &location); const QmlEventLocation &location);
public slots: public slots:
void requestDetailsForLocation(int requestId, const QmlDebug::QmlEventLocation &location); void requestDetailsForLocation(int requestId, const QmlEventLocation &location);
void reloadDocuments(); void reloadDocuments();
void documentReady(QmlJS::Document::Ptr doc); void documentReady(QmlJS::Document::Ptr doc);
signals: signals:

View File

@@ -25,16 +25,18 @@
#pragma once #pragma once
#include "qmldebug_global.h" #include "qmlprofiler_global.h"
#include <QString> #include <QString>
namespace QmlDebug { namespace QmlProfiler {
struct QMLDEBUG_EXPORT QmlEventLocation struct QMLPROFILER_EXPORT QmlEventLocation
{ {
QmlEventLocation() : line(-1),column(-1) {} 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; QString filename;
int line; int line;
int column; int column;

View File

@@ -27,7 +27,7 @@
#include <QtGlobal> #include <QtGlobal>
namespace QmlDebug { namespace QmlProfiler {
enum Message { enum Message {
Event, Event,
@@ -179,4 +179,4 @@ const quint64 QML_JS_RANGE_FEATURES = (1 << ProfileCompiling) |
(1 << ProfileJavaScript); (1 << ProfileJavaScript);
} }
} // namespace QmlDebug } // namespace QmlProfiler

View File

@@ -55,7 +55,7 @@ static const char *ProfileFeatureNames[] = {
QT_TRANSLATE_NOOP("MainView", "Debug Messages") 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) : 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]; return ProfileFeatureNames[feature];
} }
void QmlProfilerModelManager::addQmlEvent(QmlDebug::Message message, void QmlProfilerModelManager::addQmlEvent(Message message, RangeType rangeType, int detailType,
QmlDebug::RangeType rangeType, qint64 startTime, qint64 length, const QString &data,
int detailType, const QmlEventLocation &location, qint64 ndata1,
qint64 startTime, qint64 ndata2, qint64 ndata3, qint64 ndata4,
qint64 length,
const QString &data,
const QmlDebug::QmlEventLocation &location,
qint64 ndata1,
qint64 ndata2,
qint64 ndata3,
qint64 ndata4,
qint64 ndata5) qint64 ndata5)
{ {
// If trace start time was not explicitly set, use the first event // 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, void QmlProfilerModelManager::addDebugMessage(QtMsgType type, qint64 timestamp, const QString &text,
const QmlDebug::QmlEventLocation &location) const QmlEventLocation &location)
{ {
if (state() == AcquiringData) if (state() == AcquiringData)
d->model->addQmlEvent(QmlDebug::DebugMessage, QmlDebug::MaximumRangeType, type, timestamp, d->model->addQmlEvent(DebugMessage, MaximumRangeType, type, timestamp, 0, text, location, 0,
0, text, location, 0, 0, 0, 0, 0); 0, 0, 0, 0);
} }
void QmlProfilerModelManager::acquiringDone() void QmlProfilerModelManager::acquiringDone()

View File

@@ -26,9 +26,9 @@
#pragma once #pragma once
#include "qmlprofiler_global.h" #include "qmlprofiler_global.h"
#include "qmlprofilereventtypes.h"
#include "qmlprofilereventlocation.h"
#include <qmldebug/qmlprofilereventlocation.h>
#include <qmldebug/qmlprofilereventtypes.h>
#include <utils/fileinprojectfinder.h> #include <utils/fileinprojectfinder.h>
#include <QObject> #include <QObject>
@@ -107,7 +107,7 @@ public:
void acquiringDone(); void acquiringDone();
void processingDone(); void processingDone();
static const char *featureName(QmlDebug::ProfileFeature feature); static const char *featureName(ProfileFeature feature);
signals: signals:
void error(const QString &error); void error(const QString &error);
@@ -116,7 +116,7 @@ signals:
void loadFinished(); void loadFinished();
void saveFinished(); void saveFinished();
void requestDetailsForLocation(int eventType, const QmlDebug::QmlEventLocation &location); void requestDetailsForLocation(int eventType, const QmlEventLocation &location);
void availableFeaturesChanged(quint64 features); void availableFeaturesChanged(quint64 features);
void visibleFeaturesChanged(quint64 features); void visibleFeaturesChanged(quint64 features);
void recordedFeaturesChanged(quint64 features); void recordedFeaturesChanged(quint64 features);
@@ -125,12 +125,11 @@ public slots:
void clear(); void clear();
void prepareForWriting(); void prepareForWriting();
void addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, int bindingType, void addQmlEvent(Message message, RangeType rangeType, int bindingType, qint64 startTime,
qint64 startTime, qint64 length, const QString &data, qint64 length, const QString &data, const QmlEventLocation &location,
const QmlDebug::QmlEventLocation &location,
qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5); qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5);
void addDebugMessage(QtMsgType type, qint64 timestamp, const QString &text, void addDebugMessage(QtMsgType type, qint64 timestamp, const QString &text,
const QmlDebug::QmlEventLocation &location); const QmlEventLocation &location);
void save(const QString &filename); void save(const QString &filename);
void load(const QString &filename); void load(const QString &filename);

View File

@@ -44,10 +44,9 @@ namespace QmlProfiler {
namespace Internal { namespace Internal {
QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range,
QmlDebug::RangeType range, QObject *parent) : QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::MaximumMessage, range, QmlProfilerTimelineModel(manager, MaximumMessage, range, featureFromRangeType(range), parent)
QmlDebug::featureFromRangeType(range), parent)
{ {
m_expandedRowTypes << -1; m_expandedRowTypes << -1;
} }
@@ -62,7 +61,7 @@ void QmlProfilerRangeModel::clear()
bool QmlProfilerRangeModel::supportsBindingLoops() const bool QmlProfilerRangeModel::supportsBindingLoops() const
{ {
return rangeType() == QmlDebug::Binding || rangeType() == QmlDebug::HandlingSignal; return rangeType() == Binding || rangeType() == HandlingSignal;
} }
void QmlProfilerRangeModel::loadData() void QmlProfilerRangeModel::loadData()
@@ -113,7 +112,7 @@ void QmlProfilerRangeModel::computeNestingContracted()
int i; int i;
int eventCount = count(); int eventCount = count();
int nestingLevels = QmlDebug::Constants::QML_MIN_LEVEL; int nestingLevels = Constants::QML_MIN_LEVEL;
int collapsedRowCount = nestingLevels + 1; int collapsedRowCount = nestingLevels + 1;
QVector<qint64> nestingEndTimes; QVector<qint64> nestingEndTimes;
nestingEndTimes.fill(0, nestingLevels + 1); nestingEndTimes.fill(0, nestingLevels + 1);
@@ -128,7 +127,7 @@ void QmlProfilerRangeModel::computeNestingContracted()
if (nestingLevels == collapsedRowCount) if (nestingLevels == collapsedRowCount)
++collapsedRowCount; ++collapsedRowCount;
} else { } else {
while (nestingLevels > QmlDebug::Constants::QML_MIN_LEVEL && while (nestingLevels > Constants::QML_MIN_LEVEL &&
nestingEndTimes[nestingLevels-1] <= st) nestingEndTimes[nestingLevels-1] <= st)
nestingLevels--; nestingLevels--;
} }

View File

@@ -26,10 +26,11 @@
#pragma once #pragma once
#include "qmlprofilertimelinemodel.h" #include "qmlprofilertimelinemodel.h"
#include <qmldebug/qmlprofilereventtypes.h>
#include <qmldebug/qmlprofilereventlocation.h>
#include <QVariantList>
#include "qmlprofilerdatamodel.h" #include "qmlprofilerdatamodel.h"
#include "qmlprofilereventtypes.h"
#include "qmlprofilereventlocation.h"
#include <QVariantList>
#include <QColor> #include <QColor>
namespace QmlProfiler { namespace QmlProfiler {
@@ -44,8 +45,8 @@ public:
struct QmlRangeEventStartInstance { struct QmlRangeEventStartInstance {
QmlRangeEventStartInstance() : QmlRangeEventStartInstance() :
displayRowExpanded(QmlDebug::Constants::QML_MIN_LEVEL), displayRowExpanded(Constants::QML_MIN_LEVEL),
displayRowCollapsed(QmlDebug::Constants::QML_MIN_LEVEL), displayRowCollapsed(Constants::QML_MIN_LEVEL),
bindingLoopHead(-1) {} bindingLoopHead(-1) {}
// not-expanded, per type // not-expanded, per type
@@ -54,8 +55,7 @@ public:
int bindingLoopHead; int bindingLoopHead;
}; };
QmlProfilerRangeModel(QmlProfilerModelManager *manager, QmlDebug::RangeType range, QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range, QObject *parent = 0);
QObject *parent = 0);
Q_INVOKABLE int expandedRow(int index) const; Q_INVOKABLE int expandedRow(int index) const;
Q_INVOKABLE int collapsedRow(int index) const; Q_INVOKABLE int collapsedRow(int index) const;

View File

@@ -54,7 +54,7 @@ public:
int modelId; int modelId;
QList<QmlDebug::RangeType> acceptedTypes; QList<RangeType> acceptedTypes;
QSet<int> eventsInBindingLoop; QSet<int> eventsInBindingLoop;
QHash<int, QString> notes; QHash<int, QString> notes;
}; };
@@ -73,9 +73,9 @@ QmlProfilerStatisticsModel::QmlProfilerStatisticsModel(QmlProfilerModelManager *
// We're iterating twice in loadData. // We're iterating twice in loadData.
modelManager->setProxyCountWeight(d->modelId, 2); 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() QmlProfilerStatisticsModel::~QmlProfilerStatisticsModel()
@@ -83,7 +83,7 @@ QmlProfilerStatisticsModel::~QmlProfilerStatisticsModel()
delete d; delete d;
} }
void QmlProfilerStatisticsModel::setEventTypeAccepted(QmlDebug::RangeType type, bool accepted) void QmlProfilerStatisticsModel::setEventTypeAccepted(RangeType type, bool accepted)
{ {
if (accepted && !d->acceptedTypes.contains(type)) if (accepted && !d->acceptedTypes.contains(type))
d->acceptedTypes << type; d->acceptedTypes << type;
@@ -91,7 +91,7 @@ void QmlProfilerStatisticsModel::setEventTypeAccepted(QmlDebug::RangeType type,
d->acceptedTypes.removeOne(type); d->acceptedTypes.removeOne(type);
} }
bool QmlProfilerStatisticsModel::eventTypeAccepted(QmlDebug::RangeType type) const bool QmlProfilerStatisticsModel::eventTypeAccepted(RangeType type) const
{ {
return d->acceptedTypes.contains(type); return d->acceptedTypes.contains(type);
} }
@@ -357,7 +357,7 @@ void QmlProfilerStatisticsParentsModel::loadData()
// for level computation // for level computation
QHash<int, qint64> endtimesPerLevel; QHash<int, qint64> endtimesPerLevel;
int level = QmlDebug::Constants::QML_MIN_LEVEL; int level = Constants::QML_MIN_LEVEL;
endtimesPerLevel[0] = 0; endtimesPerLevel[0] = 0;
const QSet<int> &eventsInBindingLoop = m_statisticsModel->eventsInBindingLoop(); const QSet<int> &eventsInBindingLoop = m_statisticsModel->eventsInBindingLoop();
@@ -375,14 +375,14 @@ void QmlProfilerStatisticsParentsModel::loadData()
if (endtimesPerLevel[level] > event.startTime()) { if (endtimesPerLevel[level] > event.startTime()) {
level++; level++;
} else { } else {
while (level > QmlDebug::Constants::QML_MIN_LEVEL && while (level > Constants::QML_MIN_LEVEL &&
endtimesPerLevel[level-1] <= event.startTime()) endtimesPerLevel[level-1] <= event.startTime())
level--; level--;
} }
endtimesPerLevel[level] = event.startTime() + event.duration(); endtimesPerLevel[level] = event.startTime() + event.duration();
int parentTypeIndex = -1; 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]; parentTypeIndex = lastParent[level-1];
QmlStatisticsRelativesMap &relativesMap = m_data[event.typeIndex()]; QmlStatisticsRelativesMap &relativesMap = m_data[event.typeIndex()];
@@ -419,7 +419,7 @@ void QmlProfilerStatisticsChildrenModel::loadData()
// for level computation // for level computation
QHash<int, qint64> endtimesPerLevel; QHash<int, qint64> endtimesPerLevel;
int level = QmlDebug::Constants::QML_MIN_LEVEL; int level = Constants::QML_MIN_LEVEL;
endtimesPerLevel[0] = 0; endtimesPerLevel[0] = 0;
const QSet<int> &eventsInBindingLoop = m_statisticsModel->eventsInBindingLoop(); const QSet<int> &eventsInBindingLoop = m_statisticsModel->eventsInBindingLoop();
@@ -437,7 +437,7 @@ void QmlProfilerStatisticsChildrenModel::loadData()
if (endtimesPerLevel[level] > event.startTime()) { if (endtimesPerLevel[level] > event.startTime()) {
level++; level++;
} else { } else {
while (level > QmlDebug::Constants::QML_MIN_LEVEL && while (level > Constants::QML_MIN_LEVEL &&
endtimesPerLevel[level-1] <= event.startTime()) endtimesPerLevel[level-1] <= event.startTime())
level--; level--;
} }
@@ -445,7 +445,7 @@ void QmlProfilerStatisticsChildrenModel::loadData()
int parentId = -1; 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]; parentId = lastParent[level-1];
QmlStatisticsRelativesMap &relativesMap = m_data[parentId]; QmlStatisticsRelativesMap &relativesMap = m_data[parentId];

View File

@@ -27,11 +27,12 @@
#include "qmlprofilerdatamodel.h" #include "qmlprofilerdatamodel.h"
#include "qmlprofilernotesmodel.h" #include "qmlprofilernotesmodel.h"
#include <QObject> #include "qmlprofilereventtypes.h"
#include <qmldebug/qmlprofilereventtypes.h> #include "qmlprofilereventlocation.h"
#include <qmldebug/qmlprofilereventlocation.h>
#include <QHash> #include <QHash>
#include <QVector> #include <QVector>
#include <QObject>
namespace QmlProfiler { namespace QmlProfiler {
class QmlProfilerModelManager; class QmlProfilerModelManager;
@@ -60,8 +61,8 @@ public:
QmlProfilerStatisticsModel(QmlProfilerModelManager *modelManager, QObject *parent = 0); QmlProfilerStatisticsModel(QmlProfilerModelManager *modelManager, QObject *parent = 0);
~QmlProfilerStatisticsModel(); ~QmlProfilerStatisticsModel();
void setEventTypeAccepted(QmlDebug::RangeType type, bool accepted); void setEventTypeAccepted(RangeType type, bool accepted);
bool eventTypeAccepted(QmlDebug::RangeType) const; bool eventTypeAccepted(RangeType) const;
const QHash<int, QmlEventStats> &getData() const; const QHash<int, QmlEventStats> &getData() const;
const QVector<QmlProfilerDataModel::QmlEventTypeData> &getTypes() const; const QVector<QmlProfilerDataModel::QmlEventTypeData> &getTypes() const;
@@ -136,7 +137,6 @@ public:
QmlProfilerStatisticsParentsModel(QmlProfilerModelManager *modelManager, QmlProfilerStatisticsParentsModel(QmlProfilerModelManager *modelManager,
QmlProfilerStatisticsModel *statisticsModel, QmlProfilerStatisticsModel *statisticsModel,
QObject *parent = 0); QObject *parent = 0);
protected: protected:
virtual void loadData(); virtual void loadData();
}; };

View File

@@ -48,8 +48,6 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <functional> #include <functional>
using namespace QmlDebug;
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
@@ -335,7 +333,7 @@ void QmlProfilerStatisticsView::onVisibleFeaturesChanged(quint64 features)
for (int i = 0; i < MaximumRangeType; ++i) { for (int i = 0; i < MaximumRangeType; ++i) {
RangeType range = static_cast<RangeType>(i); RangeType range = static_cast<RangeType>(i);
quint64 featureFlag = 1ULL << featureFromRangeType(range); 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->setEventTypeAccepted(range, features & featureFlag);
} }
d->model->limitToRange(d->rangeStart, d->rangeEnd); d->model->limitToRange(d->rangeStart, d->rangeEnd);

View File

@@ -29,8 +29,8 @@
#include "qmlprofilerstatisticsmodel.h" #include "qmlprofilerstatisticsmodel.h"
#include "qmlprofilerviewmanager.h" #include "qmlprofilerviewmanager.h"
#include "qmlprofilereventsview.h" #include "qmlprofilereventsview.h"
#include "qmlprofilereventtypes.h"
#include <qmldebug/qmlprofilereventtypes.h>
#include <debugger/analyzer/analyzermanager.h> #include <debugger/analyzer/analyzermanager.h>
#include <utils/itemviews.h> #include <utils/itemviews.h>
@@ -116,7 +116,7 @@ public:
void copyTableToClipboard() const; void copyTableToClipboard() const;
void copyRowToClipboard() const; void copyRowToClipboard() const;
static QString nameForType(QmlDebug::RangeType typeNumber); static QString nameForType(RangeType typeNumber);
int selectedTypeId() const; int selectedTypeId() const;

View File

@@ -28,10 +28,8 @@
namespace QmlProfiler { namespace QmlProfiler {
QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager,
QmlDebug::Message message, Message message, RangeType rangeType,
QmlDebug::RangeType rangeType, ProfileFeature mainFeature, QObject *parent) :
QmlDebug::ProfileFeature mainFeature,
QObject *parent) :
TimelineModel(modelManager->registerModelProxy(), parent), TimelineModel(modelManager->registerModelProxy(), parent),
m_message(message), m_rangeType(rangeType), m_mainFeature(mainFeature), m_message(message), m_rangeType(rangeType), m_mainFeature(mainFeature),
m_modelManager(modelManager) m_modelManager(modelManager)
@@ -44,17 +42,17 @@ QmlProfilerTimelineModel::QmlProfilerTimelineModel(QmlProfilerModelManager *mode
announceFeatures(1ULL << m_mainFeature); announceFeatures(1ULL << m_mainFeature);
} }
QmlDebug::RangeType QmlProfilerTimelineModel::rangeType() const RangeType QmlProfilerTimelineModel::rangeType() const
{ {
return m_rangeType; return m_rangeType;
} }
QmlDebug::Message QmlProfilerTimelineModel::message() const Message QmlProfilerTimelineModel::message() const
{ {
return m_message; return m_message;
} }
QmlDebug::ProfileFeature QmlProfilerTimelineModel::mainFeature() const ProfileFeature QmlProfilerTimelineModel::mainFeature() const
{ {
return m_mainFeature; return m_mainFeature;
} }
@@ -133,7 +131,7 @@ QVariantMap QmlProfilerTimelineModel::locationFromTypeId(int index) const
if (id >= types.length()) if (id >= types.length())
return result; 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("file"), location.filename);
result.insert(QStringLiteral("line"), location.line); result.insert(QStringLiteral("line"), location.line);

View File

@@ -34,20 +34,19 @@ namespace QmlProfiler {
class QMLPROFILER_EXPORT QmlProfilerTimelineModel : public Timeline::TimelineModel { class QMLPROFILER_EXPORT QmlProfilerTimelineModel : public Timeline::TimelineModel {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QmlDebug::RangeType rangeType READ rangeType CONSTANT) Q_PROPERTY(RangeType rangeType READ rangeType CONSTANT)
Q_PROPERTY(QmlDebug::Message message READ message CONSTANT) Q_PROPERTY(Message message READ message CONSTANT)
Q_PROPERTY(QmlProfilerModelManager *modelManager READ modelManager CONSTANT) Q_PROPERTY(QmlProfilerModelManager *modelManager READ modelManager CONSTANT)
public: public:
QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, QmlProfilerTimelineModel(QmlProfilerModelManager *modelManager, Message message,
QmlDebug::Message message, QmlDebug::RangeType rangeType, RangeType rangeType, ProfileFeature mainFeature, QObject *parent);
QmlDebug::ProfileFeature mainFeature, QObject *parent);
QmlProfilerModelManager *modelManager() const; QmlProfilerModelManager *modelManager() const;
QmlDebug::RangeType rangeType() const; RangeType rangeType() const;
QmlDebug::Message message() const; Message message() const;
QmlDebug::ProfileFeature mainFeature() const; ProfileFeature mainFeature() const;
virtual bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const; virtual bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
bool handlesTypeId(int typeId) const; bool handlesTypeId(int typeId) const;
@@ -66,9 +65,9 @@ protected:
void announceFeatures(quint64 features) const; void announceFeatures(quint64 features) const;
private: private:
const QmlDebug::Message m_message; const Message m_message;
const QmlDebug::RangeType m_rangeType; const RangeType m_rangeType;
const QmlDebug::ProfileFeature m_mainFeature; const ProfileFeature m_mainFeature;
QmlProfilerModelManager *const m_modelManager; QmlProfilerModelManager *const m_modelManager;
}; };

View File

@@ -86,7 +86,6 @@ using namespace Core::Constants;
using namespace Debugger; using namespace Debugger;
using namespace Debugger::Constants; using namespace Debugger::Constants;
using namespace QmlProfiler::Constants; using namespace QmlProfiler::Constants;
using namespace QmlDebug;
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace QmlProfiler { namespace QmlProfiler {

View File

@@ -27,7 +27,7 @@
#include "qmlprofiler_global.h" #include "qmlprofiler_global.h"
#include "qmlprofilerconstants.h" #include "qmlprofilerconstants.h"
#include "qmldebug/qmlprofilereventtypes.h" #include "qmlprofilereventtypes.h"
#include <debugger/analyzer/analyzermanager.h> #include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h> #include <debugger/analyzer/analyzerruncontrol.h>
@@ -98,7 +98,7 @@ private:
void updateRunActions(); void updateRunActions();
void clearDisplay(); void clearDisplay();
void populateFileFinder(QString projectDirectory = QString(), QString activeSysroot = QString()); void populateFileFinder(QString projectDirectory = QString(), QString activeSysroot = QString());
template<QmlDebug::ProfileFeature feature> template<ProfileFeature feature>
void updateFeatures(quint64 features); void updateFeatures(quint64 features);
bool checkForUnsavedNotes(); bool checkForUnsavedNotes();
void restoreFeatureVisibility(); void restoreFeatureVisibility();

View File

@@ -24,15 +24,15 @@
****************************************************************************/ ****************************************************************************/
#include "qmlprofilertraceclient.h" #include "qmlprofilertraceclient.h"
#include "qmlenginecontrolclient.h" #include <qmldebug/qmlenginecontrolclient.h>
#include "qdebugmessageclient.h" #include <qmldebug/qdebugmessageclient.h>
#include "qpacketprotocol.h" #include <qmldebug/qpacketprotocol.h>
namespace QmlDebug { namespace QmlProfiler {
class QmlProfilerTraceClientPrivate { class QmlProfilerTraceClientPrivate {
public: public:
QmlProfilerTraceClientPrivate(QmlProfilerTraceClient *_q, QmlDebugConnection *client) QmlProfilerTraceClientPrivate(QmlProfilerTraceClient *_q, QmlDebug::QmlDebugConnection *client)
: q(_q) : q(_q)
, engineControl(client) , engineControl(client)
, inProgressRanges(0) , inProgressRanges(0)
@@ -46,11 +46,11 @@ public:
} }
void sendRecordingStatus(int engineId); void sendRecordingStatus(int engineId);
bool updateFeatures(QmlDebug::ProfileFeature feature); bool updateFeatures(ProfileFeature feature);
QmlProfilerTraceClient *q; QmlProfilerTraceClient *q;
QmlEngineControlClient engineControl; QmlDebug::QmlEngineControlClient engineControl;
QScopedPointer<QDebugMessageClient> messageClient; QScopedPointer<QmlDebug::QDebugMessageClient> messageClient;
qint64 inProgressRanges; qint64 inProgressRanges;
QStack<qint64> rangeStartTimes[MaximumRangeType]; QStack<qint64> rangeStartTimes[MaximumRangeType];
QStack<QString> rangeDatas[MaximumRangeType]; QStack<QString> rangeDatas[MaximumRangeType];
@@ -64,25 +64,26 @@ public:
quint32 flushInterval; quint32 flushInterval;
}; };
} // namespace QmlDebug } // namespace QmlProfiler
using namespace QmlDebug; using namespace QmlProfiler;
void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId) 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" stream << recording << engineId; // engineId -1 is OK. It means "all of them"
if (recording) if (recording)
stream << requestedFeatures << flushInterval; stream << requestedFeatures << flushInterval;
q->sendMessage(stream.data()); q->sendMessage(stream.data());
} }
QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features) QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client,
quint64 features)
: QmlDebugClient(QLatin1String("CanvasFrameRate"), client) : QmlDebugClient(QLatin1String("CanvasFrameRate"), client)
, d(new QmlProfilerTraceClientPrivate(this, client)) , d(new QmlProfilerTraceClientPrivate(this, client))
{ {
setRequestedFeatures(features); setRequestedFeatures(features);
connect(&d->engineControl, &QmlEngineControlClient::engineAboutToBeAdded, connect(&d->engineControl, &QmlDebug::QmlEngineControlClient::engineAboutToBeAdded,
this, &QmlProfilerTraceClient::newEngine); this, &QmlProfilerTraceClient::newEngine);
} }
@@ -143,13 +144,14 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features)
{ {
d->requestedFeatures = features; d->requestedFeatures = features;
if (features & static_cast<quint64>(1) << ProfileDebugMessages) { if (features & static_cast<quint64>(1) << ProfileDebugMessages) {
d->messageClient.reset(new QDebugMessageClient(connection())); d->messageClient.reset(new QmlDebug::QDebugMessageClient(connection()));
connect(d->messageClient.data(), &QDebugMessageClient::message, this, [this](QtMsgType type, connect(d->messageClient.data(), &QmlDebug::QDebugMessageClient::message, this,
const QString &text, const QmlDebug::QDebugContextInfo &context) [this](QtMsgType type, const QString &text,
const QmlDebug::QDebugContextInfo &context)
{ {
d->updateFeatures(ProfileDebugMessages); d->updateFeatures(ProfileDebugMessages);
emit debugMessage(type, context.timestamp, text, emit debugMessage(type, context.timestamp, text,
QmlDebug::QmlEventLocation(context.file, context.line, 1)); QmlEventLocation(context.file, context.line, 1));
}); });
} else { } else {
d->messageClient.reset(); d->messageClient.reset();
@@ -189,7 +191,7 @@ void QmlProfilerTraceClient::stateChanged(State status)
void QmlProfilerTraceClient::messageReceived(const QByteArray &data) void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
{ {
QPacket stream(connection()->currentDataStreamVersion(), data); QmlDebug::QPacket stream(connection()->currentDataStreamVersion(), data);
qint64 time; qint64 time;
int messageType; int messageType;

View File

@@ -25,15 +25,16 @@
#pragma once #pragma once
#include "qmldebugclient.h"
#include "qmlprofilereventtypes.h" #include "qmlprofilereventtypes.h"
#include "qmlprofilereventlocation.h" #include "qmlprofilereventlocation.h"
#include "qmldebug_global.h" #include "qmlprofiler_global.h"
#include <qmldebug/qmldebugclient.h>
#include <QStack> #include <QStack>
#include <QStringList> #include <QStringList>
namespace QmlDebug { namespace QmlProfiler {
class QMLDEBUG_EXPORT QmlProfilerTraceClient : public QmlDebug::QmlDebugClient class QMLDEBUG_EXPORT QmlProfilerTraceClient : public QmlDebug::QmlDebugClient
{ {
@@ -44,7 +45,7 @@ class QMLDEBUG_EXPORT QmlProfilerTraceClient : public QmlDebug::QmlDebugClient
using QObject::event; using QObject::event;
public: public:
QmlProfilerTraceClient(QmlDebugConnection *client, quint64 features); QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client, quint64 features);
~QmlProfilerTraceClient(); ~QmlProfilerTraceClient();
bool isRecording() const; bool isRecording() const;
@@ -61,12 +62,11 @@ signals:
void complete(qint64 maximumTime); void complete(qint64 maximumTime);
void traceFinished(qint64 time, const QList<int> &engineIds); void traceFinished(qint64 time, const QList<int> &engineIds);
void traceStarted(qint64 time, const QList<int> &engineIds); void traceStarted(qint64 time, const QList<int> &engineIds);
void rangedEvent(QmlDebug::Message, QmlDebug::RangeType, int detailType, qint64 startTime, void rangedEvent(Message, RangeType, int detailType, qint64 startTime, qint64 length,
qint64 length, const QString &data, const QString &data, const QmlEventLocation &location, qint64 param1,
const QmlDebug::QmlEventLocation &location, qint64 param1, qint64 param2, qint64 param2, qint64 param3, qint64 param4, qint64 param5);
qint64 param3, qint64 param4, qint64 param5);
void debugMessage(QtMsgType type, qint64 timestamp, const QString &text, void debugMessage(QtMsgType type, qint64 timestamp, const QString &text,
const QmlDebug::QmlEventLocation &location); const QmlEventLocation &location);
void recordingChanged(bool arg); void recordingChanged(bool arg);
void recordedFeaturesChanged(quint64 features); void recordedFeaturesChanged(quint64 features);
void newEngine(int engineId); void newEngine(int engineId);
@@ -84,4 +84,4 @@ private:
class QmlProfilerTraceClientPrivate *d; class QmlProfilerTraceClientPrivate *d;
}; };
} // namespace QmlDebug } // namespace QmlProfiler

View File

@@ -25,6 +25,7 @@
#include "qmlprofilertracefile.h" #include "qmlprofilertracefile.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QIODevice> #include <QIODevice>
@@ -33,9 +34,8 @@
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <QDebug> #include <QDebug>
// import QmlEventType, QmlBindingType enums, QmlEventLocation namespace QmlProfiler {
using namespace QmlDebug; namespace Internal {
const char PROFILER_FILE_VERSION[] = "1.02"; const char PROFILER_FILE_VERSION[] = "1.02";
@@ -48,7 +48,7 @@ static const char *RANGE_TYPE_STRINGS[] = {
"Javascript" "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[] = { static const char *MESSAGE_STRINGS[] = {
// So far only pixmap and scenegraph are used. The others are padding. // So far only pixmap and scenegraph are used. The others are padding.
@@ -64,7 +64,7 @@ static const char *MESSAGE_STRINGS[] = {
"DebugMessage" "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) #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" // "be strict in your output but tolerant in your inputs"
// //
namespace QmlProfiler {
namespace Internal {
static QPair<Message, RangeType> qmlTypeAsEnum(const QString &typeString) static QPair<Message, RangeType> qmlTypeAsEnum(const QString &typeString)
{ {
QPair<Message, RangeType> ret(MaximumMessage, MaximumRangeType); QPair<Message, RangeType> ret(MaximumMessage, MaximumRangeType);
@@ -195,7 +192,7 @@ quint64 QmlProfilerFileReader::loadedFeatures() const
return m_loadedFeatures; return m_loadedFeatures;
} }
QmlDebug::ProfileFeature featureFromEvent(const QmlProfilerDataModel::QmlEventTypeData &event) { ProfileFeature featureFromEvent(const QmlProfilerDataModel::QmlEventTypeData &event) {
if (event.rangeType < MaximumRangeType) if (event.rangeType < MaximumRangeType)
return featureFromRangeType(event.rangeType); return featureFromRangeType(event.rangeType);

View File

@@ -25,16 +25,15 @@
#pragma once #pragma once
#include "qmlprofilereventlocation.h"
#include "qmlprofilereventtypes.h"
#include "qmlprofilerdatamodel.h"
#include <QFutureInterface> #include <QFutureInterface>
#include <QObject> #include <QObject>
#include <QVector> #include <QVector>
#include <QString> #include <QString>
#include <qmldebug/qmlprofilereventlocation.h>
#include <qmldebug/qmlprofilereventtypes.h>
#include "qmlprofilerdatamodel.h"
QT_FORWARD_DECLARE_CLASS(QIODevice) QT_FORWARD_DECLARE_CLASS(QIODevice)
QT_FORWARD_DECLARE_CLASS(QXmlStreamReader) QT_FORWARD_DECLARE_CLASS(QXmlStreamReader)

View File

@@ -68,8 +68,6 @@
#include <math.h> #include <math.h>
using namespace QmlDebug;
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {

View File

@@ -25,7 +25,7 @@
#include "scenegraphtimelinemodel.h" #include "scenegraphtimelinemodel.h"
#include "qmlprofilermodelmanager.h" #include "qmlprofilermodelmanager.h"
#include "qmldebug/qmlprofilereventtypes.h" #include "qmlprofilereventtypes.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
@@ -75,8 +75,7 @@ Q_STATIC_ASSERT(sizeof(StageLabels) ==
SceneGraphTimelineModel::SceneGraphTimelineModel(QmlProfilerModelManager *manager, SceneGraphTimelineModel::SceneGraphTimelineModel(QmlProfilerModelManager *manager,
QObject *parent) : QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::SceneGraphFrame, QmlDebug::MaximumRangeType, QmlProfilerTimelineModel(manager, SceneGraphFrame, MaximumRangeType, ProfileSceneGraph, parent)
QmlDebug::ProfileSceneGraph, parent)
{ {
} }
@@ -145,8 +144,8 @@ void SceneGraphTimelineModel::loadData()
if (!accepted(type)) if (!accepted(type))
continue; continue;
switch ((QmlDebug::SceneGraphFrameType)type.detailType) { switch ((SceneGraphFrameType)type.detailType) {
case QmlDebug::SceneGraphRendererFrame: { case SceneGraphRendererFrame: {
// Breakdown of render times. We repeat "render" here as "net" render time. It would // 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 // 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 // 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); insert(startTime, event.numericData(3), event.typeIndex(), RenderRender);
break; break;
} }
case QmlDebug::SceneGraphAdaptationLayerFrame: { case SceneGraphAdaptationLayerFrame: {
qint64 startTime = event.startTime() - event.numericData(1) - event.numericData(2); qint64 startTime = event.startTime() - event.numericData(1) - event.numericData(2);
startTime += insert(startTime, event.numericData(1), event.typeIndex(), GlyphRender, startTime += insert(startTime, event.numericData(1), event.typeIndex(), GlyphRender,
event.numericData(0)); event.numericData(0));
insert(startTime, event.numericData(2), event.typeIndex(), GlyphStore, event.numericData(0)); insert(startTime, event.numericData(2), event.typeIndex(), GlyphStore, event.numericData(0));
break; break;
} }
case QmlDebug::SceneGraphContextFrame: { case SceneGraphContextFrame: {
insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(),
Material); Material);
break; break;
} }
case QmlDebug::SceneGraphRenderLoopFrame: { case SceneGraphRenderLoopFrame: {
qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) - qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) -
event.numericData(2); event.numericData(2);
startTime += insert(startTime, event.numericData(0), event.typeIndex(), startTime += insert(startTime, event.numericData(0), event.typeIndex(),
@@ -181,7 +180,7 @@ void SceneGraphTimelineModel::loadData()
insert(startTime, event.numericData(2), event.typeIndex(), Swap); insert(startTime, event.numericData(2), event.typeIndex(), Swap);
break; break;
} }
case QmlDebug::SceneGraphTexturePrepare: { case SceneGraphTexturePrepare: {
qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) - qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) -
event.numericData(2) - event.numericData(3) - event.numericData(4); event.numericData(2) - event.numericData(3) - event.numericData(4);
startTime += insert(startTime, event.numericData(0), event.typeIndex(), TextureBind); startTime += insert(startTime, event.numericData(0), event.typeIndex(), TextureBind);
@@ -191,12 +190,12 @@ void SceneGraphTimelineModel::loadData()
insert(startTime, event.numericData(4), event.typeIndex(), TextureMipmap); insert(startTime, event.numericData(4), event.typeIndex(), TextureMipmap);
break; break;
} }
case QmlDebug::SceneGraphTextureDeletion: { case SceneGraphTextureDeletion: {
insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(),
TextureDeletion); TextureDeletion);
break; break;
} }
case QmlDebug::SceneGraphPolishAndSync: { case SceneGraphPolishAndSync: {
qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) - qint64 startTime = event.startTime() - event.numericData(0) - event.numericData(1) -
event.numericData(2) - event.numericData(3); event.numericData(2) - event.numericData(3);
@@ -206,13 +205,13 @@ void SceneGraphTimelineModel::loadData()
insert(startTime, event.numericData(3), event.typeIndex(), Animations); insert(startTime, event.numericData(3), event.typeIndex(), Animations);
break; break;
} }
case QmlDebug::SceneGraphWindowsAnimations: { case SceneGraphWindowsAnimations: {
// GUI thread, separate animations stage // GUI thread, separate animations stage
insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(),
Animations); Animations);
break; break;
} }
case QmlDebug::SceneGraphPolishFrame: { case SceneGraphPolishFrame: {
// GUI thread, separate polish stage // GUI thread, separate polish stage
insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(), insert(event.startTime() - event.numericData(0), event.numericData(0), event.typeIndex(),
Polish); Polish);