2013-08-08 13:28:08 +02:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2013-08-08 13:28:08 +02:00
|
|
|
**
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
**
|
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2013-08-08 13:28:08 +02:00
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2013-08-08 13:28:08 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2013-08-08 13:28:08 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "qmlprofilermodelmanager.h"
|
2015-02-10 20:29:54 +01:00
|
|
|
#include "qmlprofilerconstants.h"
|
2014-02-18 17:32:20 +01:00
|
|
|
#include "qmlprofilerdatamodel.h"
|
2013-08-08 13:28:08 +02:00
|
|
|
#include "qmlprofilertracefile.h"
|
2014-10-27 17:41:22 +01:00
|
|
|
#include "qmlprofilernotesmodel.h"
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2015-02-10 20:29:54 +01:00
|
|
|
#include <coreplugin/progressmanager/progressmanager.h>
|
|
|
|
#include <utils/runextensions.h>
|
2013-08-08 13:28:08 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QFile>
|
2014-11-03 14:19:26 +01:00
|
|
|
#include <QMessageBox>
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
namespace Internal {
|
|
|
|
|
2014-09-09 18:22:58 +02:00
|
|
|
static const char *ProfileFeatureNames[QmlDebug::MaximumProfileFeature] = {
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "JavaScript"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Memory Usage"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Pixmap Cache"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Scene Graph"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Animations"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Painting"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Compiling"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Creating"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Binding"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Handling Signal"),
|
|
|
|
QT_TRANSLATE_NOOP("MainView", "Input Events")
|
|
|
|
};
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
2014-06-03 15:35:54 +02:00
|
|
|
QmlProfilerTraceTime::QmlProfilerTraceTime(QObject *parent) :
|
|
|
|
QObject(parent), m_startTime(-1), m_endTime(-1)
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QmlProfilerTraceTime::~QmlProfilerTraceTime()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
qint64 QmlProfilerTraceTime::startTime() const
|
|
|
|
{
|
|
|
|
return m_startTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
qint64 QmlProfilerTraceTime::endTime() const
|
|
|
|
{
|
|
|
|
return m_endTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
qint64 QmlProfilerTraceTime::duration() const
|
|
|
|
{
|
|
|
|
return endTime() - startTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerTraceTime::clear()
|
|
|
|
{
|
2014-10-14 16:44:45 +02:00
|
|
|
setTime(-1, -1);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
2014-10-14 16:44:45 +02:00
|
|
|
void QmlProfilerTraceTime::setTime(qint64 startTime, qint64 endTime)
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-10-14 16:44:45 +02:00
|
|
|
Q_ASSERT(startTime <= endTime);
|
|
|
|
if (startTime != m_startTime || endTime != m_endTime) {
|
|
|
|
m_startTime = startTime;
|
|
|
|
m_endTime = endTime;
|
|
|
|
emit timeChanged(startTime, endTime);
|
2014-03-28 16:06:07 +01:00
|
|
|
}
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
2014-03-12 17:20:52 +01:00
|
|
|
void QmlProfilerTraceTime::decreaseStartTime(qint64 time)
|
|
|
|
{
|
2014-10-14 16:44:45 +02:00
|
|
|
if (m_startTime > time) {
|
|
|
|
m_startTime = time;
|
|
|
|
emit timeChanged(time, m_endTime);
|
|
|
|
}
|
2014-03-12 17:20:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerTraceTime::increaseEndTime(qint64 time)
|
|
|
|
{
|
2014-10-14 16:44:45 +02:00
|
|
|
if (m_endTime < time) {
|
|
|
|
m_endTime = time;
|
|
|
|
emit timeChanged(m_startTime, time);
|
|
|
|
}
|
2014-03-12 17:20:52 +01:00
|
|
|
}
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class QmlProfilerModelManager::QmlProfilerModelManagerPrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QmlProfilerModelManagerPrivate(QmlProfilerModelManager *qq) : q(qq) {}
|
|
|
|
~QmlProfilerModelManagerPrivate() {}
|
|
|
|
QmlProfilerModelManager *q;
|
|
|
|
|
2014-02-18 17:32:20 +01:00
|
|
|
QmlProfilerDataModel *model;
|
2014-10-27 17:41:22 +01:00
|
|
|
QmlProfilerNotesModel *notesModel;
|
2014-09-26 15:49:49 +02:00
|
|
|
|
2015-09-10 13:51:54 +02:00
|
|
|
QmlProfilerModelManager::State state;
|
2013-08-08 13:28:08 +02:00
|
|
|
QmlProfilerTraceTime *traceTime;
|
|
|
|
|
|
|
|
QVector <double> partialCounts;
|
2014-02-12 17:50:55 +01:00
|
|
|
QVector <int> partialCountWeights;
|
2015-06-30 15:55:33 +02:00
|
|
|
quint64 availableFeatures;
|
|
|
|
quint64 visibleFeatures;
|
|
|
|
quint64 recordedFeatures;
|
2014-09-09 18:22:58 +02:00
|
|
|
|
2014-02-12 17:50:55 +01:00
|
|
|
int totalWeight;
|
2013-08-08 13:28:08 +02:00
|
|
|
double progress;
|
2014-02-12 18:13:10 +01:00
|
|
|
double previousProgress;
|
2013-08-08 13:28:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
QmlProfilerModelManager::QmlProfilerModelManager(Utils::FileInProjectFinder *finder, QObject *parent) :
|
|
|
|
QObject(parent), d(new QmlProfilerModelManagerPrivate(this))
|
|
|
|
{
|
2014-02-12 17:50:55 +01:00
|
|
|
d->totalWeight = 0;
|
2015-06-30 15:55:33 +02:00
|
|
|
d->availableFeatures = 0;
|
|
|
|
d->visibleFeatures = 0;
|
|
|
|
d->recordedFeatures = 0;
|
2014-02-18 17:32:20 +01:00
|
|
|
d->model = new QmlProfilerDataModel(finder, this);
|
2015-09-10 13:51:54 +02:00
|
|
|
d->state = Empty;
|
2013-08-08 13:28:08 +02:00
|
|
|
d->traceTime = new QmlProfilerTraceTime(this);
|
2014-10-27 17:41:22 +01:00
|
|
|
d->notesModel = new QmlProfilerNotesModel(this);
|
2014-09-26 15:49:49 +02:00
|
|
|
d->notesModel->setModelManager(this);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QmlProfilerModelManager::~QmlProfilerModelManager()
|
|
|
|
{
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
|
|
|
QmlProfilerTraceTime *QmlProfilerModelManager::traceTime() const
|
|
|
|
{
|
|
|
|
return d->traceTime;
|
|
|
|
}
|
|
|
|
|
2014-02-18 17:32:20 +01:00
|
|
|
QmlProfilerDataModel *QmlProfilerModelManager::qmlModel() const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
|
|
|
return d->model;
|
|
|
|
}
|
|
|
|
|
2014-10-27 17:41:22 +01:00
|
|
|
QmlProfilerNotesModel *QmlProfilerModelManager::notesModel() const
|
2014-09-26 15:49:49 +02:00
|
|
|
{
|
|
|
|
return d->notesModel;
|
|
|
|
}
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
bool QmlProfilerModelManager::isEmpty() const
|
|
|
|
{
|
2015-05-26 14:41:27 +02:00
|
|
|
return d->model->isEmpty();
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
double QmlProfilerModelManager::progress() const
|
|
|
|
{
|
|
|
|
return d->progress;
|
|
|
|
}
|
|
|
|
|
|
|
|
int QmlProfilerModelManager::registerModelProxy()
|
|
|
|
{
|
|
|
|
d->partialCounts << 0;
|
2014-02-12 17:50:55 +01:00
|
|
|
d->partialCountWeights << 1;
|
|
|
|
d->totalWeight++;
|
2013-08-08 13:28:08 +02:00
|
|
|
return d->partialCounts.count()-1;
|
|
|
|
}
|
|
|
|
|
2014-02-12 17:50:55 +01:00
|
|
|
void QmlProfilerModelManager::setProxyCountWeight(int proxyId, int weight)
|
|
|
|
{
|
|
|
|
d->totalWeight += weight - d->partialCountWeights[proxyId];
|
|
|
|
d->partialCountWeights[proxyId] = weight;
|
|
|
|
}
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
void QmlProfilerModelManager::modelProxyCountUpdated(int proxyId, qint64 count, qint64 max)
|
|
|
|
{
|
2014-02-12 17:50:55 +01:00
|
|
|
d->progress -= d->partialCounts[proxyId] * d->partialCountWeights[proxyId] /
|
|
|
|
d->totalWeight;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
if (max <= 0)
|
|
|
|
d->partialCounts[proxyId] = 1;
|
|
|
|
else
|
|
|
|
d->partialCounts[proxyId] = (double)count / (double) max;
|
|
|
|
|
2014-02-12 17:50:55 +01:00
|
|
|
d->progress += d->partialCounts[proxyId] * d->partialCountWeights[proxyId] /
|
|
|
|
d->totalWeight;
|
2014-02-12 18:13:10 +01:00
|
|
|
|
|
|
|
if (d->progress - d->previousProgress > 0.01) {
|
|
|
|
d->previousProgress = d->progress;
|
|
|
|
emit progressChanged();
|
|
|
|
}
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
2014-09-09 18:22:58 +02:00
|
|
|
void QmlProfilerModelManager::announceFeatures(int proxyId, quint64 features)
|
|
|
|
{
|
|
|
|
Q_UNUSED(proxyId); // Will use that later to optimize the event dispatching on loading.
|
2015-06-30 15:55:33 +02:00
|
|
|
if ((features & d->availableFeatures) != features) {
|
|
|
|
d->availableFeatures |= features;
|
|
|
|
emit availableFeaturesChanged(d->availableFeatures);
|
2014-09-09 18:22:58 +02:00
|
|
|
}
|
2015-06-30 15:55:33 +02:00
|
|
|
if ((features & d->visibleFeatures) != features) {
|
|
|
|
d->visibleFeatures |= features;
|
|
|
|
emit visibleFeaturesChanged(d->visibleFeatures);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
quint64 QmlProfilerModelManager::availableFeatures() const
|
|
|
|
{
|
|
|
|
return d->availableFeatures;
|
2014-09-09 18:22:58 +02:00
|
|
|
}
|
|
|
|
|
2015-06-30 15:55:33 +02:00
|
|
|
quint64 QmlProfilerModelManager::visibleFeatures() const
|
2014-09-09 18:22:58 +02:00
|
|
|
{
|
2015-06-30 15:55:33 +02:00
|
|
|
return d->visibleFeatures;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerModelManager::setVisibleFeatures(quint64 features)
|
|
|
|
{
|
|
|
|
if (d->visibleFeatures != features) {
|
|
|
|
d->visibleFeatures = features;
|
|
|
|
emit visibleFeaturesChanged(d->visibleFeatures);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
quint64 QmlProfilerModelManager::recordedFeatures() const
|
|
|
|
{
|
|
|
|
return d->recordedFeatures;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerModelManager::setRecordedFeatures(quint64 features)
|
|
|
|
{
|
|
|
|
if (d->recordedFeatures != features) {
|
|
|
|
d->recordedFeatures = features;
|
|
|
|
emit recordedFeaturesChanged(d->recordedFeatures);
|
|
|
|
}
|
2014-09-09 18:22:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *QmlProfilerModelManager::featureName(QmlDebug::ProfileFeature feature)
|
|
|
|
{
|
|
|
|
return ProfileFeatureNames[feature];
|
|
|
|
}
|
|
|
|
|
2014-06-03 16:57:32 +02:00
|
|
|
void QmlProfilerModelManager::addQmlEvent(QmlDebug::Message message,
|
|
|
|
QmlDebug::RangeType rangeType,
|
|
|
|
int detailType,
|
2013-08-08 13:28:08 +02:00
|
|
|
qint64 startTime,
|
|
|
|
qint64 length,
|
2014-06-13 16:33:30 +02:00
|
|
|
const QString &data,
|
2013-08-08 13:28:08 +02:00
|
|
|
const QmlDebug::QmlEventLocation &location,
|
|
|
|
qint64 ndata1,
|
|
|
|
qint64 ndata2,
|
|
|
|
qint64 ndata3,
|
|
|
|
qint64 ndata4,
|
|
|
|
qint64 ndata5)
|
|
|
|
{
|
|
|
|
// If trace start time was not explicitly set, use the first event
|
|
|
|
if (d->traceTime->startTime() == -1)
|
2014-10-14 16:44:45 +02:00
|
|
|
d->traceTime->setTime(startTime, startTime + d->traceTime->duration());
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2015-09-10 13:51:54 +02:00
|
|
|
QTC_ASSERT(state() == AcquiringData, /**/);
|
2014-06-03 16:57:32 +02:00
|
|
|
d->model->addQmlEvent(message, rangeType, detailType, startTime, length, data, location,
|
|
|
|
ndata1, ndata2, ndata3, ndata4, ndata5);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
2015-09-10 17:11:21 +02:00
|
|
|
void QmlProfilerModelManager::acquiringDone()
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2015-09-10 17:11:21 +02:00
|
|
|
QTC_ASSERT(state() == AcquiringData, /**/);
|
|
|
|
setState(ProcessingData);
|
|
|
|
d->model->processData();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerModelManager::processingDone()
|
|
|
|
{
|
|
|
|
QTC_ASSERT(state() == ProcessingData, /**/);
|
2015-09-25 10:35:42 +02:00
|
|
|
// Load notes after the timeline models have been initialized ...
|
|
|
|
// which happens on stateChanged(Done).
|
2015-09-10 17:11:21 +02:00
|
|
|
setState(Done);
|
2015-09-25 10:35:42 +02:00
|
|
|
d->notesModel->loadData();
|
2015-09-10 17:11:21 +02:00
|
|
|
emit loadFinished();
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerModelManager::save(const QString &filename)
|
|
|
|
{
|
2015-02-10 20:29:54 +01:00
|
|
|
QFile *file = new QFile(filename);
|
|
|
|
if (!file->open(QIODevice::WriteOnly)) {
|
2013-08-08 13:28:08 +02:00
|
|
|
emit error(tr("Could not open %1 for writing.").arg(filename));
|
2015-02-10 20:29:54 +01:00
|
|
|
delete file;
|
|
|
|
emit saveFinished();
|
2013-08-08 13:28:08 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-09-26 15:49:49 +02:00
|
|
|
d->notesModel->saveData();
|
2015-02-10 20:29:54 +01:00
|
|
|
|
|
|
|
QFuture<void> result = QtConcurrent::run<void>([this, file] (QFutureInterface<void> &future) {
|
|
|
|
QmlProfilerFileWriter writer;
|
|
|
|
writer.setTraceTime(traceTime()->startTime(), traceTime()->endTime(),
|
|
|
|
traceTime()->duration());
|
|
|
|
writer.setQmlEvents(d->model->getEventTypes(), d->model->getEvents());
|
|
|
|
writer.setNotes(d->model->getEventNotes());
|
|
|
|
writer.setFuture(&future);
|
|
|
|
writer.save(file);
|
|
|
|
file->deleteLater();
|
|
|
|
QMetaObject::invokeMethod(this, "saveFinished", Qt::QueuedConnection);
|
|
|
|
});
|
|
|
|
|
|
|
|
Core::ProgressManager::addTask(result, tr("Saving Trace Data"), Constants::TASK_SAVE,
|
|
|
|
Core::ProgressManager::ShowInApplicationIcon);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerModelManager::load(const QString &filename)
|
|
|
|
{
|
2015-09-10 11:49:17 +02:00
|
|
|
QFile *file = new QFile(filename, this);
|
2015-02-17 14:25:24 +01:00
|
|
|
if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
2015-09-10 11:49:17 +02:00
|
|
|
emit error(tr("Could not open %1 for reading.").arg(filename));
|
2015-02-17 14:25:24 +01:00
|
|
|
delete file;
|
|
|
|
emit loadFinished();
|
2013-08-08 13:28:08 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
clear();
|
2015-09-10 13:51:54 +02:00
|
|
|
setState(AcquiringData);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2015-02-17 14:25:24 +01:00
|
|
|
QFuture<void> result = QtConcurrent::run<void>([this, file] (QFutureInterface<void> &future) {
|
|
|
|
QmlProfilerFileReader reader;
|
|
|
|
reader.setFuture(&future);
|
|
|
|
connect(&reader, &QmlProfilerFileReader::error, this, &QmlProfilerModelManager::error);
|
|
|
|
reader.setQmlDataModel(d->model);
|
|
|
|
reader.load(file);
|
2015-06-30 15:55:33 +02:00
|
|
|
setRecordedFeatures(reader.loadedFeatures());
|
2015-02-17 14:25:24 +01:00
|
|
|
file->close();
|
|
|
|
file->deleteLater();
|
2015-09-10 17:11:21 +02:00
|
|
|
d->traceTime->increaseEndTime(d->model->lastTimeMark());
|
|
|
|
acquiringDone();
|
2015-02-17 14:25:24 +01:00
|
|
|
});
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2015-02-17 14:25:24 +01:00
|
|
|
Core::ProgressManager::addTask(result, tr("Loading Trace Data"), Constants::TASK_LOAD);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-09-10 13:51:54 +02:00
|
|
|
void QmlProfilerModelManager::setState(QmlProfilerModelManager::State state)
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2015-09-10 13:51:54 +02:00
|
|
|
// It's not an error, we are continuously calling "AcquiringData" for example
|
|
|
|
if (d->state == state)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case ClearingData:
|
|
|
|
QTC_ASSERT(d->state == Done || d->state == Empty || d->state == AcquiringData, /**/);
|
|
|
|
break;
|
|
|
|
case Empty:
|
|
|
|
// if it's not empty, complain but go on
|
|
|
|
QTC_ASSERT(isEmpty(), /**/);
|
|
|
|
break;
|
|
|
|
case AcquiringData:
|
|
|
|
// we're not supposed to receive new data while processing older data
|
|
|
|
QTC_ASSERT(d->state != ProcessingData, return);
|
|
|
|
break;
|
|
|
|
case ProcessingData:
|
|
|
|
QTC_ASSERT(d->state == AcquiringData, return);
|
|
|
|
break;
|
|
|
|
case Done:
|
|
|
|
QTC_ASSERT(d->state == ProcessingData || d->state == Empty, return);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
emit error(tr("Trying to set unknown state in events list."));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
d->state = state;
|
|
|
|
emit stateChanged();
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
2015-09-10 13:51:54 +02:00
|
|
|
QmlProfilerModelManager::State QmlProfilerModelManager::state() const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2015-09-10 13:51:54 +02:00
|
|
|
return d->state;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerModelManager::clear()
|
|
|
|
{
|
2015-09-10 13:51:54 +02:00
|
|
|
setState(ClearingData);
|
2013-08-08 13:28:08 +02:00
|
|
|
for (int i = 0; i < d->partialCounts.count(); i++)
|
|
|
|
d->partialCounts[i] = 0;
|
|
|
|
d->progress = 0;
|
2014-02-12 18:13:10 +01:00
|
|
|
d->previousProgress = 0;
|
2013-08-08 13:28:08 +02:00
|
|
|
d->model->clear();
|
|
|
|
d->traceTime->clear();
|
2014-11-03 14:19:26 +01:00
|
|
|
d->notesModel->clear();
|
2015-06-30 15:55:33 +02:00
|
|
|
setVisibleFeatures(0);
|
|
|
|
setRecordedFeatures(0);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2015-09-10 13:51:54 +02:00
|
|
|
setState(Empty);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProfilerModelManager::prepareForWriting()
|
|
|
|
{
|
2015-09-10 13:51:54 +02:00
|
|
|
setState(AcquiringData);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace QmlProfiler
|