OpenCoverage

qqmlmemoryprofiler.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/debugger/qqmlmemoryprofiler.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qqmlmemoryprofiler_p.h"-
41-
42QT_BEGIN_NAMESPACE-
43-
44-
45QQmlMemoryScope::LibraryState QQmlMemoryScope::state = QQmlMemoryScope::Unloaded;-
46-
47typedef void (qmlmemprofile_stats)(int *allocCount, int *bytesAllocated);-
48typedef void (qmlmemprofile_clear)();-
49typedef void (qmlmemprofile_enable)();-
50typedef void (qmlmemprofile_disable)();-
51typedef void (qmlmemprofile_push_location)(const char *filename, int lineNumber);-
52typedef void (qmlmemprofile_pop_location)();-
53typedef void (qmlmemprofile_save)(const char *filename);-
54typedef int (qmlmemprofile_is_enabled)();-
55-
56static qmlmemprofile_stats *memprofile_stats;-
57static qmlmemprofile_clear *memprofile_clear;-
58static qmlmemprofile_enable *memprofile_enable;-
59static qmlmemprofile_disable *memprofile_disable;-
60static qmlmemprofile_push_location *memprofile_push_location;-
61static qmlmemprofile_pop_location *memprofile_pop_location;-
62static qmlmemprofile_save *memprofile_save;-
63static qmlmemprofile_is_enabled *memprofile_is_enabled;-
64-
65#if QT_CONFIG(library)-
66extern QFunctionPointer qt_linux_find_symbol_sys(const char *symbol);-
67#endif-
68-
69bool QQmlMemoryScope::doOpenLibrary()-
70{-
71#if defined(Q_OS_LINUX) && QT_CONFIG(library)-
72 if (state == Unloaded) {
state == UnloadedDescription
TRUEevaluated 336 times by 152 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • ...
FALSEnever evaluated
0-336
73 memprofile_stats = (qmlmemprofile_stats *) qt_linux_find_symbol_sys("qmlmemprofile_stats");-
74 memprofile_clear = (qmlmemprofile_clear *) qt_linux_find_symbol_sys("qmlmemprofile_clear");-
75 memprofile_enable = (qmlmemprofile_enable *) qt_linux_find_symbol_sys("qmlmemprofile_enable");-
76 memprofile_disable = (qmlmemprofile_disable *) qt_linux_find_symbol_sys("qmlmemprofile_disable");-
77 memprofile_push_location = (qmlmemprofile_push_location *) qt_linux_find_symbol_sys("qmlmemprofile_push_location");-
78 memprofile_pop_location = (qmlmemprofile_pop_location *) qt_linux_find_symbol_sys("qmlmemprofile_pop_location");-
79 memprofile_save = (qmlmemprofile_save *) qt_linux_find_symbol_sys("qmlmemprofile_save");-
80 memprofile_is_enabled = (qmlmemprofile_is_enabled *) qt_linux_find_symbol_sys("qmlmemprofile_is_enabled");-
81-
82 if (memprofile_stats && memprofile_clear && memprofile_enable && memprofile_disable &&
memprofile_statsDescription
TRUEnever evaluated
FALSEevaluated 336 times by 152 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • ...
memprofile_clearDescription
TRUEnever evaluated
FALSEnever evaluated
memprofile_enableDescription
TRUEnever evaluated
FALSEnever evaluated
memprofile_disableDescription
TRUEnever evaluated
FALSEnever evaluated
0-336
83 memprofile_push_location && memprofile_pop_location && memprofile_save && memprofile_is_enabled)
memprofile_push_locationDescription
TRUEnever evaluated
FALSEnever evaluated
memprofile_pop_locationDescription
TRUEnever evaluated
FALSEnever evaluated
memprofile_saveDescription
TRUEnever evaluated
FALSEnever evaluated
memprofile_is_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
84 state = Loaded;
never executed: state = Loaded;
0
85 else-
86 state = Failed;
executed 336 times by 152 tests: state = Failed;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • ...
336
87 }-
88#endif // Q_OS_LINUX-
89-
90 return state == Loaded;
executed 336 times by 152 tests: return state == Loaded;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • 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_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • ...
336
91}-
92-
93void QQmlMemoryScope::init(const char *string)-
94{-
95 if (memprofile_is_enabled()) {
memprofile_is_enabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
96 memprofile_push_location(string, 0);-
97 pushed = true;-
98 }
never executed: end of block
0
99}
never executed: end of block
0
100-
101void QQmlMemoryScope::done()-
102{-
103 memprofile_pop_location();-
104}
never executed: end of block
0
105-
106bool QQmlMemoryProfiler::isEnabled()-
107{-
108 if (QQmlMemoryScope::openLibrary())
QQmlMemoryScope::openLibrary()Description
TRUEnever evaluated
FALSEnever evaluated
0
109 return memprofile_is_enabled();
never executed: return memprofile_is_enabled();
0
110-
111 return false;
never executed: return false;
0
112}-
113-
114void QQmlMemoryProfiler::enable()-
115{-
116 if (QQmlMemoryScope::openLibrary())
QQmlMemoryScope::openLibrary()Description
TRUEnever evaluated
FALSEnever evaluated
0
117 memprofile_enable();
never executed: memprofile_enable();
0
118}
never executed: end of block
0
119-
120void QQmlMemoryProfiler::disable()-
121{-
122 if (QQmlMemoryScope::openLibrary())
QQmlMemoryScope::openLibrary()Description
TRUEnever evaluated
FALSEnever evaluated
0
123 memprofile_disable();
never executed: memprofile_disable();
0
124}
never executed: end of block
0
125-
126void QQmlMemoryProfiler::clear()-
127{-
128 if (QQmlMemoryScope::openLibrary())
QQmlMemoryScope::openLibrary()Description
TRUEnever evaluated
FALSEnever evaluated
0
129 memprofile_clear();
never executed: memprofile_clear();
0
130}
never executed: end of block
0
131-
132void QQmlMemoryProfiler::stats(int *allocCount, int *bytesAllocated)-
133{-
134 if (QQmlMemoryScope::openLibrary())
QQmlMemoryScope::openLibrary()Description
TRUEnever evaluated
FALSEnever evaluated
0
135 memprofile_stats(allocCount, bytesAllocated);
never executed: memprofile_stats(allocCount, bytesAllocated);
0
136}
never executed: end of block
0
137-
138void QQmlMemoryProfiler::save(const char *filename)-
139{-
140 if (QQmlMemoryScope::openLibrary())
QQmlMemoryScope::openLibrary()Description
TRUEnever evaluated
FALSEnever evaluated
0
141 memprofile_save(filename);
never executed: memprofile_save(filename);
0
142}
never executed: end of block
0
143-
144QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0