OpenCoverage

qv4profiling_p.h #1

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

Generated by Squish Coco 4.2.0