| 1 | // Copyright (C) 2017 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 | |
| 4 | #include "qqmlprofilereventtype_p.h" |
| 5 | #include "qqmlprofilerclientdefinitions_p.h" |
| 6 | |
| 7 | #include <QtCore/qdatastream.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventType &type) |
| 12 | { |
| 13 | quint8 message; |
| 14 | quint8 rangeType; |
| 15 | stream >> type.m_displayName >> type.m_data >> type.m_location >> message >> rangeType |
| 16 | >> type.m_detailType; |
| 17 | type.m_message = static_cast<Message>(message); |
| 18 | type.m_rangeType = static_cast<RangeType>(rangeType); |
| 19 | return stream; |
| 20 | } |
| 21 | |
| 22 | QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventType &type) |
| 23 | { |
| 24 | return stream << type.m_displayName << type.m_data << type.m_location |
| 25 | << static_cast<quint8>(type.m_message) << static_cast<quint8>(type.m_rangeType) |
| 26 | << type.m_detailType; |
| 27 | } |
| 28 | |
| 29 | ProfileFeature QQmlProfilerEventType::feature() const |
| 30 | { |
| 31 | switch (m_message) { |
| 32 | case Event: { |
| 33 | switch (m_detailType) { |
| 34 | case Mouse: |
| 35 | case Key: |
| 36 | return ProfileInputEvents; |
| 37 | case AnimationFrame: |
| 38 | return ProfileAnimations; |
| 39 | default: |
| 40 | return MaximumProfileFeature; |
| 41 | } |
| 42 | } |
| 43 | case PixmapCacheEvent: |
| 44 | return ProfilePixmapCache; |
| 45 | case SceneGraphFrame: |
| 46 | return ProfileSceneGraph; |
| 47 | case MemoryAllocation: |
| 48 | return ProfileMemory; |
| 49 | case DebugMessage: |
| 50 | return ProfileDebugMessages; |
| 51 | default: |
| 52 | break; |
| 53 | } |
| 54 | |
| 55 | switch (m_rangeType) { |
| 56 | case Painting: |
| 57 | return ProfilePainting; |
| 58 | case Compiling: |
| 59 | return ProfileCompiling; |
| 60 | case Creating: |
| 61 | return ProfileCreating; |
| 62 | case Binding: |
| 63 | return ProfileBinding; |
| 64 | case HandlingSignal: |
| 65 | return ProfileHandlingSignal; |
| 66 | case Javascript: |
| 67 | return ProfileJavaScript; |
| 68 | default: |
| 69 | return MaximumProfileFeature; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | |
| 74 | QT_END_NAMESPACE |
| 75 |
