Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlabstractprofileradapter.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
5
#
include
"qqmlabstractprofileradapter_p.h"
6
7
QT_BEGIN_NAMESPACE
8
9
/*!
10
* \internal
11
* \class QQmlAbstractProfilerAdapter
12
* \inmodule QtQml
13
* Abstract base class for all adapters between profilers and the QQmlProfilerService. Adapters have
14
* to retrieve profiler-specific data and convert it to the format sent over the wire. Adapters must
15
* live in the QDebugServer thread but the actual profilers can live in different threads. The
16
* recommended way to deal with this is passing the profiling data through a signal/slot connection.
17
*/
18
19
/*!
20
* \internal
21
* \fn void QQmlAbstractProfilerAdapter::dataRequested()
22
* Signals that data has been requested by the \c QQmlProfilerService. This signal should be
23
* connected to a slot in the profiler and the profiler should then transfer its currently available
24
* profiling data to the adapter as soon as possible.
25
*/
26
27
/*!
28
* \internal
29
* \fn qint64 QQmlAbstractProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages)
30
* Append the messages up to the timestamp \a until, chronologically sorted, to \a messages. Keep
31
* track of the messages already sent and with each subsequent call to this method start with the
32
* first one not yet sent. Messages that have been sent can be deleted. When new data from the
33
* profiler arrives the information about the last sent message must be reset. Return the timestamp
34
* of the next message after \a until or \c -1 if there is no such message.
35
* The profiler service keeps a list of adapters, sorted by time of next message and keeps querying
36
* the first one to send messages up to the time of the second one. Like that we get chronologically
37
* sorted messages and can occasionally post the messages to exploit parallelism and save memory.
38
*/
39
40
/*!
41
* \internal
42
* Emits either \c profilingEnabled(quint64) or \c profilingEnabledWhileWaiting(quint64), depending
43
* on \c waiting. If the profiler's thread is waiting for an initial start signal, we can emit the
44
* signal over a Qt::DirectConnection to avoid the delay of the event loop. The \a features are
45
* passed on to the signal.
46
*/
47
void
QQmlAbstractProfilerAdapter::startProfiling(quint64 features)
48
{
49
if
(waiting)
50
emit profilingEnabledWhileWaiting(features);
51
else
52
emit profilingEnabled(features);
53
featuresEnabled = features;
54
running =
true
;
55
}
56
57
/*!
58
* \internal
59
* Emits either \c profilingDisabled() or \c profilingDisabledWhileWaiting(), depending on
60
* \c waiting. If the profiler's thread is waiting for an initial start signal, we can emit the
61
* signal over a Qt::DirectConnection to avoid the delay of the event loop. This should trigger
62
* the profiler to report its collected data and subsequently delete it.
63
*/
64
void
QQmlAbstractProfilerAdapter::stopProfiling() {
65
if
(waiting)
66
emit profilingDisabledWhileWaiting();
67
else
68
emit profilingDisabled();
69
featuresEnabled = 0;
70
running =
false
;
71
}
72
73
/*!
74
* \internal
75
* \fn bool QQmlAbstractProfilerAdapter::isRunning() const
76
* Returns if the profiler is currently running. The profiler is considered to be running after
77
* \c startProfiling(quint64) has been called until \c stopProfiling() is called. That is
78
* independent of \c waiting. The profiler may be running and waiting at the same time.
79
*/
80
81
/*!
82
* \internal
83
* \fn void QQmlAbstractProfilerAdapter::profilingDisabled()
84
* This signal is emitted if \c stopProfiling() is called while the profiler is not considered to
85
* be waiting. The profiler is expected to handle the signal asynchronously.
86
*/
87
88
/*!
89
* \internal
90
* \fn void QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting()
91
* This signal is emitted if \c stopProfiling() is called while the profiler is considered to be
92
* waiting. In many cases this signal can be connected with a Qt::DirectConnection.
93
*/
94
95
/*!
96
* \internal
97
* \fn void QQmlAbstractProfilerAdapter::profilingEnabled(quint64 features)
98
* This signal is emitted if \c startProfiling(quint64) is called while the profiler is not
99
* considered to be waiting. The profiler is expected to handle the signal asynchronously. The
100
* \a features are passed on from \c startProfiling(quint64).
101
*/
102
103
/*!
104
* \internal
105
* \fn void QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting(quint64 features)
106
* This signal is emitted if \c startProfiling(quint64) is called while the profiler is considered
107
* to be waiting. In many cases this signal can be connected with a Qt::DirectConnection. By
108
* starting the profiler synchronously when the QML engine starts instead of waiting for the first
109
* iteration of the event loop the engine startup can be profiled. The \a features are passed on
110
* from \c startProfiling(quint64).
111
*/
112
113
/*!
114
* \internal
115
* \fn void QQmlAbstractProfilerAdapter::referenceTimeKnown(const QElapsedTimer &timer)
116
* This signal is used to synchronize the profiler's timer to the QQmlProfilerservice's. The
117
* profiler is expected to save \a timer and use it for timestamps on its data.
118
*/
119
120
/*!
121
* \internal
122
* \fn void QQmlAbstractProfilerAdapter::synchronize(const QElapsedTimer &timer)
123
* Synchronize the profiler to \a timer. This emits \c referenceTimeKnown().
124
*/
125
126
/*!
127
* \internal
128
* \fn void QQmlAbstractProfilerAdapter::reportData()
129
* Make the profiler report its current data without stopping the collection. The same (and
130
* additional) data can later be requested again with \c stopProfiling() or \c reportData().
131
*/
132
133
/*!
134
* \internal
135
* \fn void QQmlAbstractProfilerAdapter::startWaiting()
136
* Consider the profiler to be waiting from now on. While the profiler is waiting it can be directly
137
* accessed even if it is in a different thread. This method should only be called if it is actually
138
* safe to do so.
139
*/
140
141
/*!
142
* \internal
143
* \fn void QQmlAbstractProfilerAdapter::stopWaiting()
144
* Consider the profiler not to be waiting anymore. If it lives in a different threads any requests
145
* for it have to be done via a queued connection then.
146
*/
147
148
QT_END_NAMESPACE
149
150
#
include
"moc_qqmlabstractprofileradapter_p.cpp"
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
qtdeclarative
src
qml
debugger
qqmlabstractprofileradapter.cpp
Generated on
for Qt by
1.16.1