forked from qt-creator/qt-creator
QmlProfiler: Remove dead code from trace file writer
The whitelisting doesn't actually do anything useful. The trace writer uses a generic method to save range events and only needs specific code for non-ranges. The compile time checks for the sizes of MESSAGE_STRINGS and RANGE_TYPE_STRINGS make sure that you can't accidentally leave some event type unimplemented. The calculation of measured times is obsolete, too, as the only code the trace writer is called from also sets the trace time. Change-Id: Id431630114cb0a0247b774f10874c5caff761436 Task-number: QTCREATORBUG-12496 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -401,9 +401,6 @@ QmlProfilerFileWriter::QmlProfilerFileWriter(QObject *parent) :
|
||||
m_measuredTime(0),
|
||||
m_v8Model(0)
|
||||
{
|
||||
m_acceptedRangeTypes << QmlDebug::Compiling << QmlDebug::Creating << QmlDebug::Binding
|
||||
<< QmlDebug::HandlingSignal << QmlDebug::Javascript;
|
||||
m_acceptedMessages << QmlDebug::SceneGraphFrame << QmlDebug::PixmapCacheEvent;
|
||||
}
|
||||
|
||||
void QmlProfilerFileWriter::setTraceTime(qint64 startTime, qint64 endTime, qint64 measuredTime)
|
||||
@@ -423,7 +420,6 @@ void QmlProfilerFileWriter::setQmlEvents(const QVector<QmlProfilerDataModel::Qml
|
||||
{
|
||||
m_qmlEvents = types;
|
||||
m_ranges = events;
|
||||
calculateMeasuredTime();
|
||||
}
|
||||
|
||||
void QmlProfilerFileWriter::save(QIODevice *device)
|
||||
@@ -532,39 +528,6 @@ void QmlProfilerFileWriter::save(QIODevice *device)
|
||||
stream.writeEndDocument();
|
||||
}
|
||||
|
||||
void QmlProfilerFileWriter::calculateMeasuredTime()
|
||||
{
|
||||
// measured time isn't used, but old clients might still need it
|
||||
// -> we calculate it explicitly
|
||||
|
||||
qint64 duration = 0;
|
||||
|
||||
QHash<int, qint64> endtimesPerLevel;
|
||||
int level = QmlDebug::Constants::QML_MIN_LEVEL;
|
||||
endtimesPerLevel[0] = 0;
|
||||
|
||||
foreach (const QmlProfilerDataModel::QmlEventData &event, m_ranges) {
|
||||
// whitelist
|
||||
const QmlProfilerDataModel::QmlEventTypeData &type = m_qmlEvents[event.typeIndex];
|
||||
if (!m_acceptedRangeTypes.contains(type.rangeType) &&
|
||||
!m_acceptedMessages.contains(type.message))
|
||||
continue;
|
||||
|
||||
// level computation
|
||||
if (endtimesPerLevel[level] > event.startTime) {
|
||||
level++;
|
||||
} else {
|
||||
while (level > QmlDebug::Constants::QML_MIN_LEVEL && endtimesPerLevel[level-1] <= event.startTime)
|
||||
level--;
|
||||
}
|
||||
endtimesPerLevel[level] = event.startTime + event.duration;
|
||||
if (level == QmlDebug::Constants::QML_MIN_LEVEL)
|
||||
duration += event.duration;
|
||||
}
|
||||
|
||||
m_measuredTime = duration;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
|
||||
@@ -103,8 +103,6 @@ private:
|
||||
QV8ProfilerDataModel *m_v8Model;
|
||||
QVector<QmlProfilerDataModel::QmlEventTypeData> m_qmlEvents;
|
||||
QVector<QmlProfilerDataModel::QmlEventData> m_ranges;
|
||||
QVector<QmlDebug::RangeType> m_acceptedRangeTypes;
|
||||
QVector<QmlDebug::Message> m_acceptedMessages;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user