OpenCoverage

qqmlprofilerevent_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qmldebug/qqmlprofilerevent_p.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4struct QQmlProfilerEvent {-
5 QQmlProfilerEvent() :-
6 m_timestamp(-1), m_typeIndex(-1), m_dataType(Inline8Bit), m_dataLength(0)-
7 {}
executed 36 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
36
8-
9 template<typename Number>-
10 QQmlProfilerEvent(qint64 timestamp, int typeIndex, std::initializer_list<Number> list)-
11 : m_timestamp(timestamp), m_typeIndex(typeIndex)-
12 {-
13 assignNumbers<std::initializer_list<Number>, Number>(list);-
14 }
never executed: end of block
0
15-
16 QQmlProfilerEvent(qint64 timestamp, int typeIndex, const QString &data)-
17 : m_timestamp(timestamp), m_typeIndex(typeIndex)-
18 {-
19 assignNumbers<QByteArray, qint8>(data.toUtf8());-
20 }
never executed: end of block
0
21-
22 template<typename Number>-
23 QQmlProfilerEvent(qint64 timestamp, int typeIndex, const QVector<Number> &data)-
24 : m_timestamp(timestamp), m_typeIndex(typeIndex)-
25 {-
26 assignNumbers<QVector<Number>, Number>(data);-
27 }
executed 70 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
70
28-
29 QQmlProfilerEvent(const QQmlProfilerEvent &other)-
30 : m_timestamp(other.m_timestamp), m_typeIndex(other.m_typeIndex),-
31 m_dataType(other.m_dataType), m_dataLength(other.m_dataLength)-
32 {-
33 assignData(other);-
34 }
executed 1996 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
1996
35-
36 QQmlProfilerEvent(QQmlProfilerEvent &&other)-
37 {-
38 memcpy(static_cast<void *>(this), static_cast<const void *>(&other), sizeof(QQmlProfilerEvent));-
39 other.m_dataType = Inline8Bit;-
40 }
executed 511 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
511
41-
42 QQmlProfilerEvent &operator=(const QQmlProfilerEvent &other)-
43 {-
44 if (this != &other
this != &otherDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEnever evaluated
) {
0-2
45 clearPointer();-
46 m_timestamp = other.m_timestamp;-
47 m_typeIndex = other.m_typeIndex;-
48 m_dataType = other.m_dataType;-
49 m_dataLength = other.m_dataLength;-
50 assignData(other);-
51 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
2
52 return
executed 2 times by 1 test: return *this;
Executed by:
  • tst_qqmlprofilerservice
*this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_qqmlprofilerservice
2
53 }-
54-
55 QQmlProfilerEvent &operator=(QQmlProfilerEvent &&other)-
56 {-
57 if (this != &other
this != &otherDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
58 memcpy(static_cast<void *>(this), static_cast<const void *>(&other), sizeof(QQmlProfilerEvent));-
59 other.m_dataType = Inline8Bit;-
60 }
never executed: end of block
0
61 return
never executed: return *this;
*this;
never executed: return *this;
0
62 }-
63-
64 ~QQmlProfilerEvent()-
65 {-
66 clearPointer();-
67 }
executed 2613 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
2613
68-
69 qint64 timestamp() const { return
executed 3459 times by 1 test: return m_timestamp;
Executed by:
  • tst_qqmlprofilerservice
m_timestamp;
executed 3459 times by 1 test: return m_timestamp;
Executed by:
  • tst_qqmlprofilerservice
}
3459
70 void setTimestamp(qint64 timestamp) { m_timestamp = timestamp; }
executed 1442 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
1442
71-
72 int typeIndex() const { return
executed 2270 times by 1 test: return m_typeIndex;
Executed by:
  • tst_qqmlprofilerservice
m_typeIndex;
executed 2270 times by 1 test: return m_typeIndex;
Executed by:
  • tst_qqmlprofilerservice
}
2270
73 void setTypeIndex(int typeIndex) { m_typeIndex = typeIndex; }
executed 2626 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
2626
74-
75 template<typename Number>-
76 Number number(int i) const-
77 {-
78-
79 if (i >= m_dataLength
i >= m_dataLengthDescription
TRUEnever evaluated
FALSEevaluated 559 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
)
0-559
80 return
never executed: return 0;
0;
never executed: return 0;
0
81 switch (m_dataType) {-
82 case
executed 16 times by 1 test: case Inline8Bit:
Executed by:
  • tst_qqmlprofilerservice
Inline8Bit:
executed 16 times by 1 test: case Inline8Bit:
Executed by:
  • tst_qqmlprofilerservice
16
83 return
executed 16 times by 1 test: return m_data.internal8bit[i];
Executed by:
  • tst_qqmlprofilerservice
m_data.internal8bit[i];
executed 16 times by 1 test: return m_data.internal8bit[i];
Executed by:
  • tst_qqmlprofilerservice
16
84-
85#pragma GCC diagnostic push-
86-
87-
88#pragma GCC diagnostic ignored "-Warray-bounds"-
89-
90 case
executed 6 times by 1 test: case Inline16Bit:
Executed by:
  • tst_qqmlprofilerservice
Inline16Bit:
executed 6 times by 1 test: case Inline16Bit:
Executed by:
  • tst_qqmlprofilerservice
6
91 return
executed 6 times by 1 test: return m_data.internal16bit[i];
Executed by:
  • tst_qqmlprofilerservice
m_data.internal16bit[i];
executed 6 times by 1 test: return m_data.internal16bit[i];
Executed by:
  • tst_qqmlprofilerservice
6
92 case
executed 72 times by 1 test: case Inline32Bit:
Executed by:
  • tst_qqmlprofilerservice
Inline32Bit:
executed 72 times by 1 test: case Inline32Bit:
Executed by:
  • tst_qqmlprofilerservice
72
93 return
executed 72 times by 1 test: return m_data.internal32bit[i];
Executed by:
  • tst_qqmlprofilerservice
m_data.internal32bit[i];
executed 72 times by 1 test: return m_data.internal32bit[i];
Executed by:
  • tst_qqmlprofilerservice
72
94 case
executed 465 times by 1 test: case Inline64Bit:
Executed by:
  • tst_qqmlprofilerservice
Inline64Bit:
executed 465 times by 1 test: case Inline64Bit:
Executed by:
  • tst_qqmlprofilerservice
465
95 return
executed 465 times by 1 test: return m_data.internal64bit[i];
Executed by:
  • tst_qqmlprofilerservice
m_data.internal64bit[i];
executed 465 times by 1 test: return m_data.internal64bit[i];
Executed by:
  • tst_qqmlprofilerservice
465
96-
97#pragma GCC diagnostic pop-
98-
99 case
never executed: case External8Bit:
External8Bit:
never executed: case External8Bit:
0
100 return
never executed: return static_cast<const qint8 *>(m_data.external)[i];
static_cast<const qint8 *>(m_data.external)[i];
never executed: return static_cast<const qint8 *>(m_data.external)[i];
0
101 case
never executed: case External16Bit:
External16Bit:
never executed: case External16Bit:
0
102 return
never executed: return static_cast<const qint16 *>(m_data.external)[i];
static_cast<const qint16 *>(m_data.external)[i];
never executed: return static_cast<const qint16 *>(m_data.external)[i];
0
103 case
never executed: case External32Bit:
External32Bit:
never executed: case External32Bit:
0
104 return
never executed: return static_cast<const qint32 *>(m_data.external)[i];
static_cast<const qint32 *>(m_data.external)[i];
never executed: return static_cast<const qint32 *>(m_data.external)[i];
0
105 case
never executed: case External64Bit:
External64Bit:
never executed: case External64Bit:
0
106 return
never executed: return static_cast<const qint64 *>(m_data.external)[i];
static_cast<const qint64 *>(m_data.external)[i];
never executed: return static_cast<const qint64 *>(m_data.external)[i];
0
107 default
never executed: default:
:
never executed: default:
0
108 return
never executed: return 0;
0;
never executed: return 0;
0
109 }-
110 }-
111-
112 template<typename Number>-
113 void setNumber(int i, Number number)-
114 {-
115 QVarLengthArray<Number> nums = numbers<QVarLengthArray<Number>, Number>();-
116 int prevSize = nums.size();-
117 if (i >= prevSize
i >= prevSizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
118 nums.resize(i + 1);-
119-
120 while (prevSize < i
prevSize < iDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
121 nums[prevSize++] = 0;
never executed: nums[prevSize++] = 0;
0
122 }
never executed: end of block
0
123 nums[i] = number;-
124 setNumbers<QVarLengthArray<Number>, Number>(nums);-
125 }
never executed: end of block
0
126-
127 template<typename Container, typename Number>-
128 void setNumbers(const Container &numbers)-
129 {-
130 clearPointer();-
131 assignNumbers<Container, Number>(numbers);-
132 }
executed 646 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
646
133-
134 template<typename Number>-
135 void setNumbers(std::initializer_list<Number> numbers)-
136 {-
137 setNumbers<std::initializer_list<Number>, Number>(numbers);-
138 }
executed 576 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
576
139-
140 template<typename Container, typename Number = qint64>-
141 Container numbers() const-
142 {-
143 Container container;-
144 for (int i = 0; i < m_dataLength
i < m_dataLengthDescription
TRUEevaluated 94 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 90 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
; ++i)
90-94
145 container.append(number<Number>(i));
executed 94 times by 1 test: container.append(number<Number>(i));
Executed by:
  • tst_qqmlprofilerservice
94
146 return
executed 90 times by 1 test: return container;
Executed by:
  • tst_qqmlprofilerservice
container;
executed 90 times by 1 test: return container;
Executed by:
  • tst_qqmlprofilerservice
90
147 }-
148-
149 QString string() const-
150 {-
151 switch (m_dataType) {-
152 case
never executed: case External8Bit:
External8Bit:
never executed: case External8Bit:
0
153 return
never executed: return QString::fromUtf8(static_cast<const char *>(m_data.external), m_dataLength);
QString::fromUtf8(static_cast<const char *>(m_data.external), m_dataLength);
never executed: return QString::fromUtf8(static_cast<const char *>(m_data.external), m_dataLength);
0
154 case
never executed: case Inline8Bit:
Inline8Bit:
never executed: case Inline8Bit:
0
155 return
never executed: return QString::fromUtf8(m_data.internalChar, m_dataLength);
QString::fromUtf8(m_data.internalChar, m_dataLength);
never executed: return QString::fromUtf8(m_data.internalChar, m_dataLength);
0
156 default
never executed: default:
:
never executed: default:
0
157 do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 213)); __builtin_unreachable(); } while (false);-
158 return
never executed: return QString();
QString();
never executed: return QString();
0
159 }-
160 }-
161-
162 void setString(const QString &data)-
163 {-
164 clearPointer();-
165 assignNumbers<QByteArray, char>(data.toUtf8());-
166 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
18
167-
168 Message rangeStage() const-
169 {-
170 ((m_dataType == Inline8Bit) ? static_cast<void>(0) : qt_assert("m_dataType == Inline8Bit", __FILE__, 226));-
171 return
executed 752 times by 1 test: return static_cast<Message>(m_data.internal8bit[0]);
Executed by:
  • tst_qqmlprofilerservice
static_cast<Message>(m_data.internal8bit[0]);
executed 752 times by 1 test: return static_cast<Message>(m_data.internal8bit[0]);
Executed by:
  • tst_qqmlprofilerservice
752
172 }-
173-
174 void setRangeStage(Message stage)-
175 {-
176 clearPointer();-
177 m_dataType = Inline8Bit;-
178 m_dataLength = 1;-
179 m_data.internal8bit[0] = stage;-
180 }
executed 744 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
744
181-
182 bool isValid() const-
183 {-
184 return
never executed: return m_timestamp != -1;
m_timestamp != -1;
never executed: return m_timestamp != -1;
0
185 }-
186-
187private:-
188 enum Type: quint16 {-
189 External = 1,-
190 Inline8Bit = 8,-
191 External8Bit = Inline8Bit | External,-
192 Inline16Bit = 16,-
193 External16Bit = Inline16Bit | External,-
194 Inline32Bit = 32,-
195 External32Bit = Inline32Bit | External,-
196 Inline64Bit = 64,-
197 External64Bit = Inline64Bit | External-
198 };-
199-
200 qint64 m_timestamp;-
201-
202 static const int s_internalDataLength = 8;-
203 union {-
204 void *external;-
205 char internalChar [s_internalDataLength];-
206 qint8 internal8bit [s_internalDataLength];-
207 qint16 internal16bit[s_internalDataLength / 2];-
208 qint32 internal32bit[s_internalDataLength / 4];-
209 qint64 internal64bit[s_internalDataLength / 8];-
210 } m_data;-
211-
212 qint32 m_typeIndex;-
213 Type m_dataType;-
214 quint16 m_dataLength;-
215-
216 void assignData(const QQmlProfilerEvent &other)-
217 {-
218 if (m_dataType & External
m_dataType & ExternalDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 1992 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
) {
6-1992
219 uint length = m_dataLength * (other.m_dataType / 8);-
220 m_data.external = malloc(length);-
221 memcpy(m_data.external, other.m_data.external, length);-
222 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
else {
6
223 memcpy(&m_data, &other.m_data, sizeof(m_data));-
224 }
executed 1992 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
1992
225 }-
226-
227 template<typename Big, typename Small>-
228 bool squeezable(Big source)-
229 {-
230 return
executed 1178 times by 1 test: return static_cast<Small>(source) == source;
Executed by:
  • tst_qqmlprofilerservice
static_cast<Small>(source) == source;
executed 1178 times by 1 test: return static_cast<Small>(source) == source;
Executed by:
  • tst_qqmlprofilerservice
1178
231 }-
232-
233 template<typename Container, typename Number>-
234 typename std::enable_if<(sizeof(Number) > 1), bool>::type-
235 squeeze(const Container &numbers)-
236 {-
237 typedef typename QIntegerForSize<sizeof(Number) / 2>::Signed Small;-
238 for (auto _container_ = QtPrivate::qMakeForeachContainer(numbers); _container_.control
_container_.controlDescription
TRUEevaluated 444 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEnever evaluated
&& _container_.i != _container_.e
_container_.i != _container_.eDescription
TRUEevaluated 333 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 111 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
; ++_container_.i, _container_.control ^= 1) for (Number item = *_container_.i; _container_.control
_container_.controlDescription
TRUEevaluated 333 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 333 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
; _container_.control = 0) {
0-444
239 if (!squeezable<Number, Small>(item)
!squeezable<Nu..., Small>(item)Description
TRUEnever evaluated
FALSEevaluated 333 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
)
0-333
240 return
never executed: return false;
false;
never executed: return false;
0
241 }
executed 333 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
333
242 assignNumbers<Container, Small>(numbers);-
243 return
executed 111 times by 1 test: return true;
Executed by:
  • tst_qqmlprofilerservice
true;
executed 111 times by 1 test: return true;
Executed by:
  • tst_qqmlprofilerservice
111
244 }-
245-
246 template<typename Container, typename Number>-
247 typename std::enable_if<(sizeof(Number) <= 1), bool>::type-
248 squeeze(const Container &)-
249 {-
250 return
executed 6 times by 1 test: return false;
Executed by:
  • tst_qqmlprofilerservice
false;
executed 6 times by 1 test: return false;
Executed by:
  • tst_qqmlprofilerservice
6
251 }-
252-
253 template<typename Container, typename Number>-
254 void assignNumbers(const Container &numbers)-
255 {-
256 Number *data;-
257 m_dataLength = squeezable<size_t, quint16>(static_cast<size_t>(numbers.size()))
squeezable<siz...mbers.size()))Description
TRUEevaluated 845 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEnever evaluated
?
0-845
258 static_cast<quint16>(numbers.size()) : std::numeric_limits<quint16>::max();-
259 if (m_dataLength > sizeof(m_data) / sizeof(Number)
m_dataLength >...sizeof(Number)Description
TRUEevaluated 117 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 728 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
) {
117-728
260 if (squeeze<Container, Number>(numbers)
squeeze<Contai...mber>(numbers)Description
TRUEevaluated 111 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
)
6-111
261 return;
executed 111 times by 1 test: return;
Executed by:
  • tst_qqmlprofilerservice
111
262 m_dataType = static_cast<Type>((sizeof(Number) * 8) | External);-
263 m_data.external = malloc(m_dataLength * sizeof(Number));-
264 data = static_cast<Number *>(m_data.external);-
265 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
else {
6
266 m_dataType = static_cast<Type>(sizeof(Number) * 8);-
267 data = static_cast<Number *>(m_dataType & External ? m_data.external : &m_data);-
268 }
executed 728 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
728
269 quint16 i = 0;-
270 for (Number item : numbers) {-
271 if (i >= m_dataLength
i >= m_dataLengthDescription
TRUEnever evaluated
FALSEevaluated 1052 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
)
0-1052
272 break;
never executed: break;
0
273 data[i++] = item;-
274 }
executed 1052 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
1052
275 }
executed 734 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
734
276-
277 void clearPointer()-
278 {-
279 if (m_dataType & External
m_dataType & ExternalDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 4011 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
)
12-4011
280 free(m_data.external);
executed 12 times by 1 test: free(m_data.external);
Executed by:
  • tst_qqmlprofilerservice
12
281 }
executed 4023 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
4023
282-
283 friend QDataStream &operator>>(QDataStream &stream, QQmlProfilerEvent &event);-
284 friend QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEvent &event);-
285};-
286-
287bool operator==(const QQmlProfilerEvent &event1, const QQmlProfilerEvent &event2);-
288bool operator!=(const QQmlProfilerEvent &event1, const QQmlProfilerEvent &event2);-
289-
290QDataStream &operator>>(QDataStream &stream, QQmlProfilerEvent &event);-
291QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEvent &event);-
292-
293template<> class QTypeInfo<QQmlProfilerEvent > { public: enum { isSpecialized = true, isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QQmlProfilerEvent)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QQmlProfilerEvent >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QQmlProfilerEvent) }; static inline const char *name() { return "QQmlProfilerEvent"; } };-
294-
295-
296-
297 template <> struct QMetaTypeId< QQmlProfilerEvent > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const int id = metatype_id.loadAcquire()) return id; const int newId = qRegisterMetaType< QQmlProfilerEvent >("QQmlProfilerEvent", reinterpret_cast< QQmlProfilerEvent *>(quintptr(-1))); metatype_id.storeRelease(newId); return newId; } };-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0