1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef QMLPROFILERDATA_H
5#define QMLPROFILERDATA_H
6
7#include <private/qqmlprofilerclientdefinitions_p.h>
8#include <private/qqmlprofilereventlocation_p.h>
9#include <private/qqmlprofilereventreceiver_p.h>
10
11#include <QObject>
12
13class QmlProfilerDataPrivate;
14class QmlProfilerData : public QQmlProfilerEventReceiver
15{
16 Q_OBJECT
17public:
18 enum State {
19 Empty,
20 AcquiringData,
21 ProcessingData,
22 Done
23 };
24
25 explicit QmlProfilerData(QObject *parent = nullptr);
26 ~QmlProfilerData();
27
28 int numLoadedEventTypes() const override;
29 void addEventType(const QQmlProfilerEventType &type) override;
30 void addEvent(const QQmlProfilerEvent &event) override;
31
32 static QString getHashStringForQmlEvent(const QQmlProfilerEventLocation &location, int eventType);
33 static QString qmlRangeTypeAsString(RangeType type);
34 static QString qmlMessageAsString(Message type);
35
36 qint64 traceStartTime() const;
37 qint64 traceEndTime() const;
38
39 bool isEmpty() const;
40
41 void clear();
42 void setTraceEndTime(qint64 time);
43 void setTraceStartTime(qint64 time);
44
45 void complete();
46 bool save(const QString &filename);
47
48Q_SIGNALS:
49 void error(QString);
50 void stateChanged();
51 void dataReady();
52
53private:
54 void sortStartTimes();
55 void computeQmlTime();
56 void setState(QmlProfilerData::State state);
57
58private:
59 QmlProfilerDataPrivate *d;
60};
61
62#endif // QMLPROFILERDATA_H
63

source code of qtdeclarative/tools/qmlprofiler/qmlprofilerdata.h