Commit 600e1cdc authored by Ulf Hermann's avatar Ulf Hermann

Merge QmlProfiler and QmlProfilerExtension plugins

Change-Id: Iaa1de7afda664a7a0779f47d104f863a16a34976
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
parent ac2005b4
......@@ -6,7 +6,6 @@ SUBDIRS = \
autotest \
clangstaticanalyzer \
coreplugin \
qmlprofilerextension \
texteditor \
cppeditor \
bineditor \
......
......@@ -49,7 +49,6 @@ Project {
"qmljseditor/qmljseditor.qbs",
"qmljstools/qmljstools.qbs",
"qmlprofiler/qmlprofiler.qbs",
"qmlprofilerextension/qmlprofilerextension.qbs",
"qmlprojectmanager/qmlprojectmanager.qbs",
"qnx/qnx.qbs",
"qmakeprojectmanager/qmakeprojectmanager.qbs",
......
......@@ -25,9 +25,7 @@
#include "debugmessagesmodel.h"
using namespace QmlProfiler;
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
bool DebugMessagesModel::accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
......@@ -138,5 +136,5 @@ QVariantMap DebugMessagesModel::location(int index) const
return locationFromTypeId(index);
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -25,20 +25,20 @@
#pragma once
#include "qmlprofiler/qmlprofilertimelinemodel.h"
#include "qmlprofilertimelinemodel.h"
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
class DebugMessagesModel : public QmlProfiler::QmlProfilerTimelineModel
class DebugMessagesModel : public QmlProfilerTimelineModel
{
Q_OBJECT
protected:
bool accepted(const QmlProfiler::QmlProfilerDataModel::QmlEventTypeData &event) const override;
bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const override;
public:
DebugMessagesModel(QmlProfiler::QmlProfilerModelManager *manager, QObject *parent = 0);
DebugMessagesModel(QmlProfilerModelManager *manager, QObject *parent = 0);
int typeId(int index) const override;
QColor color(int index) const override;
......@@ -64,5 +64,5 @@ private:
QVector<MessageData> m_data;
};
}
}
} // namespace Internal
} // namespace Qmlprofiler
......@@ -25,7 +25,7 @@
#include "flamegraph.h"
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
FlameGraph::FlameGraph(QQuickItem *parent) :
......@@ -178,5 +178,5 @@ QVariant FlameGraphAttached::data(int role) const
return m_data.isValid() ? m_data.data(role) : QVariant();
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -28,7 +28,7 @@
#include <QQuickItem>
#include <QAbstractItemModel>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
class FlameGraphAttached : public QObject
......@@ -151,7 +151,7 @@ private:
const QModelIndex &childIndex, qreal position, qreal size);
};
}
}
} // namespace Internal
} // namespace QmlProfiler
QML_DECLARE_TYPEINFO(QmlProfilerExtension::Internal::FlameGraph, QML_HAS_ATTACHED_PROPERTIES)
QML_DECLARE_TYPEINFO(QmlProfiler::Internal::FlameGraph, QML_HAS_ATTACHED_PROPERTIES)
......@@ -37,14 +37,14 @@
#include <QQueue>
#include <QSet>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
FlameGraphModel::FlameGraphModel(QmlProfiler::QmlProfilerModelManager *modelManager,
FlameGraphModel::FlameGraphModel(QmlProfilerModelManager *modelManager,
QObject *parent) : QAbstractItemModel(parent)
{
m_modelManager = modelManager;
connect(modelManager->qmlModel(), &QmlProfiler::QmlProfilerDataModel::changed,
connect(modelManager->qmlModel(), &QmlProfilerDataModel::changed,
this, [this](){loadData();});
connect(modelManager->notesModel(), &Timeline::TimelineNotesModel::changed,
this, [this](int typeId, int, int){loadNotes(typeId, true);});
......@@ -103,33 +103,33 @@ void FlameGraphModel::loadNotes(int typeIndex, bool emitSignal)
void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd)
{
const bool checkRanges = (rangeStart != -1) && (rangeEnd != -1);
if (m_modelManager->state() == QmlProfiler::QmlProfilerModelManager::ClearingData) {
if (m_modelManager->state() == QmlProfilerModelManager::ClearingData) {
beginResetModel();
clear();
endResetModel();
return;
} else if (m_modelManager->state() != QmlProfiler::QmlProfilerModelManager::ProcessingData &&
m_modelManager->state() != QmlProfiler::QmlProfilerModelManager::Done) {
} else if (m_modelManager->state() != QmlProfilerModelManager::ProcessingData &&
m_modelManager->state() != QmlProfilerModelManager::Done) {
return;
}
beginResetModel();
clear();
const QVector<QmlProfiler::QmlProfilerDataModel::QmlEventData> &eventList
const QVector<QmlProfilerDataModel::QmlEventData> &eventList
= m_modelManager->qmlModel()->getEvents();
const QVector<QmlProfiler::QmlProfilerDataModel::QmlEventTypeData> &typesList
const QVector<QmlProfilerDataModel::QmlEventTypeData> &typesList
= m_modelManager->qmlModel()->getEventTypes();
// used by binding loop detection
QStack<const QmlProfiler::QmlProfilerDataModel::QmlEventData *> callStack;
QStack<const QmlProfilerDataModel::QmlEventData *> callStack;
callStack.append(0);
FlameGraphData *stackTop = &m_stackBottom;
for (int i = 0; i < eventList.size(); ++i) {
const QmlProfiler::QmlProfilerDataModel::QmlEventData *event = &eventList[i];
const QmlProfilerDataModel::QmlEventData *event = &eventList[i];
int typeIndex = event->typeIndex();
const QmlProfiler::QmlProfilerDataModel::QmlEventTypeData *type = &typesList[typeIndex];
const QmlProfilerDataModel::QmlEventTypeData *type = &typesList[typeIndex];
if (!m_acceptedTypes.contains(type->rangeType))
continue;
......@@ -140,7 +140,7 @@ void FlameGraphModel::loadData(qint64 rangeStart, qint64 rangeEnd)
continue;
}
const QmlProfiler::QmlProfilerDataModel::QmlEventData *potentialParent = callStack.top();
const QmlProfilerDataModel::QmlEventData *potentialParent = callStack.top();
while (potentialParent &&
potentialParent->startTime() + potentialParent->duration() <= event->startTime()) {
callStack.pop();
......@@ -184,7 +184,7 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
QString ret;
if (!m_typeIdsWithNotes.contains(stats.typeIndex))
return ret;
QmlProfiler::QmlProfilerNotesModel *notes = m_modelManager->notesModel();
QmlProfilerNotesModel *notes = m_modelManager->notesModel();
foreach (const QVariant &item, notes->byTypeId(stats.typeIndex)) {
if (ret.isEmpty())
ret = notes->text(item.toInt());
......@@ -201,9 +201,9 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
}
if (stats.typeIndex != -1) {
const QVector<QmlProfiler::QmlProfilerDataModel::QmlEventTypeData> &typeList =
const QVector<QmlProfilerDataModel::QmlEventTypeData> &typeList =
m_modelManager->qmlModel()->getEventTypes();
const QmlProfiler::QmlProfilerDataModel::QmlEventTypeData &type = typeList[stats.typeIndex];
const QmlProfilerDataModel::QmlEventTypeData &type = typeList[stats.typeIndex];
switch (role) {
case Filename: return type.location.filename;
......@@ -230,7 +230,7 @@ FlameGraphData::~FlameGraphData()
}
FlameGraphData *FlameGraphModel::pushChild(
FlameGraphData *parent, const QmlProfiler::QmlProfilerDataModel::QmlEventData *data)
FlameGraphData *parent, const QmlProfilerDataModel::QmlEventData *data)
{
foreach (FlameGraphData *child, parent->children) {
if (child->typeIndex == data->typeIndex()) {
......@@ -306,4 +306,4 @@ QHash<int, QByteArray> FlameGraphModel::roleNames() const
}
} // namespace Internal
} // namespace QmlProfilerExtension
} // namespace QmlProfiler
......@@ -34,7 +34,7 @@
#include <QVector>
#include <QAbstractItemModel>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
struct FlameGraphData {
......@@ -71,7 +71,7 @@ public:
MaxRole
};
FlameGraphModel(QmlProfiler::QmlProfilerModelManager *modelManager, QObject *parent = 0);
FlameGraphModel(QmlProfilerModelManager *modelManager, QObject *parent = 0);
void setEventTypeAccepted(QmlDebug::RangeType type, bool accepted);
bool eventTypeAccepted(QmlDebug::RangeType) const;
......@@ -95,17 +95,17 @@ private:
QVariant lookup(const FlameGraphData &data, int role) const;
void clear();
FlameGraphData *pushChild(FlameGraphData *parent,
const QmlProfiler::QmlProfilerDataModel::QmlEventData *data);
const QmlProfilerDataModel::QmlEventData *data);
int m_selectedTypeIndex;
FlameGraphData m_stackBottom;
int m_modelId;
QmlProfiler::QmlProfilerModelManager *m_modelManager;
QmlProfilerModelManager *m_modelManager;
QList<QmlDebug::RangeType> m_acceptedTypes;
QSet<int> m_typeIdsWithNotes;
};
} // namespace Internal
} // namespace QmlprofilerExtension
} // namespace QmlProfiler
......@@ -33,10 +33,10 @@
#include <QVBoxLayout>
#include <QMenu>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
FlameGraphView::FlameGraphView(QWidget *parent, QmlProfiler::QmlProfilerModelManager *manager) :
FlameGraphView::FlameGraphView(QWidget *parent, QmlProfilerModelManager *manager) :
QmlProfilerEventsView(parent), m_content(new QQuickWidget(this)),
m_model(new FlameGraphModel(manager, this)), m_isRestrictedToRange(false)
{
......@@ -50,7 +50,7 @@ FlameGraphView::FlameGraphView(QWidget *parent, QmlProfiler::QmlProfilerModelMan
QLatin1String("only for Qt 5.4"));
m_content->rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model);
m_content->setSource(QUrl(QStringLiteral("qrc:/FlameGraphView.qml")));
m_content->setSource(QUrl(QStringLiteral("qrc:/qmlprofiler/FlameGraphView.qml")));
m_content->setClearColor(QColor(0xdc, 0xdc, 0xdc));
m_content->setResizeMode(QQuickWidget::SizeRootObjectToView);
......@@ -105,7 +105,7 @@ void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
QPoint position = ev->globalPos();
menu.addActions(QmlProfiler::QmlProfilerTool::profilerContextMenuActions());
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
menu.addSeparator();
getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
if (!isRestrictedToRange())
......@@ -115,5 +115,5 @@ void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
emit showFullRange();
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -26,19 +26,19 @@
#pragma once
#include "flamegraphmodel.h"
#include "qmlprofilereventsview.h"
#include "qmlprofiler/qmlprofilereventsview.h"
#include <QWidget>
#include <QQuickWidget>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
class FlameGraphView : public QmlProfiler::QmlProfilerEventsView
class FlameGraphView : public QmlProfilerEventsView
{
Q_OBJECT
public:
FlameGraphView(QWidget *parent, QmlProfiler::QmlProfilerModelManager *manager);
FlameGraphView(QWidget *parent, QmlProfilerModelManager *manager);
void clear() override;
void restrictToRange(qint64 rangeStart, qint64 rangeEnd) override;
......@@ -57,5 +57,5 @@ private:
bool m_isRestrictedToRange;
};
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -24,18 +24,16 @@
****************************************************************************/
#include "inputeventsmodel.h"
#include "qmlprofilermodelmanager.h"
#include "qmldebug/qmlprofilereventtypes.h"
#include "qmlprofiler/qmlprofilermodelmanager.h"
#include <QKeyEvent>
#include <QMouseEvent>
#include <QMetaEnum>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
using namespace QmlProfiler;
InputEventsModel::InputEventsModel(QmlProfilerModelManager *manager, QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::Event, QmlDebug::MaximumRangeType,
QmlDebug::ProfileInputEvents, parent),
......@@ -190,5 +188,5 @@ InputEventsModel::InputEvent::InputEvent(QmlDebug::InputEventType type, int a, i
{
}
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -25,17 +25,17 @@
#pragma once
#include "qmlprofiler/qmlprofilertimelinemodel.h"
#include "qmlprofilertimelinemodel.h"
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
class InputEventsModel : public QmlProfiler::QmlProfilerTimelineModel
class InputEventsModel : public QmlProfilerTimelineModel
{
Q_OBJECT
protected:
bool accepted(const QmlProfiler::QmlProfilerDataModel::QmlEventTypeData &event) const;
bool accepted(const QmlProfilerDataModel::QmlEventTypeData &event) const;
public:
struct InputEvent {
......@@ -46,7 +46,7 @@ public:
int b;
};
InputEventsModel(QmlProfiler::QmlProfilerModelManager *manager, QObject *parent = 0);
InputEventsModel(QmlProfilerModelManager *manager, QObject *parent = 0);
int typeId(int index) const;
QColor color(int index) const;
......@@ -65,5 +65,5 @@ private:
QVector<InputEvent> m_data;
};
}
}
} // namespace Internal
} // namespace QmlProfiler
......@@ -24,16 +24,14 @@
****************************************************************************/
#include "memoryusagemodel.h"
#include "qmlprofilermodelmanager.h"
#include "qmldebug/qmlprofilereventtypes.h"
#include "qmlprofiler/qmlprofilermodelmanager.h"
#include <QStack>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
using namespace QmlProfiler;
MemoryUsageModel::MemoryUsageModel(QmlProfilerModelManager *manager, QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::MemoryAllocation, QmlDebug::MaximumRangeType,
QmlDebug::ProfileMemory, parent)
......@@ -277,4 +275,4 @@ void MemoryUsageModel::MemoryAllocation::update(qint64 amount)
} // namespace Internal
} // namespace QmlProfilerExtension
} // namespace QmlProfiler
......@@ -25,16 +25,16 @@
#pragma once
#include "qmlprofiler/qmlprofilertimelinemodel.h"
#include "qmlprofiler/qmlprofilerdatamodel.h"
#include "qmlprofilertimelinemodel.h"
#include "qmlprofilerdatamodel.h"
#include <QStringList>
#include <QColor>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
class MemoryUsageModel : public QmlProfiler::QmlProfilerTimelineModel
class MemoryUsageModel : public QmlProfilerTimelineModel
{
Q_OBJECT
public:
......@@ -52,7 +52,7 @@ public:
void update(qint64 amount);
};
MemoryUsageModel(QmlProfiler::QmlProfilerModelManager *manager, QObject *parent = 0);
MemoryUsageModel(QmlProfilerModelManager *manager, QObject *parent = 0);
int rowMaxValue(int rowNumber) const;
......@@ -79,4 +79,4 @@ private:
};
} // namespace Internal
} // namespace QmlProfilerExtension
} // namespace QmlProfiler
......@@ -24,14 +24,12 @@
****************************************************************************/
#include "pixmapcachemodel.h"
#include "qmlprofilermodelmanager.h"
#include "qmldebug/qmlprofilereventtypes.h"
#include "qmlprofiler/qmlprofilermodelmanager.h"
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
using namespace QmlProfiler;
PixmapCacheModel::PixmapCacheModel(QmlProfilerModelManager *manager, QObject *parent) :
QmlProfilerTimelineModel(manager, QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType,
QmlDebug::ProfilePixmapCache, parent)
......@@ -497,4 +495,4 @@ int PixmapCacheModel::updateCacheCount(int lastCacheSizeEvent,
} // namespace Internal
} // namespace QmlProfilerExtension
} // namespace QmlProfiler
......@@ -25,17 +25,17 @@
#pragma once
#include "qmlprofiler/qmlprofilertimelinemodel.h"
#include "qmlprofiler/qmlprofilerdatamodel.h"
#include "qmlprofilertimelinemodel.h"
#include "qmlprofilerdatamodel.h"
#include <QStringList>
#include <QColor>
#include <QSize>
namespace QmlProfilerExtension {
namespace QmlProfiler {
namespace Internal {
class PixmapCacheModel : public QmlProfiler::QmlProfilerTimelineModel
class PixmapCacheModel : public QmlProfilerTimelineModel
{
Q_OBJECT
public:
......@@ -91,7 +91,7 @@ public:
qint64 cacheSize;
};
PixmapCacheModel(QmlProfiler::QmlProfilerModelManager *manager, QObject *parent = 0);
PixmapCacheModel(QmlProfilerModelManager *manager, QObject *parent = 0);
int rowMaxValue(int rowNumber) const;
......@@ -124,4 +124,4 @@ private:
};
} // namespace Internal
} // namespace QmlProfilerExtension
} // namespace QmlProfiler
......@@ -2,5 +2,8 @@
<qresource prefix="/qmlprofiler">
<file>bindingloops.vert</file>
<file>bindingloops.frag</file>
<file>FlameGraphView.qml</file>
<file>FlameGraphText.qml</file>
<file>FlameGraphDetails.qml</file>
</qresource>
</RCC>
......@@ -5,7 +5,14 @@ QT += network qml quick quickwidgets
include(../../qtcreatorplugin.pri)
SOURCES += \
debugmessagesmodel.cpp \
flamegraph.cpp \
flamegraphmodel.cpp \
flamegraphview.cpp \
inputeventsmodel.cpp \
localqmlprofilerrunner.cpp \
memoryusagemodel.cpp \
pixmapcachemodel.cpp \
qmlprofileranimationsmodel.cpp \
qmlprofilerattachdialog.cpp \
qmlprofilerbindingloopsrenderpass.cpp \
......@@ -31,10 +38,18 @@ SOURCES += \
qmlprofilertool.cpp \
qmlprofilertracefile.cpp \
qmlprofilertraceview.cpp \
qmlprofilerviewmanager.cpp
qmlprofilerviewmanager.cpp \
scenegraphtimelinemodel.cpp
HEADERS += \
debugmessagesmodel.h \
flamegraph.h \
flamegraphmodel.h \
flamegraphview.h \
inputeventsmodel.h \
localqmlprofilerrunner.h \
memoryusagemodel.h \
pixmapcachemodel.h \
qmlprofiler_global.h \
qmlprofileranimationsmodel.h \
qmlprofilerattachdialog.h \
......@@ -63,14 +78,11 @@ HEADERS += \
qmlprofilertool.h \
qmlprofilertracefile.h \
qmlprofilertraceview.h \
qmlprofilerviewmanager.h
qmlprofilerviewmanager.h \
scenegraphtimelinemodel.h \
RESOURCES += \
qml/qmlprofiler.qrc
DISTFILES += \
qml/bindingloops.frag \
qml/bindingloops.vert
FORMS += \
qmlprofilerconfigwidget.ui
......@@ -19,7 +19,14 @@ QtcPlugin {
Group {
name: "General"
files: [
"debugmessagesmodel.cpp", "debugmessagesmodel.h",
"flamegraph.cpp", "flamegraph.h",
"flamegraphmodel.cpp", "flamegraphmodel.h",
"flamegraphview.cpp", "flamegraphview.h",
"inputeventsmodel.cpp", "inputeventsmodel.h",
"localqmlprofilerrunner.cpp", "localqmlprofilerrunner.h",
"memoryusagemodel.cpp", "memoryusagemodel.h",
"pixmapcachemodel.cpp", "pixmapcachemodel.h",
"qmlprofiler_global.h",
"qmlprofileranimationsmodel.h", "qmlprofileranimationsmodel.cpp",
"qmlprofilerattachdialog.cpp", "qmlprofilerattachdialog.h",
......@@ -49,6 +56,7 @@ QtcPlugin {
"qmlprofilertracefile.cpp", "qmlprofilertracefile.h",
"qmlprofilertraceview.cpp", "qmlprofilertraceview.h",
"qmlprofilerviewmanager.cpp", "qmlprofilerviewmanager.h",
"scenegraphtimelinemodel.cpp", "scenegraphtimelinemodel.h",
]
}
......
......@@ -56,8 +56,6 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
void QmlProfilerPlugin::extensionsInitialized()
{
factory = ExtensionSystem::PluginManager::getObject<QmlProfilerTimelineModelFactory>();
(void) new QmlProfilerTool(this);
addAutoReleasedObject(new QmlProfilerRunControlFactory());
......@@ -72,14 +70,6 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
return SynchronousShutdown;
}
QList<QmlProfilerTimelineModel *> QmlProfilerPlugin::getModels(QmlProfilerModelManager *manager) const
{
if (factory)
return factory->create(manager);
else
return QList<QmlProfilerTimelineModel *>();
}
QmlProfilerSettings *QmlProfilerPlugin::globalSettings()
{
return qmlProfilerGlobalSettings();
......
......@@ -41,8 +41,6 @@ class QmlProfilerPlugin : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlProfiler.json")
public:
QmlProfilerPlugin() : factory(0) {}
bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized();
ShutdownFlag aboutToShutdown();
......@@ -50,11 +48,7 @@ public:
static bool debugOutput;