QmlProfiler: Change total time and recursion display in statistics

The total time taken for a program should be the sum of durations of
events on the bottom of the stack. This is also what the flame graph
model does, and it results in useful percentages for total and self
times.

Recursion still has to be accounted for when showing the total time of
a specific event type, but we mark events with recursive calls and
show the time and percentage of recursion in the tooltip. As we already
showed binding loops on bindings and signal handlers before, this
integrates nicely.

Change-Id: Id4654e314bf86ce8bd06ceaaf93a67187c629adc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Ulf Hermann
2016-12-28 18:12:49 +01:00
parent 548a86f577
commit 9f0a51a0d1
3 changed files with 63 additions and 87 deletions

View File

@@ -50,22 +50,20 @@ class QmlProfilerStatisticsModel : public QObject
Q_OBJECT
public:
struct QmlEventStats {
QmlEventStats() : duration(0), durationSelf(0), calls(0),
minTime(std::numeric_limits<qint64>::max()), maxTime(0), timePerCall(0),
percentOfTime(0), percentSelf(0), medianTime(0), isBindingLoop(false) {}
QmlEventStats() : duration(0), durationSelf(0), durationRecursive(0), calls(0),
minTime(std::numeric_limits<qint64>::max()), maxTime(0), medianTime(0) {}
qint64 duration;
qint64 durationSelf;
qint64 durationRecursive;
qint64 calls;
qint64 minTime;
qint64 maxTime;
qint64 timePerCall;
double percentOfTime;
double percentSelf;
qint64 medianTime;
bool isBindingLoop;
};
double durationPercent(int typeId) const;
double durationSelfPercent(int typeId) const;
QmlProfilerStatisticsModel(QmlProfilerModelManager *modelManager, QObject *parent = 0);
~QmlProfilerStatisticsModel();
@@ -107,7 +105,7 @@ public:
struct QmlStatisticsRelativesData {
qint64 duration;
qint64 calls;
bool isBindingLoop;
bool isRecursive;
};
typedef QHash <int, QmlStatisticsRelativesData> QmlStatisticsRelativesMap;
@@ -122,8 +120,7 @@ public:
const QmlStatisticsRelativesMap &getData(int typeId) const;
const QVector<QmlEventType> &getTypes() const;
void loadEvent(RangeType type, const QmlEvent &event);
void finalize(const QSet<int> &eventsInBindingLoop);
void loadEvent(RangeType type, const QmlEvent &event, bool isRecursive);
QmlProfilerStatisticsRelation relation() const;