forked from qt-creator/qt-creator
QmlProfiler: Remove some useless signals and QML variables
We don't want to emit a signal for each event being added. That's expensive and doesn't serve any purpose. We also don't have to save the availability of data in QML as it isn't used anywhere. Change-Id: I32db06a1955a7cfd6b569f50b81bf5278333b622 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -101,7 +101,6 @@ public:
|
|||||||
Q_INVOKABLE virtual int getEventIdForLocation(const QString &filename, int line, int column) const = 0;
|
Q_INVOKABLE virtual int getEventIdForLocation(const QString &filename, int line, int column) const = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countChanged();
|
|
||||||
void dataAvailable();
|
void dataAvailable();
|
||||||
void stateChanged();
|
void stateChanged();
|
||||||
void emptyChanged();
|
void emptyChanged();
|
||||||
|
|||||||
@@ -38,9 +38,7 @@ Rectangle {
|
|||||||
|
|
||||||
property int singleRowHeight: 30
|
property int singleRowHeight: 30
|
||||||
|
|
||||||
property bool dataAvailable: true
|
|
||||||
property int eventCount: 0
|
property int eventCount: 0
|
||||||
property real progress: 0
|
|
||||||
|
|
||||||
property alias selectionLocked : view.selectionLocked
|
property alias selectionLocked : view.selectionLocked
|
||||||
signal updateLockButton
|
signal updateLockButton
|
||||||
@@ -88,39 +86,14 @@ Rectangle {
|
|||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: qmlProfilerModelProxy
|
target: qmlProfilerModelProxy
|
||||||
onCountChanged: {
|
|
||||||
eventCount = qmlProfilerModelProxy.count();
|
|
||||||
if (eventCount === 0)
|
|
||||||
root.clearAll();
|
|
||||||
if (eventCount > 1) {
|
|
||||||
root.progress = Math.min(1.0,
|
|
||||||
(qmlProfilerModelProxy.lastTimeMark() -
|
|
||||||
qmlProfilerModelProxy.traceStartTime()) / root.elapsedTime * 1e-9 );
|
|
||||||
} else {
|
|
||||||
root.progress = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onStateChanged: {
|
onStateChanged: {
|
||||||
switch (qmlProfilerModelProxy.getState()) {
|
// Clear if model is empty.
|
||||||
case 0: {
|
if (qmlProfilerModelProxy.getState() === 0)
|
||||||
root.clearAll();
|
root.clearAll();
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1: {
|
|
||||||
root.dataAvailable = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
root.progress = 0.9; // jump to 90%
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onDataAvailable: {
|
onDataAvailable: {
|
||||||
view.clearData();
|
view.clearData();
|
||||||
zoomControl.setRange(0,0);
|
zoomControl.setRange(0,0);
|
||||||
progress = 1.0;
|
|
||||||
dataAvailable = true;
|
|
||||||
view.visible = true;
|
view.visible = true;
|
||||||
view.requestPaint();
|
view.requestPaint();
|
||||||
zoomControl.setRange(qmlProfilerModelProxy.traceStartTime(),
|
zoomControl.setRange(qmlProfilerModelProxy.traceStartTime(),
|
||||||
@@ -142,7 +115,6 @@ Rectangle {
|
|||||||
|
|
||||||
function clearData() {
|
function clearData() {
|
||||||
view.clearData();
|
view.clearData();
|
||||||
dataAvailable = false;
|
|
||||||
appKilled = false;
|
appKilled = false;
|
||||||
eventCount = 0;
|
eventCount = 0;
|
||||||
hideRangeDetails();
|
hideRangeDetails();
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ public:
|
|||||||
QVector <int> partialCountWeights;
|
QVector <int> partialCountWeights;
|
||||||
int totalWeight;
|
int totalWeight;
|
||||||
double progress;
|
double progress;
|
||||||
|
double previousProgress;
|
||||||
qint64 estimatedTime;
|
qint64 estimatedTime;
|
||||||
|
|
||||||
// file to load
|
// file to load
|
||||||
@@ -227,7 +228,11 @@ void QmlProfilerModelManager::modelProxyCountUpdated(int proxyId, qint64 count,
|
|||||||
|
|
||||||
d->progress += d->partialCounts[proxyId] * d->partialCountWeights[proxyId] /
|
d->progress += d->partialCounts[proxyId] * d->partialCountWeights[proxyId] /
|
||||||
d->totalWeight;
|
d->totalWeight;
|
||||||
emit progressChanged();
|
|
||||||
|
if (d->progress - d->previousProgress > 0.01) {
|
||||||
|
d->previousProgress = d->progress;
|
||||||
|
emit progressChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 QmlProfilerModelManager::estimatedProfilingTime() const
|
qint64 QmlProfilerModelManager::estimatedProfilingTime() const
|
||||||
@@ -258,7 +263,6 @@ void QmlProfilerModelManager::addQmlEvent(int type,
|
|||||||
|
|
||||||
QTC_ASSERT(state() == QmlProfilerDataState::AcquiringData, /**/);
|
QTC_ASSERT(state() == QmlProfilerDataState::AcquiringData, /**/);
|
||||||
d->model->addQmlEvent(type, bindingType, startTime, length, data, location, ndata1, ndata2, ndata3, ndata4, ndata5);
|
d->model->addQmlEvent(type, bindingType, startTime, length, data, location, ndata1, ndata2, ndata3, ndata4, ndata5);
|
||||||
emit countChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerModelManager::addV8Event(int depth, const QString &function, const QString &filename,
|
void QmlProfilerModelManager::addV8Event(int depth, const QString &function, const QString &filename,
|
||||||
@@ -374,11 +378,11 @@ void QmlProfilerModelManager::clear()
|
|||||||
for (int i = 0; i < d->partialCounts.count(); i++)
|
for (int i = 0; i < d->partialCounts.count(); i++)
|
||||||
d->partialCounts[i] = 0;
|
d->partialCounts[i] = 0;
|
||||||
d->progress = 0;
|
d->progress = 0;
|
||||||
|
d->previousProgress = 0;
|
||||||
d->model->clear();
|
d->model->clear();
|
||||||
d->v8Model->clear();
|
d->v8Model->clear();
|
||||||
d->traceTime->clear();
|
d->traceTime->clear();
|
||||||
|
|
||||||
emit countChanged();
|
|
||||||
setState(QmlProfilerDataState::Empty);
|
setState(QmlProfilerDataState::Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ public:
|
|||||||
qint64 estimatedProfilingTime() const;
|
qint64 estimatedProfilingTime() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countChanged();
|
|
||||||
void error(const QString &error);
|
void error(const QString &error);
|
||||||
void stateChanged();
|
void stateChanged();
|
||||||
void progressChanged();
|
void progressChanged();
|
||||||
|
|||||||
@@ -158,8 +158,6 @@ void PaintEventsModelProxy::loadData()
|
|||||||
d->computeNesting();
|
d->computeNesting();
|
||||||
|
|
||||||
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
|
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
|
||||||
|
|
||||||
emit countChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////// QML interface
|
/////////////////// QML interface
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateMan
|
|||||||
// profiler state
|
// profiler state
|
||||||
d->m_modelManager = modelManager;
|
d->m_modelManager = modelManager;
|
||||||
connect(d->m_modelManager,SIGNAL(stateChanged()), this, SLOT(dataStateChanged()));
|
connect(d->m_modelManager,SIGNAL(stateChanged()), this, SLOT(dataStateChanged()));
|
||||||
connect(d->m_modelManager,SIGNAL(countChanged()), this, SLOT(dataStateChanged()));
|
|
||||||
connect(d->m_modelManager,SIGNAL(progressChanged()), this, SLOT(dataStateChanged()));
|
connect(d->m_modelManager,SIGNAL(progressChanged()), this, SLOT(dataStateChanged()));
|
||||||
connect(this, SIGNAL(newTimeEstimation(qint64)), d->m_modelManager, SLOT(newTimeEstimation(qint64)));
|
connect(this, SIGNAL(newTimeEstimation(qint64)), d->m_modelManager, SLOT(newTimeEstimation(qint64)));
|
||||||
d->m_profilerState = stateManager;
|
d->m_profilerState = stateManager;
|
||||||
|
|||||||
@@ -194,8 +194,6 @@ void BasicTimelineModel::loadData()
|
|||||||
d->computeRowStarts();
|
d->computeRowStarts();
|
||||||
|
|
||||||
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
|
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
|
||||||
|
|
||||||
emit countChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted()
|
void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted()
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
|
|||||||
{
|
{
|
||||||
d->modelManager = modelManager;
|
d->modelManager = modelManager;
|
||||||
connect(modelManager,SIGNAL(stateChanged()),this,SLOT(dataChanged()));
|
connect(modelManager,SIGNAL(stateChanged()),this,SLOT(dataChanged()));
|
||||||
connect(modelManager,SIGNAL(countChanged()),this,SIGNAL(countChanged()));
|
|
||||||
connect(modelManager,SIGNAL(dataAvailable()),this,SIGNAL(dataAvailable()));
|
connect(modelManager,SIGNAL(dataAvailable()),this,SIGNAL(dataAvailable()));
|
||||||
|
|
||||||
// external models pushed on top
|
// external models pushed on top
|
||||||
@@ -90,7 +89,6 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
|
|||||||
void TimelineModelAggregator::addModel(AbstractTimelineModel *m)
|
void TimelineModelAggregator::addModel(AbstractTimelineModel *m)
|
||||||
{
|
{
|
||||||
d->modelList << m;
|
d->modelList << m;
|
||||||
connect(m,SIGNAL(countChanged()),this,SIGNAL(countChanged()));
|
|
||||||
connect(m,SIGNAL(emptyChanged()),this,SIGNAL(emptyChanged()));
|
connect(m,SIGNAL(emptyChanged()),this,SIGNAL(emptyChanged()));
|
||||||
connect(m,SIGNAL(expandedChanged()),this,SIGNAL(expandedChanged()));
|
connect(m,SIGNAL(expandedChanged()),this,SIGNAL(expandedChanged()));
|
||||||
connect(m,SIGNAL(stateChanged()),this,SIGNAL(stateChanged()));
|
connect(m,SIGNAL(stateChanged()),this,SIGNAL(stateChanged()));
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ public:
|
|||||||
Q_INVOKABLE int correctedCategoryIndexForModel(int modelIndex, int absoluteCategoryIndex) const;
|
Q_INVOKABLE int correctedCategoryIndexForModel(int modelIndex, int absoluteCategoryIndex) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countChanged();
|
|
||||||
void dataAvailable();
|
void dataAvailable();
|
||||||
void stateChanged();
|
void stateChanged();
|
||||||
void emptyChanged();
|
void emptyChanged();
|
||||||
|
|||||||
Reference in New Issue
Block a user