QmlProfiler: Keep Compile and QML/JS statistics separate

The QML compiler can run asynchronously and produce ranges that don't
match up with other QML/JS ranges. The statistics model assumes that
all ranges are perfectly nested, and produces incorrect data if they
aren't. The compile ranges are perfectly nested among themselves, and
the other QML/JS ranges are also perfectly nested among themselves, so
we can fix this by keeping separate statistics for them.

Also, choose a less insane data structure for the relatives model.

Change-Id: I146593b67586e7b5aba6b19d360961c142511289
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Ulf Hermann
2016-09-08 18:26:55 +02:00
parent bf8a1c07b1
commit 0d5f5bdd6c
2 changed files with 39 additions and 43 deletions

View File

@@ -32,6 +32,7 @@
#include "qmlprofilerconstants.h"
#include <QHash>
#include <QStack>
#include <QVector>
#include <QObject>
@@ -121,7 +122,7 @@ public:
const QmlStatisticsRelativesMap &getData(int typeId) const;
const QVector<QmlEventType> &getTypes() const;
void loadEvent(const QmlEvent &event);
void loadEvent(RangeType type, const QmlEvent &event);
void finalize(const QSet<int> &eventsInBindingLoop);
QmlProfilerStatisticsRelation relation() const;
@@ -133,12 +134,12 @@ protected:
QHash <int, QmlStatisticsRelativesMap> m_data;
QmlProfilerModelManager *m_modelManager;
// for level computation
QHash<int, qint64> m_startTimesPerLevel;
int m_level = Constants::QML_MIN_LEVEL;
// compute parent-child relationship and call count
QHash<int, int> m_typesPerLevel;
struct Frame {
qint64 startTime;
int typeId;
};
QStack<Frame> m_callStack;
QStack<Frame> m_compileStack;
const QmlProfilerStatisticsRelation m_relation;
};