Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmljscompilerstats_p.h
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
// Qt-Security score:significant
4
5
#
ifndef
QQMLJSCOMPILERSTATS_P_H
6
#
define
QQMLJSCOMPILERSTATS_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
18
#
include
<
qtqmlcompilerexports
.
h
>
19
20
#
include
<
QHash
>
21
#
include
<
QJsonDocument
>
22
23
#
include
<
private
/
qqmljsdiagnosticmessage_p
.
h
>
24
#
include
<
private
/
qqmljssourcelocation_p
.
h
>
25
26
#
include
<
chrono
>
27
#
include
<
memory
>
28
29
QT_BEGIN_NAMESPACE
30
31
namespace
QQmlJS
{
32
33
enum
class
CodegenResult
:
quint8
{
Success
,
Skip
,
Failure
};
34
35
struct
Q_QMLCOMPILER_EXPORT
AotStatsEntry
36
{
37
std
::
chrono
::
microseconds
codegenDuration
;
38
QString
functionName
;
39
QString
message
;
40
int
line
= 0;
41
int
column
= 0;
42
CodegenResult
codegenResult
=
CodegenResult
::
Success
;
43
44
bool
operator
<(
const
AotStatsEntry
&)
const
;
45
};
46
47
class
Q_QMLCOMPILER_EXPORT
AotStats
48
{
49
friend
class
QQmlJSAotCompilerStats
;
50
51
public
:
52
const
QHash
<
QString
,
QHash
<
QString
,
QList
<
AotStatsEntry
>>> &
entries
()
const
53
{
54
return
m_entries
;
55
}
56
57
void
registerFile
(
const
QString
&
moduleId
,
const
QString
&
filepath
);
58
void
addEntry
(
const
QString
&
moduleId
,
const
QString
&
filepath
,
const
AotStatsEntry
&
entry
);
59
void
insert
(
const
AotStats
&
other
);
60
61
static
std
::
optional
<
QStringList
>
readAllLines
(
const
QString
&
path
);
62
bool
saveToDisk
(
const
QString
&
filepath
)
const
;
63
64
static
std
::
optional
<
AotStats
>
parseAotstatsFile
(
const
QString
&
aotstatsPath
);
65
static
std
::
optional
<
AotStats
>
aggregateAotstatsList
(
const
QString
&
aotstatsListPath
);
66
67
static
std
::
optional
<
AotStats
>
fromJsonDocument
(
const
QJsonDocument
&);
68
QJsonDocument
toJsonDocument
()
const
;
69
70
private
:
71
// module Id -> filename -> stats m_entries
72
QHash
<
QString
,
QHash
<
QString
,
QList
<
AotStatsEntry
>>>
m_entries
;
73
};
74
75
class
Q_QMLCOMPILER_EXPORT
QQmlJSAotCompilerStats
76
{
77
public
:
78
static
AotStats
*
instance
() {
return
s_instance
.
get
(); }
79
80
static
bool
recordAotStats
() {
return
s_recordAotStats
; }
81
static
void
setRecordAotStats
(
bool
recordAotStats
) {
s_recordAotStats
=
recordAotStats
; }
82
83
static
QString
moduleId
() {
return
s_moduleId
; }
84
static
void
setModuleId
(
const
QString
&
moduleId
) {
s_moduleId
=
moduleId
; }
85
86
static
void
registerFile
(
const
QString
&
filepath
);
87
static
void
addEntry
(
const
QString
&
filepath
,
const
QQmlJS
::
AotStatsEntry
&
entry
);
88
89
private
:
90
static
std
::
unique_ptr
<
AotStats
>
s_instance
;
91
static
QString
s_moduleId
;
92
static
bool
s_recordAotStats
;
93
};
94
95
}
// namespace QQmlJS
96
97
QT_END_NAMESPACE
98
99
#
endif
// QQMLJSCOMPILERSTATS_P_H
QQmlJS::AotStats
Definition
qqmljscompilerstats_p.h:48
QQmlJS::QQmlJSAotCompilerStats
Definition
qqmljscompilerstats_p.h:76
QQmlJS
Definition
qv4bytecodegenerator_p.h:27
QQmlJS::S_LINE
static constexpr QLatin1StringView S_LINE
Definition
qqmljscompilerstats.cpp:93
QQmlJS::S_FORMAT_REVISION
static constexpr QLatin1StringView S_FORMAT_REVISION
Definition
qqmljscompilerstats.cpp:91
QQmlJS::S_ENTRIES
static constexpr QLatin1StringView S_ENTRIES
Definition
qqmljscompilerstats.cpp:89
QQmlJS::S_COLUMN
static constexpr QLatin1StringView S_COLUMN
Definition
qqmljscompilerstats.cpp:87
QQmlJS::S_MESSAGE
static constexpr QLatin1StringView S_MESSAGE
Definition
qqmljscompilerstats.cpp:94
QQmlJS::S_CODEGEN_RESULT
static constexpr QLatin1StringView S_CODEGEN_RESULT
Definition
qqmljscompilerstats.cpp:86
QQmlJS::S_AOTSTATS_FORMAT_REVISION
static constexpr int S_AOTSTATS_FORMAT_REVISION
Definition
qqmljscompilerstats.cpp:84
QQmlJS::S_MODULES
static constexpr QLatin1StringView S_MODULES
Definition
qqmljscompilerstats.cpp:95
QQmlJS::S_FILE_PATH
static constexpr QLatin1StringView S_FILE_PATH
Definition
qqmljscompilerstats.cpp:90
QQmlJS::S_DURATION_MICROSECONDS
static constexpr QLatin1StringView S_DURATION_MICROSECONDS
Definition
qqmljscompilerstats.cpp:88
QQmlJS::S_MODULE_FILES
static constexpr QLatin1StringView S_MODULE_FILES
Definition
qqmljscompilerstats.cpp:96
QQmlJS::S_MODULE_ID
static constexpr QLatin1StringView S_MODULE_ID
Definition
qqmljscompilerstats.cpp:97
QQmlJS::CodegenResult
CodegenResult
Definition
qqmljscompilerstats_p.h:33
QQmlJS::CodegenResult::Success
@ Success
Definition
qqmljscompilerstats_p.h:33
QQmlJS::CodegenResult::Skip
@ Skip
Definition
qqmljscompilerstats_p.h:33
QQmlJS::CodegenResult::Failure
@ Failure
Definition
qqmljscompilerstats_p.h:33
QQmlJS::S_FUNCTION_NAME
static constexpr QLatin1StringView S_FUNCTION_NAME
Definition
qqmljscompilerstats.cpp:92
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QQmlJS::AotStatsEntry
Definition
qqmljscompilerstats_p.h:36
qtdeclarative
src
qmlcompiler
qqmljscompilerstats_p.h
Generated on
for Qt by
1.18.0