| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qmldebug/qqmlprofilerclient.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtQml module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
| 24 | ** | - | ||||||
| 25 | ** GNU General Public License Usage | - | ||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
| 35 | ** | - | ||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||
| 37 | ** | - | ||||||
| 38 | ****************************************************************************/ | - | ||||||
| 39 | - | |||||||
| 40 | #include "qqmlprofilerclient_p_p.h" | - | ||||||
| 41 | #include "qqmldebugconnection_p.h" | - | ||||||
| 42 | - | |||||||
| 43 | QT_BEGIN_NAMESPACE | - | ||||||
| 44 | - | |||||||
| 45 | QQmlProfilerClientPrivate::~QQmlProfilerClientPrivate() | - | ||||||
| 46 | { | - | ||||||
| 47 | } | - | ||||||
| 48 | - | |||||||
| 49 | int QQmlProfilerClientPrivate::resolveType(const QQmlProfilerTypedEvent &event) | - | ||||||
| 50 | { | - | ||||||
| 51 | int typeIndex = -1; | - | ||||||
| 52 | if (event.serverTypeId != 0) {
| 296-594 | ||||||
| 53 | QHash<qint64, int>::ConstIterator it = serverTypeIds.constFind(event.serverTypeId); | - | ||||||
| 54 | - | |||||||
| 55 | if (it != serverTypeIds.constEnd()) {
| 86-210 | ||||||
| 56 | typeIndex = it.value(); | - | ||||||
| 57 | } else { executed 210 times by 1 test: end of blockExecuted by:
| 210 | ||||||
| 58 | typeIndex = eventReceiver->numLoadedEventTypes(); | - | ||||||
| 59 | eventReceiver->addEventType(event.type); | - | ||||||
| 60 | serverTypeIds[event.serverTypeId] = typeIndex; | - | ||||||
| 61 | } executed 86 times by 1 test: end of blockExecuted by:
| 86 | ||||||
| 62 | } else { | - | ||||||
| 63 | QHash<QQmlProfilerEventType, int>::ConstIterator it = eventTypeIds.constFind(event.type); | - | ||||||
| 64 | - | |||||||
| 65 | if (it != eventTypeIds.constEnd()) {
| 132-462 | ||||||
| 66 | typeIndex = it.value(); | - | ||||||
| 67 | } else { executed 462 times by 1 test: end of blockExecuted by:
| 462 | ||||||
| 68 | typeIndex = eventReceiver->numLoadedEventTypes(); | - | ||||||
| 69 | eventReceiver->addEventType(event.type); | - | ||||||
| 70 | eventTypeIds[event.type] = typeIndex; | - | ||||||
| 71 | } executed 132 times by 1 test: end of blockExecuted by:
| 132 | ||||||
| 72 | } | - | ||||||
| 73 | return typeIndex; executed 890 times by 1 test: return typeIndex;Executed by:
| 890 | ||||||
| 74 | } | - | ||||||
| 75 | - | |||||||
| 76 | int QQmlProfilerClientPrivate::resolveStackTop() | - | ||||||
| 77 | { | - | ||||||
| 78 | if (rangesInProgress.isEmpty())
| 159-435 | ||||||
| 79 | return -1; executed 159 times by 1 test: return -1;Executed by:
| 159 | ||||||
| 80 | - | |||||||
| 81 | QQmlProfilerTypedEvent &typedEvent = rangesInProgress.top(); | - | ||||||
| 82 | int typeIndex = typedEvent.event.typeIndex(); | - | ||||||
| 83 | if (typeIndex >= 0)
| 139-296 | ||||||
| 84 | return typeIndex; executed 139 times by 1 test: return typeIndex;Executed by:
| 139 | ||||||
| 85 | - | |||||||
| 86 | typeIndex = resolveType(typedEvent); | - | ||||||
| 87 | typedEvent.event.setTypeIndex(typeIndex); | - | ||||||
| 88 | while (!pendingMessages.isEmpty()
| 78-260 | ||||||
| 89 | && pendingMessages.head().timestamp() < typedEvent.event.timestamp()) {
| 36-42 | ||||||
| 90 | forwardEvents(pendingMessages.dequeue()); | - | ||||||
| 91 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||
| 92 | forwardEvents(typedEvent.event); | - | ||||||
| 93 | return typeIndex; executed 296 times by 1 test: return typeIndex;Executed by:
| 296 | ||||||
| 94 | } | - | ||||||
| 95 | - | |||||||
| 96 | void QQmlProfilerClientPrivate::forwardEvents(const QQmlProfilerEvent &last) | - | ||||||
| 97 | { | - | ||||||
| 98 | while (!pendingDebugMessages.isEmpty()
| 182-554 | ||||||
| 99 | && pendingDebugMessages.front().timestamp() <= last.timestamp()) {
| 16-166 | ||||||
| 100 | eventReceiver->addEvent(pendingDebugMessages.dequeue()); | - | ||||||
| 101 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||
| 102 | eventReceiver->addEvent(last); | - | ||||||
| 103 | } executed 720 times by 1 test: end of blockExecuted by:
| 720 | ||||||
| 104 | - | |||||||
| 105 | void QQmlProfilerClientPrivate::processCurrentEvent() | - | ||||||
| 106 | { | - | ||||||
| 107 | // RangeData and RangeLocation always apply to the range on the top of the stack. Furthermore, | - | ||||||
| 108 | // all ranges are perfectly nested. This is why we can defer the type resolution until either | - | ||||||
| 109 | // the range ends or a child range starts. With only the information in RangeStart we wouldn't | - | ||||||
| 110 | // be able to uniquely identify the event type. | - | ||||||
| 111 | Message rangeStage = currentEvent.type.rangeType() == MaximumRangeType ?
| 594-744 | ||||||
| 112 | currentEvent.type.message() : currentEvent.event.rangeStage(); | - | ||||||
| 113 | switch (rangeStage) { | - | ||||||
| 114 | case RangeStart: executed 296 times by 1 test: case RangeStart:Executed by:
| 296 | ||||||
| 115 | resolveStackTop(); | - | ||||||
| 116 | rangesInProgress.push(currentEvent); | - | ||||||
| 117 | break; executed 296 times by 1 test: break;Executed by:
| 296 | ||||||
| 118 | case RangeEnd: { executed 298 times by 1 test: case RangeEnd:Executed by:
| 298 | ||||||
| 119 | int typeIndex = resolveStackTop(); | - | ||||||
| 120 | if (typeIndex == -1)
| 2-296 | ||||||
| 121 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 122 | currentEvent.event.setTypeIndex(typeIndex); | - | ||||||
| 123 | while (!pendingMessages.isEmpty())
| 86-296 | ||||||
| 124 | forwardEvents(pendingMessages.dequeue()); executed 86 times by 1 test: forwardEvents(pendingMessages.dequeue());Executed by:
| 86 | ||||||
| 125 | forwardEvents(currentEvent.event); | - | ||||||
| 126 | rangesInProgress.pop(); | - | ||||||
| 127 | break; executed 296 times by 1 test: break;Executed by:
| 296 | ||||||
| 128 | } | - | ||||||
| 129 | case RangeData: executed 64 times by 1 test: case RangeData:Executed by:
| 64 | ||||||
| 130 | if (!rangesInProgress.isEmpty())
| 0-64 | ||||||
| 131 | rangesInProgress.top().type.setData(currentEvent.type.data()); executed 64 times by 1 test: rangesInProgress.top().type.setData(currentEvent.type.data());Executed by:
| 64 | ||||||
| 132 | break; executed 64 times by 1 test: break;Executed by:
| 64 | ||||||
| 133 | case RangeLocation: executed 86 times by 1 test: case RangeLocation:Executed by:
| 86 | ||||||
| 134 | if (!rangesInProgress.isEmpty())
| 0-86 | ||||||
| 135 | rangesInProgress.top().type.setLocation(currentEvent.type.location()); executed 86 times by 1 test: rangesInProgress.top().type.setLocation(currentEvent.type.location());Executed by:
| 86 | ||||||
| 136 | break; executed 86 times by 1 test: break;Executed by:
| 86 | ||||||
| 137 | case DebugMessage: executed 18 times by 1 test: case DebugMessage:Executed by:
| 18 | ||||||
| 138 | currentEvent.event.setTypeIndex(resolveType(currentEvent)); | - | ||||||
| 139 | pendingDebugMessages.enqueue(currentEvent.event); | - | ||||||
| 140 | break; executed 18 times by 1 test: break;Executed by:
| 18 | ||||||
| 141 | default: { executed 576 times by 1 test: default:Executed by:
| 576 | ||||||
| 142 | int typeIndex = resolveType(currentEvent); | - | ||||||
| 143 | currentEvent.event.setTypeIndex(typeIndex); | - | ||||||
| 144 | if (rangesInProgress.isEmpty())
| 128-448 | ||||||
| 145 | eventReceiver->addEvent(currentEvent.event); executed 448 times by 1 test: eventReceiver->addEvent(currentEvent.event);Executed by:
| 448 | ||||||
| 146 | else | - | ||||||
| 147 | pendingMessages.enqueue(currentEvent.event); executed 128 times by 1 test: pendingMessages.enqueue(currentEvent.event);Executed by:
| 128 | ||||||
| 148 | break; executed 576 times by 1 test: break;Executed by:
| 576 | ||||||
| 149 | } | - | ||||||
| 150 | } | - | ||||||
| 151 | } | - | ||||||
| 152 | - | |||||||
| 153 | void QQmlProfilerClientPrivate::sendRecordingStatus(int engineId) | - | ||||||
| 154 | { | - | ||||||
| 155 | Q_Q(QQmlProfilerClient); | - | ||||||
| 156 | QPacket stream(connection->currentDataStreamVersion()); | - | ||||||
| 157 | stream << recording << engineId; // engineId -1 is OK. It means "all of them" | - | ||||||
| 158 | if (recording) {
| 40-60 | ||||||
| 159 | stream << requestedFeatures << flushInterval; | - | ||||||
| 160 | stream << true; // yes, we support type IDs | - | ||||||
| 161 | } executed 60 times by 1 test: end of blockExecuted by:
| 60 | ||||||
| 162 | q->sendMessage(stream.data()); | - | ||||||
| 163 | } executed 100 times by 1 test: end of blockExecuted by:
| 100 | ||||||
| 164 | - | |||||||
| 165 | QQmlProfilerClient::QQmlProfilerClient(QQmlDebugConnection *connection, | - | ||||||
| 166 | QQmlProfilerEventReceiver *eventReceiver, | - | ||||||
| 167 | quint64 features) | - | ||||||
| 168 | : QQmlDebugClient(*(new QQmlProfilerClientPrivate(connection, eventReceiver))) | - | ||||||
| 169 | { | - | ||||||
| 170 | Q_D(QQmlProfilerClient); | - | ||||||
| 171 | setRequestedFeatures(features); | - | ||||||
| 172 | connect(this, &QQmlDebugClient::stateChanged, this, &QQmlProfilerClient::onStateChanged); | - | ||||||
| 173 | connect(d->engineControl.data(), &QQmlEngineControlClient::engineAboutToBeAdded, | - | ||||||
| 174 | this, &QQmlProfilerClient::sendRecordingStatus); | - | ||||||
| 175 | connect(d->engineControl.data(), &QQmlEngineControlClient::engineAboutToBeRemoved, | - | ||||||
| 176 | this, [d](int engineId) { | - | ||||||
| 177 | // We may already be done with that engine. Then we don't need to block it. | - | ||||||
| 178 | if (d->trackedEngines.contains(engineId))
| 2-4 | ||||||
| 179 | d->engineControl->blockEngine(engineId); executed 4 times by 1 test: d->engineControl->blockEngine(engineId);Executed by:
| 4 | ||||||
| 180 | }); executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||
| 181 | connect(this, &QQmlProfilerClient::traceFinished, | - | ||||||
| 182 | d->engineControl.data(), [d](qint64 timestamp, const QList<int> &engineIds) { | - | ||||||
| 183 | Q_UNUSED(timestamp); | - | ||||||
| 184 | // The engines might not be blocked because the trace can get finished before engine control | - | ||||||
| 185 | // sees them. | - | ||||||
| 186 | for (int blocked : d->engineControl->blockedEngines()) { | - | ||||||
| 187 | if (engineIds.contains(blocked))
| 0-4 | ||||||
| 188 | d->engineControl->releaseEngine(blocked); executed 4 times by 1 test: d->engineControl->releaseEngine(blocked);Executed by:
| 4 | ||||||
| 189 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||
| 190 | }); executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||
| 191 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||
| 192 | - | |||||||
| 193 | QQmlProfilerClient::~QQmlProfilerClient() | - | ||||||
| 194 | { | - | ||||||
| 195 | //Disable profiling if started by client | - | ||||||
| 196 | //Profiling data will be lost!! | - | ||||||
| 197 | if (isRecording())
| 8-28 | ||||||
| 198 | setRecording(false); executed 8 times by 1 test: setRecording(false);Executed by:
| 8 | ||||||
| 199 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||
| 200 | - | |||||||
| 201 | void QQmlProfilerClient::clearEvents() | - | ||||||
| 202 | { | - | ||||||
| 203 | Q_D(QQmlProfilerClient); | - | ||||||
| 204 | d->rangesInProgress.clear(); | - | ||||||
| 205 | d->pendingMessages.clear(); | - | ||||||
| 206 | d->pendingDebugMessages.clear(); | - | ||||||
| 207 | if (d->recordedFeatures != 0) {
| 0 | ||||||
| 208 | d->recordedFeatures = 0; | - | ||||||
| 209 | emit recordedFeaturesChanged(0); | - | ||||||
| 210 | } never executed: end of block | 0 | ||||||
| 211 | emit cleared(); | - | ||||||
| 212 | } never executed: end of block | 0 | ||||||
| 213 | - | |||||||
| 214 | void QQmlProfilerClient::clearAll() | - | ||||||
| 215 | { | - | ||||||
| 216 | Q_D(QQmlProfilerClient); | - | ||||||
| 217 | d->serverTypeIds.clear(); | - | ||||||
| 218 | d->eventTypeIds.clear(); | - | ||||||
| 219 | d->trackedEngines.clear(); | - | ||||||
| 220 | clearEvents(); | - | ||||||
| 221 | } never executed: end of block | 0 | ||||||
| 222 | - | |||||||
| 223 | void QQmlProfilerClientPrivate::finalize() | - | ||||||
| 224 | { | - | ||||||
| 225 | while (!rangesInProgress.isEmpty()) {
| 2-34 | ||||||
| 226 | currentEvent = rangesInProgress.top(); | - | ||||||
| 227 | currentEvent.event.setRangeStage(RangeEnd); | - | ||||||
| 228 | currentEvent.event.setTimestamp(maximumTime); | - | ||||||
| 229 | processCurrentEvent(); | - | ||||||
| 230 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 231 | while (!pendingDebugMessages.isEmpty())
| 0-34 | ||||||
| 232 | eventReceiver->addEvent(pendingDebugMessages.dequeue()); never executed: eventReceiver->addEvent(pendingDebugMessages.dequeue()); | 0 | ||||||
| 233 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||
| 234 | - | |||||||
| 235 | - | |||||||
| 236 | void QQmlProfilerClient::sendRecordingStatus(int engineId) | - | ||||||
| 237 | { | - | ||||||
| 238 | Q_D(QQmlProfilerClient); | - | ||||||
| 239 | d->sendRecordingStatus(engineId); | - | ||||||
| 240 | } executed 100 times by 1 test: end of blockExecuted by:
| 100 | ||||||
| 241 | - | |||||||
| 242 | bool QQmlProfilerClient::isRecording() const | - | ||||||
| 243 | { | - | ||||||
| 244 | Q_D(const QQmlProfilerClient); | - | ||||||
| 245 | return d->recording; executed 36 times by 1 test: return d->recording;Executed by:
| 36 | ||||||
| 246 | } | - | ||||||
| 247 | - | |||||||
| 248 | void QQmlProfilerClient::setRecording(bool v) | - | ||||||
| 249 | { | - | ||||||
| 250 | Q_D(QQmlProfilerClient); | - | ||||||
| 251 | if (v == d->recording)
| 12-68 | ||||||
| 252 | return; executed 12 times by 1 test: return;Executed by:
| 12 | ||||||
| 253 | - | |||||||
| 254 | d->recording = v; | - | ||||||
| 255 | - | |||||||
| 256 | if (state() == Enabled)
| 32-36 | ||||||
| 257 | sendRecordingStatus(); executed 36 times by 1 test: sendRecordingStatus();Executed by:
| 36 | ||||||
| 258 | - | |||||||
| 259 | emit recordingChanged(v); | - | ||||||
| 260 | } executed 68 times by 1 test: end of blockExecuted by:
| 68 | ||||||
| 261 | - | |||||||
| 262 | quint64 QQmlProfilerClient::recordedFeatures() const | - | ||||||
| 263 | { | - | ||||||
| 264 | Q_D(const QQmlProfilerClient); | - | ||||||
| 265 | return d->recordedFeatures; never executed: return d->recordedFeatures; | 0 | ||||||
| 266 | } | - | ||||||
| 267 | - | |||||||
| 268 | void QQmlProfilerClient::setRequestedFeatures(quint64 features) | - | ||||||
| 269 | { | - | ||||||
| 270 | Q_D(QQmlProfilerClient); | - | ||||||
| 271 | d->requestedFeatures = features; | - | ||||||
| 272 | if (features & static_cast<quint64>(1) << ProfileDebugMessages) {
| 0-36 | ||||||
| 273 | if (d->messageClient.isNull()) {
| 0-36 | ||||||
| 274 | d->messageClient.reset(new QQmlDebugMessageClient(connection())); | - | ||||||
| 275 | connect(d->messageClient.data(), &QQmlDebugMessageClient::message, this, | - | ||||||
| 276 | [this](QtMsgType type, const QString &text, const QQmlDebugContextInfo &context) | - | ||||||
| 277 | { | - | ||||||
| 278 | Q_D(QQmlProfilerClient); | - | ||||||
| 279 | d->updateFeatures(ProfileDebugMessages); | - | ||||||
| 280 | d->currentEvent.event.setTimestamp(context.timestamp > 0 ? context.timestamp : 0); | - | ||||||
| 281 | d->currentEvent.event.setTypeIndex(-1); | - | ||||||
| 282 | d->currentEvent.event.setString(text); | - | ||||||
| 283 | d->currentEvent.type = QQmlProfilerEventType( | - | ||||||
| 284 | DebugMessage, MaximumRangeType, type, | - | ||||||
| 285 | QQmlProfilerEventLocation(context.file, context.line, 1)); | - | ||||||
| 286 | d->currentEvent.serverTypeId = 0; | - | ||||||
| 287 | d->processCurrentEvent(); | - | ||||||
| 288 | }); executed 18 times by 1 test: end of blockExecuted by:
| 18 | ||||||
| 289 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||
| 290 | } else { executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||
| 291 | d->messageClient.reset(); | - | ||||||
| 292 | } never executed: end of block | 0 | ||||||
| 293 | } | - | ||||||
| 294 | - | |||||||
| 295 | void QQmlProfilerClient::setFlushInterval(quint32 flushInterval) | - | ||||||
| 296 | { | - | ||||||
| 297 | Q_D(QQmlProfilerClient); | - | ||||||
| 298 | d->flushInterval = flushInterval; | - | ||||||
| 299 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||
| 300 | - | |||||||
| 301 | QQmlProfilerClient::QQmlProfilerClient(QQmlProfilerClientPrivate &dd) : | - | ||||||
| 302 | QQmlDebugClient(dd) | - | ||||||
| 303 | { | - | ||||||
| 304 | Q_D(QQmlProfilerClient); | - | ||||||
| 305 | connect(d->engineControl.data(), &QQmlEngineControlClient::engineAboutToBeAdded, | - | ||||||
| 306 | this, &QQmlProfilerClient::sendRecordingStatus); | - | ||||||
| 307 | } never executed: end of block | 0 | ||||||
| 308 | - | |||||||
| 309 | bool QQmlProfilerClientPrivate::updateFeatures(ProfileFeature feature) | - | ||||||
| 310 | { | - | ||||||
| 311 | Q_Q(QQmlProfilerClient); | - | ||||||
| 312 | quint64 flag = 1ULL << feature; | - | ||||||
| 313 | if (!(requestedFeatures & flag))
| 0-1336 | ||||||
| 314 | return false; never executed: return false; | 0 | ||||||
| 315 | if (!(recordedFeatures & flag)) {
| 124-1212 | ||||||
| 316 | recordedFeatures |= flag; | - | ||||||
| 317 | emit q->recordedFeaturesChanged(recordedFeatures); | - | ||||||
| 318 | } executed 124 times by 1 test: end of blockExecuted by:
| 124 | ||||||
| 319 | return true; executed 1336 times by 1 test: return true;Executed by:
| 1336 | ||||||
| 320 | } | - | ||||||
| 321 | - | |||||||
| 322 | void QQmlProfilerClient::onStateChanged(State status) | - | ||||||
| 323 | { | - | ||||||
| 324 | if (status == Enabled) {
| 0-36 | ||||||
| 325 | sendRecordingStatus(-1); | - | ||||||
| 326 | } else { executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||
| 327 | Q_D(QQmlProfilerClient); | - | ||||||
| 328 | d->finalize(); | - | ||||||
| 329 | } never executed: end of block | 0 | ||||||
| 330 | - | |||||||
| 331 | } | - | ||||||
| 332 | - | |||||||
| 333 | void QQmlProfilerClient::messageReceived(const QByteArray &data) | - | ||||||
| 334 | { | - | ||||||
| 335 | Q_D(QQmlProfilerClient); | - | ||||||
| 336 | QPacket stream(d->connection->currentDataStreamVersion(), data); | - | ||||||
| 337 | - | |||||||
| 338 | stream >> d->currentEvent; | - | ||||||
| 339 | - | |||||||
| 340 | d->maximumTime = qMax(d->currentEvent.event.timestamp(), d->maximumTime); | - | ||||||
| 341 | if (d->currentEvent.type.message() == Complete) {
| 34-1388 | ||||||
| 342 | d->finalize(); | - | ||||||
| 343 | emit complete(d->maximumTime); | - | ||||||
| 344 | } else if (d->currentEvent.type.message() == Event executed 34 times by 1 test: end of blockExecuted by:
| 34-1215 | ||||||
| 345 | && d->currentEvent.type.detailType() == StartTrace) {
| 36-137 | ||||||
| 346 | const QList<int> engineIds = d->currentEvent.event.numbers<QList<int>, qint32>(); | - | ||||||
| 347 | d->trackedEngines.append(engineIds); | - | ||||||
| 348 | emit traceStarted(d->currentEvent.event.timestamp(), engineIds); | - | ||||||
| 349 | } else if (d->currentEvent.type.message() == Event executed 36 times by 1 test: end of blockExecuted by:
| 36-1215 | ||||||
| 350 | && d->currentEvent.type.detailType() == EndTrace) {
| 34-103 | ||||||
| 351 | const QList<int> engineIds = d->currentEvent.event.numbers<QList<int>, qint32>(); | - | ||||||
| 352 | for (int engineId : engineIds) | - | ||||||
| 353 | d->trackedEngines.removeAll(engineId); executed 34 times by 1 test: d->trackedEngines.removeAll(engineId);Executed by:
| 34 | ||||||
| 354 | emit traceFinished(d->currentEvent.event.timestamp(), engineIds); | - | ||||||
| 355 | } else if (d->updateFeatures(d->currentEvent.type.feature())) { executed 34 times by 1 test: end of blockExecuted by:
| 0-1318 | ||||||
| 356 | d->processCurrentEvent(); | - | ||||||
| 357 | } executed 1318 times by 1 test: end of blockExecuted by:
| 1318 | ||||||
| 358 | } executed 1422 times by 1 test: end of blockExecuted by:
| 1422 | ||||||
| 359 | - | |||||||
| 360 | QT_END_NAMESPACE | - | ||||||
| 361 | - | |||||||
| 362 | #include "moc_qqmlprofilerclient_p.cpp" | - | ||||||
| Source code | Switch to Preprocessed file |