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
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
29QT_BEGIN_NAMESPACE
30
31namespace QQmlJS {
32
34
46
47class Q_QMLCOMPILER_EXPORT AotStats
48{
50
51public:
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
62 bool saveToDisk(const QString &filepath) const;
63
66
69
70private:
71 // module Id -> filename -> stats m_entries
73};
74
75class Q_QMLCOMPILER_EXPORT QQmlJSAotCompilerStats
76{
77public:
78 static AotStats *instance() { return s_instance.get(); }
79
80 static bool recordAotStats() { return s_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
89private:
91 static QString s_moduleId;
92 static bool s_recordAotStats;
93};
94
95} // namespace QQmlJS
96
97QT_END_NAMESPACE
98
99#endif // QQMLJSCOMPILERSTATS_P_H
static constexpr QLatin1StringView S_LINE
static constexpr QLatin1StringView S_FORMAT_REVISION
static constexpr QLatin1StringView S_ENTRIES
static constexpr QLatin1StringView S_COLUMN
static constexpr QLatin1StringView S_MESSAGE
static constexpr QLatin1StringView S_CODEGEN_RESULT
static constexpr int S_AOTSTATS_FORMAT_REVISION
static constexpr QLatin1StringView S_MODULES
static constexpr QLatin1StringView S_FILE_PATH
static constexpr QLatin1StringView S_DURATION_MICROSECONDS
static constexpr QLatin1StringView S_MODULE_FILES
static constexpr QLatin1StringView S_MODULE_ID
static constexpr QLatin1StringView S_FUNCTION_NAME