1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DPARTICLESYSTEMLOGGING_H
5#define QQUICK3DPARTICLESYSTEMLOGGING_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QObject>
19#include <QQmlEngine>
20#include <private/qglobal_p.h>
21
22#include <QtQuick3DParticles/qtquick3dparticlesglobal.h>
23
24QT_BEGIN_NAMESPACE
25
26class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleSystemLogging : public QObject
27{
28 Q_OBJECT
29 Q_PROPERTY(int loggingInterval READ loggingInterval WRITE setLoggingInterval NOTIFY loggingIntervalChanged)
30 Q_PROPERTY(int updates READ updates NOTIFY updatesChanged)
31 Q_PROPERTY(int particlesMax READ particlesMax NOTIFY particlesMaxChanged)
32 Q_PROPERTY(int particlesUsed READ particlesUsed NOTIFY particlesUsedChanged)
33 Q_PROPERTY(float time READ time NOTIFY timeChanged)
34 Q_PROPERTY(float timeAverage READ timeAverage NOTIFY timeAverageChanged)
35 Q_PROPERTY(float timeDeviation READ timeDeviation NOTIFY timeDeviationChanged REVISION(6, 3))
36 QML_ANONYMOUS
37 QML_ADDED_IN_VERSION(6, 2)
38
39public:
40 QQuick3DParticleSystemLogging(QObject *parent = nullptr);
41
42 int loggingInterval() const;
43 int updates() const;
44 int particlesMax() const;
45 int particlesUsed() const;
46 float time() const;
47 float timeAverage() const;
48 Q_REVISION(6, 3) float timeDeviation() const;
49
50public Q_SLOTS:
51 void setLoggingInterval(int interval);
52
53Q_SIGNALS:
54 void loggingIntervalChanged();
55 void updatesChanged();
56 void particlesMaxChanged();
57 void particlesUsedChanged();
58 void timeChanged();
59 void timeAverageChanged();
60 Q_REVISION(6, 3) void timeDeviationChanged();
61
62private:
63 void updateTimes(qint64 time);
64 void resetData();
65
66 friend class QQuick3DParticleSystem;
67 int m_loggingInterval = 1000;
68 int m_updates = 0;
69 int m_particlesMax = 0;
70 int m_particlesUsed = 0;
71 float m_time = 0.0f;
72 float m_timeAverage = 0.0f;
73 float m_timeDeviation = 0.0f;
74 QList<float> m_totalTimesList;
75};
76
77QT_END_NAMESPACE
78
79#endif // QQUICK3DPARTICLESYSTEMLOGGING_H
80

source code of qtquick3d/src/quick3dparticles/qquick3dparticlesystemlogging_p.h