1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25
26 #pragma once
27
28 #include <QtGlobal>
29
30 namespace QmlProfiler {
31
32 enum Message {
33 Event,
34 RangeStart,
35 RangeData,
36 RangeLocation,
37 RangeEnd,
38 Complete,
39 PixmapCacheEvent,
40 SceneGraphFrame,
41 MemoryAllocation,
42 DebugMessage,
43
44 MaximumMessage
45 };
46
47 enum EventType {
48 FramePaint, // unused
49 Mouse,
50 Key,
51 AnimationFrame, // new Qt5 paint events
52 EndTrace,
53 StartTrace,
54
55 MaximumEventType
56 };
57
58 enum RangeType {
59 Painting, // old Qt4 paint events
60 Compiling,
61 Creating,
62 Binding,
63 HandlingSignal,
64 Javascript,
65
66 MaximumRangeType
67 };
68
69 enum BindingType {
70 QmlBinding,
71 V8Binding,
72 OptimizedBinding,
73 QPainterEvent,
74
75 MaximumBindingType
76 };
77
78 enum PixmapEventType {
79 PixmapSizeKnown,
80 PixmapReferenceCountChanged,
81 PixmapCacheCountChanged,
82 PixmapLoadingStarted,
83 PixmapLoadingFinished,
84 PixmapLoadingError,
85
86 MaximumPixmapEventType
87 };
88
89 enum InputEventType {
90 InputKeyPress,
91 InputKeyRelease,
92 InputKeyUnknown,
93
94 InputMousePress,
95 InputMouseRelease,
96 InputMouseMove,
97 InputMouseDoubleClick,
98 InputMouseWheel,
99 InputMouseUnknown,
100
101 MaximumInputEventType
102 };
103
104 enum SceneGraphFrameType {
105 SceneGraphRendererFrame, // Render Thread
106 SceneGraphAdaptationLayerFrame, // Render Thread
107 SceneGraphContextFrame, // Render Thread
108 SceneGraphRenderLoopFrame, // Render Thread
109 SceneGraphTexturePrepare, // Render Thread
110 SceneGraphTextureDeletion, // Render Thread
111 SceneGraphPolishAndSync, // GUI Thread
112 SceneGraphWindowsRenderShow, // Unused
113 SceneGraphWindowsAnimations, // GUI Thread
114 SceneGraphPolishFrame, // GUI Thread
115
116 MaximumSceneGraphFrameType
117 };
118
119 enum MemoryType {
120 HeapPage,
121 LargeItem,
122 SmallItem,
123
124 MaximumMemoryType
125 };
126
127 enum AnimationThread {
128 GuiThread,
129 RenderThread,
130
131 MaximumAnimationThread
132 };
133
134 enum ProfileFeature {
135 ProfileJavaScript,
136 ProfileMemory,
137 ProfilePixmapCache,
138 ProfileSceneGraph,
139 ProfileAnimations,
140 ProfilePainting,
141 ProfileCompiling,
142 ProfileCreating,
143 ProfileBinding,
144 ProfileHandlingSignal,
145 ProfileInputEvents,
146 ProfileDebugMessages,
147
148 MaximumProfileFeature
149 };
150
featureFromRangeType(RangeType range)151 inline ProfileFeature featureFromRangeType(RangeType range)
152 {
153 switch (range) {
154 case Painting:
155 return ProfilePainting;
156 case Compiling:
157 return ProfileCompiling;
158 case Creating:
159 return ProfileCreating;
160 case Binding:
161 return ProfileBinding;
162 case HandlingSignal:
163 return ProfileHandlingSignal;
164 case Javascript:
165 return ProfileJavaScript;
166 default:
167 return MaximumProfileFeature;
168 }
169 }
170
171 namespace Constants {
172
173 // Shorthand for all QML and JS range features.
174 const quint64 QML_JS_RANGE_FEATURES = (1 << ProfileCompiling) |
175 (1 << ProfileCreating) |
176 (1 << ProfileBinding) |
177 (1 << ProfileHandlingSignal) |
178 (1 << ProfileJavaScript);
179 } // namespace Constants
180
181 } // namespace QmlProfiler
182