Commit 70aa948f authored by Ulf Hermann's avatar Ulf Hermann
Browse files

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: default avatarKai Koehne <kai.koehne@digia.com>
parent abb55de9
......@@ -101,7 +101,6 @@ public:
Q_INVOKABLE virtual int getEventIdForLocation(const QString &filename, int line, int column) const = 0;
signals:
void countChanged();
void dataAvailable();
void stateChanged();
void emptyChanged();
......
......@@ -38,9 +38,7 @@ Rectangle {
property int singleRowHeight: 30
property bool dataAvailable: true
property int eventCount: 0
property real progress: 0
property alias selectionLocked : view.selectionLocked
signal updateLockButton
......@@ -88,39 +86,14 @@ Rectangle {
Connections {
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: {
switch (qmlProfilerModelProxy.getState()) {
case 0: {
// Clear if model is empty.
if (qmlProfilerModelProxy.getState() === 0)
root.clearAll();
break;
}
case 1: {
root.dataAvailable = false;
break;
}
case 2: {
root.progress = 0.9; // jump to 90%
break;
}
}
}
onDataAvailable: {
view.clearData();
zoomControl.setRange(0,0);
progress = 1.0;
dataAvailable = true;
view.visible = true;
view.requestPaint();
zoomControl.setRange(qmlProfilerModelProxy.traceStartTime(),
......@@ -142,7 +115,6 @@ Rectangle {
function clearData() {
view.clearData();
dataAvailable = false;
appKilled = false;
eventCount = 0;
hideRangeDetails();
......
......@@ -148,6 +148,7 @@ public:
QVector <int> partialCountWeights;
int totalWeight;
double progress;
double previousProgress;
qint64 estimatedTime;
// file to load
......@@ -227,7 +228,11 @@ void QmlProfilerModelManager::modelProxyCountUpdated(int proxyId, qint64 count,
d->progress += d->partialCounts[proxyId] * d->partialCountWeights[proxyId] /
d->totalWeight;
emit progressChanged();
if (d->progress - d->previousProgress > 0.01) {
d->previousProgress = d->progress;
emit progressChanged();
}
}
qint64 QmlProfilerModelManager::estimatedProfilingTime() const
......@@ -258,7 +263,6 @@ void QmlProfilerModelManager::addQmlEvent(int type,
QTC_ASSERT(state() == QmlProfilerDataState::AcquiringData, /**/);
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,
......@@ -374,11 +378,11 @@ void QmlProfilerModelManager::clear()
for (int i = 0; i < d->partialCounts.count(); i++)
d->partialCounts[i] = 0;
d->progress = 0;
d->previousProgress = 0;
d->model->clear();
d->v8Model->clear();
d->traceTime->clear();
emit countChanged();
setState(QmlProfilerDataState::Empty);
}
......
......@@ -123,7 +123,6 @@ public:
qint64 estimatedProfilingTime() const;
signals:
void countChanged();
void error(const QString &error);
void stateChanged();
void progressChanged();
......
......@@ -158,8 +158,6 @@ void PaintEventsModelProxy::loadData()
d->computeNesting();
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
emit countChanged();
}
/////////////////// QML interface
......
......@@ -94,7 +94,6 @@ QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateMan
// profiler state
d->m_modelManager = modelManager;
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(this, SIGNAL(newTimeEstimation(qint64)), d->m_modelManager, SLOT(newTimeEstimation(qint64)));
d->m_profilerState = stateManager;
......
......@@ -194,8 +194,6 @@ void BasicTimelineModel::loadData()
d->computeRowStarts();
m_modelManager->modelProxyCountUpdated(m_modelId, 1, 1);
emit countChanged();
}
void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted()
......
......@@ -66,7 +66,6 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
{
d->modelManager = modelManager;
connect(modelManager,SIGNAL(stateChanged()),this,SLOT(dataChanged()));
connect(modelManager,SIGNAL(countChanged()),this,SIGNAL(countChanged()));
connect(modelManager,SIGNAL(dataAvailable()),this,SIGNAL(dataAvailable()));
// external models pushed on top
......@@ -90,7 +89,6 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
void TimelineModelAggregator::addModel(AbstractTimelineModel *m)
{
d->modelList << m;
connect(m,SIGNAL(countChanged()),this,SIGNAL(countChanged()));
connect(m,SIGNAL(emptyChanged()),this,SIGNAL(emptyChanged()));
connect(m,SIGNAL(expandedChanged()),this,SIGNAL(expandedChanged()));
connect(m,SIGNAL(stateChanged()),this,SIGNAL(stateChanged()));
......
......@@ -102,7 +102,6 @@ public:
Q_INVOKABLE int correctedCategoryIndexForModel(int modelIndex, int absoluteCategoryIndex) const;
signals:
void countChanged();
void dataAvailable();
void stateChanged();
void emptyChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment