forked from qt-creator/qt-creator
QmlProfiler: Remove references to QmlProfilerDataModel
We keep it private to QmlProfilerModelManager and proxy the last few methods that were directly called on the model. This enables us to remove the QmlProfilerDataModel class by integrating what is left of it into QmlProfilerModelManagerPrivate in a next step. Change-Id: Ie9b4e03fb286e5a0040374d00b7b26f810426278 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -76,7 +76,7 @@ QVariantList DebugMessagesModel::labels() const
|
|||||||
QVariantMap DebugMessagesModel::details(int index) const
|
QVariantMap DebugMessagesModel::details(int index) const
|
||||||
{
|
{
|
||||||
const QmlProfilerModelManager *manager = modelManager();
|
const QmlProfilerModelManager *manager = modelManager();
|
||||||
const QmlEventType &type = manager->qmlModel()->eventTypes()[m_data[index].typeId];
|
const QmlEventType &type = manager->eventTypes()[m_data[index].typeId];
|
||||||
|
|
||||||
QVariantMap result;
|
QVariantMap result;
|
||||||
result.insert(QLatin1String("displayName"), messageType(type.detailType()));
|
result.insert(QLatin1String("displayName"), messageType(type.detailType()));
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "flamegraphmodel.h"
|
#include "flamegraphmodel.h"
|
||||||
|
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -186,7 +185,7 @@ QVariant FlameGraphModel::lookup(const FlameGraphData &stats, int role) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stats.typeIndex != -1) {
|
if (stats.typeIndex != -1) {
|
||||||
const QVector<QmlEventType> &typeList = m_modelManager->qmlModel()->eventTypes();
|
const QVector<QmlEventType> &typeList = m_modelManager->eventTypes();
|
||||||
const QmlEventType &type = typeList[stats.typeIndex];
|
const QmlEventType &type = typeList[stats.typeIndex];
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
#include "qmlprofilernotesmodel.h"
|
#include "qmlprofilernotesmodel.h"
|
||||||
#include "qmlprofilereventtypes.h"
|
#include "qmlprofilereventtypes.h"
|
||||||
#include "qmleventlocation.h"
|
#include "qmleventlocation.h"
|
||||||
|
|||||||
@@ -121,8 +121,7 @@ QVariantMap MemoryUsageModel::details(int index) const
|
|||||||
}
|
}
|
||||||
result.insert(tr("Type"), memoryTypeName);
|
result.insert(tr("Type"), memoryTypeName);
|
||||||
|
|
||||||
result.insert(tr("Location"),
|
result.insert(tr("Location"), modelManager()->eventTypes().at(ev->typeId).displayName());
|
||||||
modelManager()->qmlModel()->eventTypes().at(ev->typeId).displayName());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmlprofilertimelinemodel.h"
|
#include "qmlprofilertimelinemodel.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmlprofilertimelinemodel.h"
|
#include "qmlprofilertimelinemodel.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "qmlprofileranimationsmodel.h"
|
#include "qmlprofileranimationsmodel.h"
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <timeline/timelineformattime.h>
|
#include <timeline/timelineformattime.h>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#include "qmlprofilertimelinemodel.h"
|
#include "qmlprofilertimelinemodel.h"
|
||||||
#include "qmlprofilereventtypes.h"
|
#include "qmlprofilereventtypes.h"
|
||||||
#include "qmleventlocation.h"
|
#include "qmleventlocation.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <QVariantList>
|
#include <QVariantList>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
QString getDisplayName(const QmlEventType &event)
|
QString getDisplayName(const QmlEventType &event)
|
||||||
{
|
{
|
||||||
if (event.location().filename().isEmpty()) {
|
if (event.location().filename().isEmpty()) {
|
||||||
return QmlProfilerDataModel::tr("<bytecode>");
|
return QmlProfilerModelManager::tr("<bytecode>");
|
||||||
} else {
|
} else {
|
||||||
const QString filePath = QUrl(event.location().filename()).path();
|
const QString filePath = QUrl(event.location().filename()).path();
|
||||||
return filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1) + QLatin1Char(':') +
|
return filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1) + QLatin1Char(':') +
|
||||||
|
|||||||
@@ -192,11 +192,6 @@ QmlProfilerTraceTime *QmlProfilerModelManager::traceTime() const
|
|||||||
return d->traceTime;
|
return d->traceTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerDataModel *QmlProfilerModelManager::qmlModel() const
|
|
||||||
{
|
|
||||||
return d->model;
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlProfilerNotesModel *QmlProfilerModelManager::notesModel() const
|
QmlProfilerNotesModel *QmlProfilerModelManager::notesModel() const
|
||||||
{
|
{
|
||||||
return d->notesModel;
|
return d->notesModel;
|
||||||
@@ -278,6 +273,17 @@ void QmlProfilerModelManager::addEventType(const QmlEventType &type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QVector<QmlEventType> &QmlProfilerModelManager::eventTypes() const
|
||||||
|
{
|
||||||
|
return d->model->eventTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmlProfilerModelManager::replayEvents(qint64 startTime, qint64 endTime,
|
||||||
|
EventLoader loader) const
|
||||||
|
{
|
||||||
|
return d->model->replayEvents(startTime, endTime, loader);
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerModelManager::QmlProfilerModelManagerPrivate::dispatch(const QmlEvent &event,
|
void QmlProfilerModelManager::QmlProfilerModelManagerPrivate::dispatch(const QmlEvent &event,
|
||||||
const QmlEventType &type)
|
const QmlEventType &type)
|
||||||
{
|
{
|
||||||
@@ -375,6 +381,16 @@ void QmlProfilerModelManager::processingDone()
|
|||||||
setState(Done);
|
setState(Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerModelManager::populateFileFinder(const ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
|
{
|
||||||
|
d->model->populateFileFinder(runConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QmlProfilerModelManager::findLocalFile(const QString &remoteFile)
|
||||||
|
{
|
||||||
|
return d->model->findLocalFile(remoteFile);
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerModelManager::save(const QString &filename)
|
void QmlProfilerModelManager::save(const QString &filename)
|
||||||
{
|
{
|
||||||
QFile *file = new QFile(filename);
|
QFile *file = new QFile(filename);
|
||||||
@@ -390,7 +406,7 @@ void QmlProfilerModelManager::save(const QString &filename)
|
|||||||
QmlProfilerFileWriter *writer = new QmlProfilerFileWriter(this);
|
QmlProfilerFileWriter *writer = new QmlProfilerFileWriter(this);
|
||||||
writer->setTraceTime(traceTime()->startTime(), traceTime()->endTime(),
|
writer->setTraceTime(traceTime()->startTime(), traceTime()->endTime(),
|
||||||
traceTime()->duration());
|
traceTime()->duration());
|
||||||
writer->setData(d->model);
|
writer->setData(this);
|
||||||
writer->setNotes(d->notesModel->notes());
|
writer->setNotes(d->notesModel->notes());
|
||||||
|
|
||||||
connect(writer, &QObject::destroyed, this, &QmlProfilerModelManager::saveFinished,
|
connect(writer, &QObject::destroyed, this, &QmlProfilerModelManager::saveFinished,
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
class QmlProfilerModelManager;
|
class QmlProfilerModelManager;
|
||||||
class QmlProfilerDataModel;
|
|
||||||
class QmlProfilerNotesModel;
|
class QmlProfilerNotesModel;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -96,7 +95,6 @@ public:
|
|||||||
|
|
||||||
State state() const;
|
State state() const;
|
||||||
QmlProfilerTraceTime *traceTime() const;
|
QmlProfilerTraceTime *traceTime() const;
|
||||||
QmlProfilerDataModel *qmlModel() const;
|
|
||||||
QmlProfilerNotesModel *notesModel() const;
|
QmlProfilerNotesModel *notesModel() const;
|
||||||
QmlProfilerTextMarkModel *textMarkModel() const;
|
QmlProfilerTextMarkModel *textMarkModel() const;
|
||||||
|
|
||||||
@@ -115,6 +113,9 @@ public:
|
|||||||
|
|
||||||
void addEventTypes(const QVector<QmlEventType> &types);
|
void addEventTypes(const QVector<QmlEventType> &types);
|
||||||
void addEventType(const QmlEventType &type);
|
void addEventType(const QmlEventType &type);
|
||||||
|
const QVector<QmlEventType> &eventTypes() const;
|
||||||
|
|
||||||
|
bool replayEvents(qint64 startTime, qint64 endTime, EventLoader loader) const;
|
||||||
|
|
||||||
quint64 availableFeatures() const;
|
quint64 availableFeatures() const;
|
||||||
quint64 visibleFeatures() const;
|
quint64 visibleFeatures() const;
|
||||||
@@ -127,6 +128,9 @@ public:
|
|||||||
void acquiringDone();
|
void acquiringDone();
|
||||||
void processingDone();
|
void processingDone();
|
||||||
|
|
||||||
|
void populateFileFinder(const ProjectExplorer::RunConfiguration *runConfiguration = nullptr);
|
||||||
|
QString findLocalFile(const QString &remoteFile);
|
||||||
|
|
||||||
static const char *featureName(ProfileFeature feature);
|
static const char *featureName(ProfileFeature feature);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlprofilernotesmodel.h"
|
#include "qmlprofilernotesmodel.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "qmlprofilerrangemodel.h"
|
#include "qmlprofilerrangemodel.h"
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
#include "qmlprofilerbindingloopsrenderpass.h"
|
#include "qmlprofilerbindingloopsrenderpass.h"
|
||||||
|
|
||||||
#include "timeline/timelinenotesrenderpass.h"
|
#include "timeline/timelinenotesrenderpass.h"
|
||||||
@@ -203,7 +202,7 @@ QVariantList QmlProfilerRangeModel::labels() const
|
|||||||
{
|
{
|
||||||
QVariantList result;
|
QVariantList result;
|
||||||
|
|
||||||
const QVector<QmlEventType> &types = modelManager()->qmlModel()->eventTypes();
|
const QVector<QmlEventType> &types = modelManager()->eventTypes();
|
||||||
for (int i = 1; i < expandedRowCount(); i++) { // Ignore the -1 for the first row
|
for (int i = 1; i < expandedRowCount(); i++) { // Ignore the -1 for the first row
|
||||||
QVariantMap element;
|
QVariantMap element;
|
||||||
int typeId = m_expandedRowTypes[i];
|
int typeId = m_expandedRowTypes[i];
|
||||||
@@ -220,7 +219,7 @@ QVariantMap QmlProfilerRangeModel::details(int index) const
|
|||||||
{
|
{
|
||||||
QVariantMap result;
|
QVariantMap result;
|
||||||
int id = selectionId(index);
|
int id = selectionId(index);
|
||||||
const QVector<QmlEventType> &types = modelManager()->qmlModel()->eventTypes();
|
const QVector<QmlEventType> &types = modelManager()->eventTypes();
|
||||||
|
|
||||||
result.insert(QStringLiteral("displayName"),
|
result.insert(QStringLiteral("displayName"),
|
||||||
tr(QmlProfilerModelManager::featureName(mainFeature())));
|
tr(QmlProfilerModelManager::featureName(mainFeature())));
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmlprofilertimelinemodel.h"
|
#include "qmlprofilertimelinemodel.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
#include "qmlprofilereventtypes.h"
|
#include "qmlprofilereventtypes.h"
|
||||||
#include "qmleventlocation.h"
|
#include "qmleventlocation.h"
|
||||||
#include "qmlprofilerconstants.h"
|
#include "qmlprofilerconstants.h"
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "qmlprofilerstatisticsmodel.h"
|
#include "qmlprofilerstatisticsmodel.h"
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -120,11 +119,11 @@ void QmlProfilerStatisticsModel::restrictToFeatures(qint64 features)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
if (!d->modelManager->qmlModel()->replayEvents(d->modelManager->traceTime()->startTime(),
|
if (!d->modelManager->replayEvents(d->modelManager->traceTime()->startTime(),
|
||||||
d->modelManager->traceTime()->endTime(),
|
d->modelManager->traceTime()->endTime(),
|
||||||
std::bind(&QmlProfilerStatisticsModel::loadEvent,
|
std::bind(&QmlProfilerStatisticsModel::loadEvent,
|
||||||
this, std::placeholders::_1,
|
this, std::placeholders::_1,
|
||||||
std::placeholders::_2))) {
|
std::placeholders::_2))) {
|
||||||
emit d->modelManager->error(tr("Could not re-read events from temporary trace file."));
|
emit d->modelManager->error(tr("Could not re-read events from temporary trace file."));
|
||||||
clear();
|
clear();
|
||||||
} else {
|
} else {
|
||||||
@@ -140,7 +139,7 @@ const QHash<int, QmlProfilerStatisticsModel::QmlEventStats> &QmlProfilerStatisti
|
|||||||
|
|
||||||
const QVector<QmlEventType> &QmlProfilerStatisticsModel::getTypes() const
|
const QVector<QmlEventType> &QmlProfilerStatisticsModel::getTypes() const
|
||||||
{
|
{
|
||||||
return d->modelManager->qmlModel()->eventTypes();
|
return d->modelManager->eventTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QHash<int, QString> &QmlProfilerStatisticsModel::getNotes() const
|
const QHash<int, QString> &QmlProfilerStatisticsModel::getNotes() const
|
||||||
@@ -322,7 +321,7 @@ QmlProfilerStatisticsRelativesModel::getData(int typeId) const
|
|||||||
|
|
||||||
const QVector<QmlEventType> &QmlProfilerStatisticsRelativesModel::getTypes() const
|
const QVector<QmlEventType> &QmlProfilerStatisticsRelativesModel::getTypes() const
|
||||||
{
|
{
|
||||||
return m_modelManager->qmlModel()->eventTypes();
|
return m_modelManager->eventTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerStatisticsRelativesModel::loadEvent(RangeType type, const QmlEvent &event,
|
void QmlProfilerStatisticsRelativesModel::loadEvent(RangeType type, const QmlEvent &event,
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
#include "qmlprofilernotesmodel.h"
|
#include "qmlprofilernotesmodel.h"
|
||||||
#include "qmlprofilereventtypes.h"
|
#include "qmlprofilereventtypes.h"
|
||||||
#include "qmleventlocation.h"
|
#include "qmleventlocation.h"
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ bool QmlProfilerTimelineModel::handlesTypeId(int typeIndex) const
|
|||||||
if (typeIndex < 0)
|
if (typeIndex < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return accepted(modelManager()->qmlModel()->eventTypes().at(typeIndex));
|
return accepted(modelManager()->eventTypes().at(typeIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerModelManager *QmlProfilerTimelineModel::modelManager() const
|
QmlProfilerModelManager *QmlProfilerTimelineModel::modelManager() const
|
||||||
@@ -112,7 +112,7 @@ QVariantMap QmlProfilerTimelineModel::locationFromTypeId(int index) const
|
|||||||
if (id < 0)
|
if (id < 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
auto types = modelManager()->qmlModel()->eventTypes();
|
auto types = modelManager()->eventTypes();
|
||||||
if (id >= types.length())
|
if (id >= types.length())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "qmlprofiler_global.h"
|
#include "qmlprofiler_global.h"
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
#include "timeline/timelinemodel.h"
|
#include "timeline/timelinemodel.h"
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
|||||||
|
|
||||||
// When the widgets are requested we assume that the session data
|
// When the widgets are requested we assume that the session data
|
||||||
// is available, then we can populate the file finder
|
// is available, then we can populate the file finder
|
||||||
d->m_profilerModelManager->qmlModel()->populateFileFinder();
|
d->m_profilerModelManager->populateFileFinder();
|
||||||
|
|
||||||
auto runControlCreator = [this](RunConfiguration *runConfiguration, Core::Id) {
|
auto runControlCreator = [this](RunConfiguration *runConfiguration, Core::Id) {
|
||||||
return createRunControl(runConfiguration);
|
return createRunControl(runConfiguration);
|
||||||
@@ -368,7 +368,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunControl *runControl)
|
|||||||
|
|
||||||
RunConfiguration *runConfiguration = runControl->runConfiguration();
|
RunConfiguration *runConfiguration = runControl->runConfiguration();
|
||||||
if (runConfiguration) {
|
if (runConfiguration) {
|
||||||
d->m_profilerModelManager->qmlModel()->populateFileFinder(runConfiguration);
|
d->m_profilerModelManager->populateFileFinder(runConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.analyzerSocket.isEmpty()) {
|
if (connection.analyzerSocket.isEmpty()) {
|
||||||
@@ -460,7 +460,7 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber,
|
|||||||
if (lineNumber < 0 || fileUrl.isEmpty())
|
if (lineNumber < 0 || fileUrl.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString projectFileName = d->m_profilerModelManager->qmlModel()->findLocalFile(fileUrl);
|
const QString projectFileName = d->m_profilerModelManager->findLocalFile(fileUrl);
|
||||||
|
|
||||||
QFileInfo fileInfo(projectFileName);
|
QFileInfo fileInfo(projectFileName);
|
||||||
if (!fileInfo.exists() || !fileInfo.isReadable())
|
if (!fileInfo.exists() || !fileInfo.isReadable())
|
||||||
@@ -688,7 +688,7 @@ void QmlProfilerTool::showLoadDialog()
|
|||||||
Debugger::enableMainWindow(false);
|
Debugger::enableMainWindow(false);
|
||||||
connect(d->m_profilerModelManager, &QmlProfilerModelManager::recordedFeaturesChanged,
|
connect(d->m_profilerModelManager, &QmlProfilerModelManager::recordedFeaturesChanged,
|
||||||
this, &QmlProfilerTool::setRecordedFeatures);
|
this, &QmlProfilerTool::setRecordedFeatures);
|
||||||
d->m_profilerModelManager->qmlModel()->populateFileFinder();
|
d->m_profilerModelManager->populateFileFinder();
|
||||||
d->m_profilerModelManager->load(filename);
|
d->m_profilerModelManager->load(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "qmlprofilertraceclient.h"
|
#include "qmlprofilertraceclient.h"
|
||||||
#include "qmltypedevent.h"
|
#include "qmltypedevent.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
|
|
||||||
#include <qmldebug/qmlenginecontrolclient.h>
|
#include <qmldebug/qmlenginecontrolclient.h>
|
||||||
#include <qmldebug/qdebugmessageclient.h>
|
#include <qmldebug/qdebugmessageclient.h>
|
||||||
|
|||||||
@@ -576,9 +576,9 @@ void QmlProfilerFileWriter::setTraceTime(qint64 startTime, qint64 endTime, qint6
|
|||||||
m_measuredTime = measuredTime;
|
m_measuredTime = measuredTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerFileWriter::setData(const QmlProfilerDataModel *model)
|
void QmlProfilerFileWriter::setData(const QmlProfilerModelManager *model)
|
||||||
{
|
{
|
||||||
m_model = model;
|
m_modelManager = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerFileWriter::setNotes(const QVector<QmlNote> ¬es)
|
void QmlProfilerFileWriter::setNotes(const QVector<QmlNote> ¬es)
|
||||||
@@ -610,7 +610,7 @@ void QmlProfilerFileWriter::saveQtd(QIODevice *device)
|
|||||||
|
|
||||||
stream.writeStartElement(_("eventData"));
|
stream.writeStartElement(_("eventData"));
|
||||||
stream.writeAttribute(_("totalTime"), QString::number(m_measuredTime));
|
stream.writeAttribute(_("totalTime"), QString::number(m_measuredTime));
|
||||||
const QVector<QmlEventType> &eventTypes = m_model->eventTypes();
|
const QVector<QmlEventType> &eventTypes = m_modelManager->eventTypes();
|
||||||
for (int typeIndex = 0, end = eventTypes.length(); typeIndex < end && !isCanceled();
|
for (int typeIndex = 0, end = eventTypes.length(); typeIndex < end && !isCanceled();
|
||||||
++typeIndex) {
|
++typeIndex) {
|
||||||
|
|
||||||
@@ -664,7 +664,7 @@ void QmlProfilerFileWriter::saveQtd(QIODevice *device)
|
|||||||
stream.writeStartElement(_("profilerDataModel"));
|
stream.writeStartElement(_("profilerDataModel"));
|
||||||
|
|
||||||
QStack<QmlEvent> stack;
|
QStack<QmlEvent> stack;
|
||||||
const bool success = m_model->replayEvents(
|
const bool success = m_modelManager->replayEvents(
|
||||||
-1, -1, [this, &stack, &stream](const QmlEvent &event,
|
-1, -1, [this, &stack, &stream](const QmlEvent &event,
|
||||||
const QmlEventType &type) {
|
const QmlEventType &type) {
|
||||||
if (isCanceled())
|
if (isCanceled())
|
||||||
@@ -790,7 +790,7 @@ void QmlProfilerFileWriter::saveQzt(QFile *file)
|
|||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
|
|
||||||
if (!isCanceled()) {
|
if (!isCanceled()) {
|
||||||
bufferStream << m_model->eventTypes();
|
bufferStream << m_modelManager->eventTypes();
|
||||||
stream << qCompress(buffer.data());
|
stream << qCompress(buffer.data());
|
||||||
buffer.close();
|
buffer.close();
|
||||||
buffer.buffer().clear();
|
buffer.buffer().clear();
|
||||||
@@ -808,7 +808,7 @@ void QmlProfilerFileWriter::saveQzt(QFile *file)
|
|||||||
|
|
||||||
if (!isCanceled()) {
|
if (!isCanceled()) {
|
||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
const bool success = m_model->replayEvents(
|
const bool success = m_modelManager->replayEvents(
|
||||||
-1, -1, [this, &stream, &buffer, &bufferStream](const QmlEvent &event,
|
-1, -1, [this, &stream, &buffer, &bufferStream](const QmlEvent &event,
|
||||||
const QmlEventType &type) {
|
const QmlEventType &type) {
|
||||||
Q_UNUSED(type);
|
Q_UNUSED(type);
|
||||||
|
|||||||
@@ -27,8 +27,10 @@
|
|||||||
|
|
||||||
#include "qmleventlocation.h"
|
#include "qmleventlocation.h"
|
||||||
#include "qmlprofilereventtypes.h"
|
#include "qmlprofilereventtypes.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
#include "qmlnote.h"
|
#include "qmlnote.h"
|
||||||
|
#include "qmleventtype.h"
|
||||||
|
#include "qmlevent.h"
|
||||||
|
#include "qmlprofilermodelmanager.h"
|
||||||
|
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -90,7 +92,7 @@ public:
|
|||||||
explicit QmlProfilerFileWriter(QObject *parent = 0);
|
explicit QmlProfilerFileWriter(QObject *parent = 0);
|
||||||
|
|
||||||
void setTraceTime(qint64 startTime, qint64 endTime, qint64 measturedTime);
|
void setTraceTime(qint64 startTime, qint64 endTime, qint64 measturedTime);
|
||||||
void setData(const QmlProfilerDataModel *model);
|
void setData(const QmlProfilerModelManager *model);
|
||||||
void setNotes(const QVector<QmlNote> ¬es);
|
void setNotes(const QVector<QmlNote> ¬es);
|
||||||
void setFuture(QFutureInterface<void> *future);
|
void setFuture(QFutureInterface<void> *future);
|
||||||
|
|
||||||
@@ -115,7 +117,7 @@ private:
|
|||||||
|
|
||||||
qint64 m_startTime, m_endTime, m_measuredTime;
|
qint64 m_startTime, m_endTime, m_measuredTime;
|
||||||
QFutureInterface<void> *m_future;
|
QFutureInterface<void> *m_future;
|
||||||
const QmlProfilerDataModel *m_model;
|
const QmlProfilerModelManager *m_modelManager;
|
||||||
QVector<QmlNote> m_notes;
|
QVector<QmlNote> m_notes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "qmlprofilertimelinemodel.h"
|
#include "qmlprofilertimelinemodel.h"
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void MemoryUsageModelTest::testDetails()
|
|||||||
QCOMPARE(allocated[model.tr("Allocated")].toString(), model.tr("%1 bytes").arg(4096));
|
QCOMPARE(allocated[model.tr("Allocated")].toString(), model.tr("%1 bytes").arg(4096));
|
||||||
QCOMPARE(allocated[model.tr("Allocations")].toString(), QString::number(2));
|
QCOMPARE(allocated[model.tr("Allocations")].toString(), QString::number(2));
|
||||||
QCOMPARE(allocated[model.tr("Type")].toString(), model.tr("Heap Allocation"));
|
QCOMPARE(allocated[model.tr("Type")].toString(), model.tr("Heap Allocation"));
|
||||||
QCOMPARE(allocated[model.tr("Location")].toString(), QmlProfilerDataModel::tr("<bytecode>"));
|
QCOMPARE(allocated[model.tr("Location")].toString(), QmlProfilerModelManager::tr("<bytecode>"));
|
||||||
|
|
||||||
QVERIFY(!allocated.contains(model.tr("Deallocated")));
|
QVERIFY(!allocated.contains(model.tr("Deallocated")));
|
||||||
QVERIFY(!allocated.contains(model.tr("Deallocations")));
|
QVERIFY(!allocated.contains(model.tr("Deallocations")));
|
||||||
@@ -165,7 +165,7 @@ void MemoryUsageModelTest::testDetails()
|
|||||||
QCOMPARE(large[model.tr("Allocated")].toString(), model.tr("%1 bytes").arg(1024));
|
QCOMPARE(large[model.tr("Allocated")].toString(), model.tr("%1 bytes").arg(1024));
|
||||||
QCOMPARE(large[model.tr("Allocations")].toString(), QString::number(1));
|
QCOMPARE(large[model.tr("Allocations")].toString(), QString::number(1));
|
||||||
QCOMPARE(large[model.tr("Type")].toString(), model.tr("Large Item Allocation"));
|
QCOMPARE(large[model.tr("Type")].toString(), model.tr("Large Item Allocation"));
|
||||||
QCOMPARE(large[model.tr("Location")].toString(), QmlProfilerDataModel::tr("<bytecode>"));
|
QCOMPARE(large[model.tr("Location")].toString(), QmlProfilerModelManager::tr("<bytecode>"));
|
||||||
|
|
||||||
QVERIFY(!large.contains(model.tr("Deallocated")));
|
QVERIFY(!large.contains(model.tr("Deallocated")));
|
||||||
QVERIFY(!large.contains(model.tr("Deallocations")));
|
QVERIFY(!large.contains(model.tr("Deallocations")));
|
||||||
@@ -176,7 +176,7 @@ void MemoryUsageModelTest::testDetails()
|
|||||||
QCOMPARE(freed[model.tr("Deallocated")].toString(), model.tr("%1 bytes").arg(1024));
|
QCOMPARE(freed[model.tr("Deallocated")].toString(), model.tr("%1 bytes").arg(1024));
|
||||||
QCOMPARE(freed[model.tr("Deallocations")].toString(), QString::number(1));
|
QCOMPARE(freed[model.tr("Deallocations")].toString(), QString::number(1));
|
||||||
QCOMPARE(freed[model.tr("Type")].toString(), model.tr("Heap Usage"));
|
QCOMPARE(freed[model.tr("Type")].toString(), model.tr("Heap Usage"));
|
||||||
QCOMPARE(freed[model.tr("Location")].toString(), QmlProfilerDataModel::tr("<bytecode>"));
|
QCOMPARE(freed[model.tr("Location")].toString(), QmlProfilerModelManager::tr("<bytecode>"));
|
||||||
|
|
||||||
QVERIFY(!freed.contains(model.tr("Allocated")));
|
QVERIFY(!freed.contains(model.tr("Allocated")));
|
||||||
QVERIFY(!freed.contains(model.tr("Allocations")));
|
QVERIFY(!freed.contains(model.tr("Allocations")));
|
||||||
|
|||||||
Reference in New Issue
Block a user