OpenCoverage

qv4profiling_p.h #2

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4profiling_p.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5namespace QV4 {-
6-
7namespace Profiling {-
8-
9enum Features {-
10 FeatureFunctionCall,-
11 FeatureMemoryAllocation-
12};-
13-
14enum MemoryType {-
15 HeapPage,-
16 LargeItem,-
17 SmallItem-
18};-
19-
20struct FunctionCallProperties {-
21 qint64 start;-
22 qint64 end;-
23 quintptr id;-
24};-
25-
26struct FunctionLocation {-
27 FunctionLocation(const QString &name = QString(), const QString &file = QString(),-
28 int line = -1, int column = -1) :-
29 name(name), file(file), line(line), column(column)-
30 {}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
16
31-
32 bool isValid()-
33 {-
34 return
executed 8 times by 1 test: return !name.isEmpty();
Executed by:
  • tst_qqmlprofilerservice
!name.isEmpty();
executed 8 times by 1 test: return !name.isEmpty();
Executed by:
  • tst_qqmlprofilerservice
8
35 }-
36-
37 QString name;-
38 QString file;-
39 int line;-
40 int column;-
41};-
42-
43typedef QHash<quintptr, QV4::Profiling::FunctionLocation> FunctionLocationHash;-
44-
45struct MemoryAllocationProperties {-
46 qint64 timestamp;-
47 qint64 size;-
48 MemoryType type;-
49};-
50-
51class FunctionCall {-
52public:-
53-
54 FunctionCall() : m_function(nullptr), m_start(0), m_end(0)-
55 { ((false) ? static_cast<void>(0) : qt_assert_x(__PRETTY_FUNCTION__, "Cannot construct a function call without function", __FILE__, 143)); }
never executed: end of block
0
56-
57 FunctionCall(Function *function, qint64 start, qint64 end) :-
58 m_function(function), m_start(start), m_end(end)-
59 { m_function->compilationUnit->addref(); }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
14
60-
61 FunctionCall(const FunctionCall &other) :-
62 m_function(other.m_function), m_start(other.m_start), m_end(other.m_end)-
63 { m_function->compilationUnit->addref(); }
executed 22 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
22
64-
65 ~FunctionCall()-
66 { m_function->compilationUnit->release(); }
executed 36 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
36
67-
68 FunctionCall &operator=(const FunctionCall &other) {-
69 if (&other != this
&other != thisDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEnever evaluated
) {
0-28
70 other.m_function->compilationUnit->addref();-
71 m_function->compilationUnit->release();-
72 m_function = other.m_function;-
73 m_start = other.m_start;-
74 m_end = other.m_end;-
75 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
28
76 return
executed 28 times by 1 test: return *this;
Executed by:
  • tst_qqmlprofilerservice
*this;
executed 28 times by 1 test: return *this;
Executed by:
  • tst_qqmlprofilerservice
28
77 }-
78-
79 Function *function() const-
80 {-
81 return
executed 14 times by 1 test: return m_function;
Executed by:
  • tst_qqmlprofilerservice
m_function;
executed 14 times by 1 test: return m_function;
Executed by:
  • tst_qqmlprofilerservice
14
82 }-
83-
84 FunctionLocation resolveLocation() const;-
85 FunctionCallProperties properties() const;-
86-
87private:-
88 friend bool operator<(const FunctionCall &call1, const FunctionCall &call2);-
89-
90 Function *m_function;-
91 qint64 m_start;-
92 qint64 m_end;-
93};-
94-
95class __attribute__((visibility("default"))) Profiler : public QObject {-
96 public:-
97#pragma GCC diagnostic push-
98 -
99#pragma GCC diagnostic ignored "-Wsuggest-override"-
100 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private:-
101#pragma GCC diagnostic ignored "-Wattributes"-
102 __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
103#pragma GCC diagnostic pop-
104 struct QPrivateSignal {};-
105public:-
106 struct SentMarker {-
107 SentMarker() : m_function(nullptr) {}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
8
108-
109 SentMarker(const SentMarker &other) : m_function(other.m_function)-
110 {-
111 if (m_function
m_functionDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
)
0-8
112 m_function->compilationUnit->addref();
never executed: m_function->compilationUnit->addref();
0
113 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
8
114-
115 ~SentMarker()-
116 {-
117 if (m_function
m_functionDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
)
8
118 m_function->compilationUnit->release();
executed 8 times by 1 test: m_function->compilationUnit->release();
Executed by:
  • tst_qqmlprofilerservice
8
119 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
16
120-
121 SentMarker &operator=(const SentMarker &other)-
122 {-
123 if (&other != this
&other != thisDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
124 if (m_function
m_functionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
125 m_function->compilationUnit->release();
never executed: m_function->compilationUnit->release();
0
126 m_function = other.m_function;-
127 m_function->compilationUnit->addref();-
128 }
never executed: end of block
0
129 return
never executed: return *this;
*this;
never executed: return *this;
0
130 }-
131-
132 void setFunction(Function *function)-
133 {-
134 ((m_function == nullptr) ? static_cast<void>(0) : qt_assert("m_function == nullptr", __FILE__, 214));-
135 m_function = function;-
136 m_function->compilationUnit->addref();-
137 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
8
138-
139 bool isValid() const-
140 { return
executed 14 times by 1 test: return m_function != nullptr;
Executed by:
  • tst_qqmlprofilerservice
m_function != nullptr;
executed 14 times by 1 test: return m_function != nullptr;
Executed by:
  • tst_qqmlprofilerservice
}
14
141-
142 private:-
143 Function *m_function;-
144 };-
145-
146 Profiler(QV4::ExecutionEngine *engine);-
147-
148 bool trackAlloc(size_t size, MemoryType type)-
149 {-
150 if (size
sizeDescription
TRUEevaluated 152 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEnever evaluated
) {
0-152
151 MemoryAllocationProperties allocation = {m_timer.nsecsElapsed(), (qint64)size, type};-
152 m_memory_data.append(allocation);-
153 return
executed 152 times by 1 test: return true;
Executed by:
  • tst_qqmlprofilerservice
true;
executed 152 times by 1 test: return true;
Executed by:
  • tst_qqmlprofilerservice
152
154 } else {-
155 return
never executed: return false;
false;
never executed: return false;
0
156 }-
157 }-
158-
159 bool trackDealloc(size_t size, MemoryType type)-
160 {-
161 if (size
sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
162 MemoryAllocationProperties allocation = {m_timer.nsecsElapsed(), -(qint64)size, type};-
163 m_memory_data.append(allocation);-
164 return
never executed: return true;
true;
never executed: return true;
0
165 } else {-
166 return
never executed: return false;
false;
never executed: return false;
0
167 }-
168 }-
169-
170 quint64 featuresEnabled;-
171-
172 void stopProfiling();-
173 void startProfiling(quint64 features);-
174 void reportData();-
175 void setTimer(const QElapsedTimer &timer) { m_timer = timer; }
executed 32 times by 3 tests: end of block
Executed by:
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmlprofilerservice
32
176-
177public :-
178 void dataReady(const QV4::Profiling::FunctionLocationHash &,-
179 const QVector<QV4::Profiling::FunctionCallProperties> &,-
180 const QVector<QV4::Profiling::MemoryAllocationProperties> &);-
181-
182private:-
183 QV4::ExecutionEngine *m_engine;-
184 QElapsedTimer m_timer;-
185 QVector<FunctionCall> m_data;-
186 QVector<MemoryAllocationProperties> m_memory_data;-
187 QHash<quintptr, SentMarker> m_sentLocations;-
188-
189 friend class FunctionCallProfiler;-
190};-
191-
192class FunctionCallProfiler {-
193 FunctionCallProfiler(const FunctionCallProfiler &) = delete; FunctionCallProfiler &operator=(const FunctionCallProfiler &) = delete;-
194public:-
195-
196-
197-
198 FunctionCallProfiler(ExecutionEngine *engine, Function *f)-
199 : profiler(nullptr)-
200 {-
201 Profiler *p = engine->profiler();-
202 if (__builtin_expect(!!(p), false)
__builtin_expect(!!(p), false)Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qqmldebugjs
  • tst_qqmlprofilerservice
FALSEevaluated 17699042 times by 133 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
&& (
(p->featuresEn...FunctionCall))Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qqmldebugjs
p->featuresEnabled & (1 << Profiling::FeatureFunctionCall))
(p->featuresEn...FunctionCall))Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qqmldebugjs
) {
14-17699042
203 profiler = p;-
204 function = f;-
205 startTime = profiler->m_timer.nsecsElapsed();-
206 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qqmlprofilerservice
14
207 }
executed 17704945 times by 134 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
17704945
208-
209 ~FunctionCallProfiler()-
210 {-
211 if (profiler
profilerDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qqmlprofilerservice
FALSEevaluated 17678129 times by 133 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
)
14-17678129
212 profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed()));
executed 14 times by 1 test: profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed()));
Executed by:
  • tst_qqmlprofilerservice
14
213 }
executed 17696998 times by 134 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
17696998
214-
215 Profiler *profiler;-
216 Function *function;-
217 qint64 startTime;-
218};-
219-
220-
221}-
222}-
223-
224template<> class QTypeInfo<QV4::Profiling::MemoryAllocationProperties > { 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(QV4::Profiling::MemoryAllocationProperties)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QV4::Profiling::MemoryAllocationProperties >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QV4::Profiling::MemoryAllocationProperties) }; static inline const char *name() { return
never executed: return "QV4::Profiling::MemoryAllocationProperties";
"QV4::Profiling::MemoryAllocationProperties";
never executed: return "QV4::Profiling::MemoryAllocationProperties";
} };
0
225template<> class QTypeInfo<QV4::Profiling::FunctionCallProperties > { 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(QV4::Profiling::FunctionCallProperties)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QV4::Profiling::FunctionCallProperties >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QV4::Profiling::FunctionCallProperties) }; static inline const char *name() { return
never executed: return "QV4::Profiling::FunctionCallProperties";
"QV4::Profiling::FunctionCallProperties";
never executed: return "QV4::Profiling::FunctionCallProperties";
} };
0
226template<> class QTypeInfo<QV4::Profiling::FunctionCall > { 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(QV4::Profiling::FunctionCall)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QV4::Profiling::FunctionCall >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QV4::Profiling::FunctionCall) }; static inline const char *name() { return
never executed: return "QV4::Profiling::FunctionCall";
"QV4::Profiling::FunctionCall";
never executed: return "QV4::Profiling::FunctionCall";
} };
0
227template<> class QTypeInfo<QV4::Profiling::FunctionLocation > { 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(QV4::Profiling::FunctionLocation)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QV4::Profiling::FunctionLocation >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QV4::Profiling::FunctionLocation) }; static inline const char *name() { return
never executed: return "QV4::Profiling::FunctionLocation";
"QV4::Profiling::FunctionLocation";
never executed: return "QV4::Profiling::FunctionLocation";
} };
0
228template<> class QTypeInfo<QV4::Profiling::Profiler::SentMarker > { 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(QV4::Profiling::Profiler::SentMarker)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QV4::Profiling::Profiler::SentMarker >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QV4::Profiling::Profiler::SentMarker) }; static inline const char *name() { return
never executed: return "QV4::Profiling::Profiler::SentMarker";
"QV4::Profiling::Profiler::SentMarker";
never executed: return "QV4::Profiling::Profiler::SentMarker";
} };
0
229-
230-
231 template <> struct QMetaTypeId< QV4::Profiling::FunctionLocationHash > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const
const int id =....loadAcquire()Description
TRUEnever evaluated
FALSEnever evaluated
int id = metatype_id.loadAcquire()
const int id =....loadAcquire()Description
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return id;
id;
never executed: return id;
const int newId = qRegisterMetaType< QV4::Profiling::FunctionLocationHash >("QV4::Profiling::FunctionLocationHash", reinterpret_cast< QV4::Profiling::FunctionLocationHash *>(quintptr(-1))); metatype_id.storeRelease(newId); return
never executed: return newId;
newId;
never executed: return newId;
} };
0
232 template <> struct QMetaTypeId< QVector<QV4::Profiling::FunctionCallProperties> > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const
const int id =....loadAcquire()Description
TRUEnever evaluated
FALSEnever evaluated
int id = metatype_id.loadAcquire()
const int id =....loadAcquire()Description
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return id;
id;
never executed: return id;
const int newId = qRegisterMetaType< QVector<QV4::Profiling::FunctionCallProperties> >("QVector<QV4::Profiling::FunctionCallProperties>", reinterpret_cast< QVector<QV4::Profiling::FunctionCallProperties> *>(quintptr(-1))); metatype_id.storeRelease(newId); return
never executed: return newId;
newId;
never executed: return newId;
} };
0
233 template <> struct QMetaTypeId< QVector<QV4::Profiling::MemoryAllocationProperties> > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { 0 }; if (const
const int id =....loadAcquire()Description
TRUEnever evaluated
FALSEnever evaluated
int id = metatype_id.loadAcquire()
const int id =....loadAcquire()Description
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return id;
id;
never executed: return id;
const int newId = qRegisterMetaType< QVector<QV4::Profiling::MemoryAllocationProperties> >("QVector<QV4::Profiling::MemoryAllocationProperties>", reinterpret_cast< QVector<QV4::Profiling::MemoryAllocationProperties> *>(quintptr(-1))); metatype_id.storeRelease(newId); return
never executed: return newId;
newId;
never executed: return newId;
} };
0
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0