Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlprofiler.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
7
9
10QQmlProfiler::QQmlProfiler() : featuresEnabled(0)
11{
12 static int metatype = qRegisterMetaType<QList<QQmlProfilerData> >();
13 static int metatype2 = qRegisterMetaType<QQmlProfiler::LocationHash> ();
14 Q_UNUSED(metatype);
15 Q_UNUSED(metatype2);
16 m_timer.start();
17}
18
19void QQmlProfiler::startProfiling(quint64 features)
20{
21 featuresEnabled = features;
22}
23
24void QQmlProfiler::stopProfiling()
25{
26 featuresEnabled = false;
27 reportData();
28 m_locations.clear();
29}
30
31void QQmlProfiler::reportData()
32{
33 LocationHash resolved;
34 resolved.reserve(m_locations.size());
35 for (auto it = m_locations.begin(), end = m_locations.end(); it != end; ++it) {
36 if (!it->sent) {
37 resolved.insert(it.key(), it.value());
38 it->sent = true;
39 }
40 }
41
42 QList<QQmlProfilerData> data;
43 data.swap(m_data);
44 emit dataReady(data, resolved);
45}
46
47QT_END_NAMESPACE
48
49#include "moc_qqmlprofiler_p.cpp"
Combined button and popup list for selecting options.