aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickprofiler_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/util/qquickprofiler_p.h')
-rw-r--r--src/quick/util/qquickprofiler_p.h86
1 files changed, 49 insertions, 37 deletions
diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h
index 6b6e7fa062..b58d4f47c1 100644
--- a/src/quick/util/qquickprofiler_p.h
+++ b/src/quick/util/qquickprofiler_p.h
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,13 +51,14 @@
// We mean it.
//
-#include <private/qtquickglobal_p.h>
#include <QtCore/private/qabstractanimation_p.h>
-#include <QtQml/private/qqmlabstractprofileradapter_p.h>
-#include <QUrl>
-#include <QSize>
-#include <QMutex>
-#include <QThreadStorage>
+#include <QtQml/private/qqmlprofilerdefinitions_p.h>
+#include <QtQuick/private/qtquickglobal_p.h>
+
+#include <QtCore/qurl.h>
+#include <QtCore/qsize.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qthreadstorage.h>
QT_BEGIN_NAMESPACE
@@ -97,8 +104,9 @@ QT_BEGIN_NAMESPACE
(QQuickProfiler::reportSceneGraphFrame<Type, true>(Payload)))
-#define Q_QUICK_INPUT_PROFILE(Method)\
- Q_QUICK_PROFILE(QQuickProfiler::ProfileInputEvents, Method)
+#define Q_QUICK_INPUT_PROFILE(Type, DetailType, A, B)\
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileInputEvents,\
+ (QQuickProfiler::inputEvent<Type, DetailType>(A, B)))
// This struct is somewhat dangerous to use:
// You can save values either with 32 or 64 bit precision. toByteArrays will
@@ -117,10 +125,10 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData
time(time), messageType(messageType), detailType(detailType), detailUrl(url), x(x), y(y),
framerate(framerate), count(count) {}
- QQuickProfilerData(qint64 time, int messageType, int detailType, int framerate = 0,
- int count = 0, int threadId = 0) :
- time(time), messageType(messageType), detailType(detailType), framerate(framerate),
- count(count), threadId(threadId) {}
+ QQuickProfilerData(qint64 time, int messageType, int detailType, int framerateOrInputType = 0,
+ int countOrInputA = 0, int threadIdOrInputB = 0) :
+ time(time), messageType(messageType), detailType(detailType),
+ framerate(framerateOrInputType), count(countOrInputA), threadId(threadIdOrInputB) {}
// Special ctor for scenegraph frames. Note that it's missing the QString/QUrl params.
// This is slightly ugly, but makes it easier to disambiguate between int and qint64 params.
@@ -149,19 +157,20 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData
union {
qint64 subtime_3;
int framerate; //used by animation events
+ int inputType;
};
union {
qint64 subtime_4;
int count; //used by animation events and for pixmaps
+ int inputA; //used by input events
};
union {
qint64 subtime_5;
int threadId;
+ int inputB; //used by input events
};
-
- void toByteArrays(QList<QByteArray> &messages) const;
};
Q_DECLARE_TYPEINFO(QQuickProfilerData, Q_MOVABLE_TYPE);
@@ -199,7 +208,7 @@ public:
}
};
-class Q_QUICK_PRIVATE_EXPORT QQuickProfiler : public QQmlAbstractProfilerAdapter {
+class Q_QUICK_PRIVATE_EXPORT QQuickProfiler : public QObject, public QQmlProfilerDefinitions {
Q_OBJECT
public:
@@ -208,11 +217,11 @@ public:
RenderThread
};
- template<EventType DetailType>
- static void addEvent()
+ template<EventType DetailType, InputEventType InputType>
+ static void inputEvent(int x, int y = 0)
{
s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), 1 << Event,
- 1 << DetailType));
+ 1 << DetailType, InputType, x, y));
}
static void animationFrame(qint64 delta, AnimationThread threadId)
@@ -310,7 +319,6 @@ public:
qint64 timestamp() { return m_timer.nsecsElapsed(); }
- qint64 sendMessages(qint64 until, QList<QByteArray> &messages);
static quint64 featuresEnabled;
static bool profilingSceneGraph()
@@ -318,19 +326,20 @@ public:
return featuresEnabled & (1 << QQuickProfiler::ProfileSceneGraph);
}
- static void initialize(QQmlProfilerService *service);
+ static void initialize(QObject *parent);
virtual ~QQuickProfiler();
protected:
- int next;
+ friend class QQuickProfilerAdapter;
+
static QQuickProfiler *s_instance;
QMutex m_dataMutex;
QElapsedTimer m_timer;
- QVarLengthArray<QQuickProfilerData> m_data;
+ QVector<QQuickProfilerData> m_data;
QQuickProfilerSceneGraphData m_sceneGraphData;
- QQuickProfiler(QQmlProfilerService *service);
+ QQuickProfiler(QObject *parent);
void processMessage(const QQuickProfilerData &message)
{
@@ -338,6 +347,9 @@ protected:
m_data.append(message);
}
+signals:
+ void dataReady(const QVector<QQuickProfilerData> &data);
+
protected slots:
void startProfilingImpl(quint64 features);
void stopProfilingImpl();