| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/debugger/qqmlmemoryprofiler_p.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 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 | #ifndef QQMLMEMORYPROFILER_H | - | ||||||
| 41 | #define QQMLMEMORYPROFILER_H | - | ||||||
| 42 | - | |||||||
| 43 | // | - | ||||||
| 44 | // W A R N I N G | - | ||||||
| 45 | // ------------- | - | ||||||
| 46 | // | - | ||||||
| 47 | // This file is not part of the Qt API. It exists purely as an | - | ||||||
| 48 | // implementation detail. This header file may change from version to | - | ||||||
| 49 | // version without notice, or even be removed. | - | ||||||
| 50 | // | - | ||||||
| 51 | // We mean it. | - | ||||||
| 52 | // | - | ||||||
| 53 | - | |||||||
| 54 | #include <private/qtqmlglobal_p.h> | - | ||||||
| 55 | #include <QUrl> | - | ||||||
| 56 | - | |||||||
| 57 | QT_BEGIN_NAMESPACE | - | ||||||
| 58 | - | |||||||
| 59 | #if !QT_CONFIG(qml_debug) | - | ||||||
| 60 | - | |||||||
| 61 | #define QML_MEMORY_SCOPE_URL(url) | - | ||||||
| 62 | #define QML_MEMORY_SCOPE_STRING(s) | - | ||||||
| 63 | - | |||||||
| 64 | #else | - | ||||||
| 65 | - | |||||||
| 66 | class Q_QML_PRIVATE_EXPORT QQmlMemoryScope | - | ||||||
| 67 | { | - | ||||||
| 68 | public: | - | ||||||
| 69 | explicit QQmlMemoryScope(const QUrl &url) | - | ||||||
| 70 | : pushed(false) | - | ||||||
| 71 | { | - | ||||||
| 72 | if (Q_UNLIKELY(openLibrary()))
| 0-329196 | ||||||
| 73 | init(url.path().toUtf8().constData()); never executed: init(url.path().toUtf8().constData()); | 0 | ||||||
| 74 | } executed 329196 times by 141 tests: end of blockExecuted by:
| 329196 | ||||||
| 75 | - | |||||||
| 76 | explicit QQmlMemoryScope(const char *string) | - | ||||||
| 77 | : pushed(false) | - | ||||||
| 78 | { | - | ||||||
| 79 | if (Q_UNLIKELY(openLibrary()))
| 0-112690 | ||||||
| 80 | init(string); never executed: init(string); | 0 | ||||||
| 81 | } executed 112690 times by 152 tests: end of blockExecuted by:
| 112690 | ||||||
| 82 | - | |||||||
| 83 | ~QQmlMemoryScope() | - | ||||||
| 84 | { | - | ||||||
| 85 | if (Q_UNLIKELY(pushed))
| 0-441886 | ||||||
| 86 | done(); never executed: done(); | 0 | ||||||
| 87 | } executed 441886 times by 152 tests: end of blockExecuted by:
| 441886 | ||||||
| 88 | - | |||||||
| 89 | enum LibraryState | - | ||||||
| 90 | { | - | ||||||
| 91 | Unloaded, | - | ||||||
| 92 | Failed, | - | ||||||
| 93 | Loaded | - | ||||||
| 94 | }; | - | ||||||
| 95 | - | |||||||
| 96 | static bool openLibrary() | - | ||||||
| 97 | { | - | ||||||
| 98 | if (Q_LIKELY(state == Loaded))
| 0-441886 | ||||||
| 99 | return true; never executed: return true; | 0 | ||||||
| 100 | if (state == Failed)
| 336-441550 | ||||||
| 101 | return false; executed 441550 times by 147 tests: return false;Executed by:
| 441550 | ||||||
| 102 | - | |||||||
| 103 | return doOpenLibrary(); executed 336 times by 152 tests: return doOpenLibrary();Executed by:
| 336 | ||||||
| 104 | } | - | ||||||
| 105 | - | |||||||
| 106 | private: | - | ||||||
| 107 | Q_NEVER_INLINE void init(const char *string); | - | ||||||
| 108 | Q_NEVER_INLINE void done(); | - | ||||||
| 109 | Q_NEVER_INLINE static bool doOpenLibrary(); | - | ||||||
| 110 | - | |||||||
| 111 | static LibraryState state; | - | ||||||
| 112 | - | |||||||
| 113 | bool pushed; | - | ||||||
| 114 | }; | - | ||||||
| 115 | - | |||||||
| 116 | class Q_QML_PRIVATE_EXPORT QQmlMemoryProfiler | - | ||||||
| 117 | { | - | ||||||
| 118 | public: | - | ||||||
| 119 | static void enable(); | - | ||||||
| 120 | static void disable(); | - | ||||||
| 121 | static bool isEnabled(); | - | ||||||
| 122 | - | |||||||
| 123 | static void clear(); | - | ||||||
| 124 | static void stats(int *allocCount, int *bytesAllocated); | - | ||||||
| 125 | static void save(const char *filename); | - | ||||||
| 126 | }; | - | ||||||
| 127 | - | |||||||
| 128 | #define QML_MEMORY_SCOPE_URL(url) QQmlMemoryScope _qml_memory_scope(url) | - | ||||||
| 129 | #define QML_MEMORY_SCOPE_STRING(s) QQmlMemoryScope _qml_memory_scope(s) | - | ||||||
| 130 | - | |||||||
| 131 | #endif | - | ||||||
| 132 | - | |||||||
| 133 | QT_END_NAMESPACE | - | ||||||
| 134 | #endif // QQMLMEMORYPROFILER_H | - | ||||||
| Source code | Switch to Preprocessed file |