Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QQMLJSCOMPILERSTATS_P_H
5#define QQMLJSCOMPILERSTATS_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16
17#include <qtqmlcompilerexports.h>
18
19#include <QHash>
20#include <QJsonDocument>
21
22#include <private/qqmljsdiagnosticmessage_p.h>
23#include <private/qqmljssourcelocation_p.h>
24
25#include <memory>
26
28
29namespace QQmlJS {
30
31struct Q_QMLCOMPILER_EXPORT AotStatsEntry
32{
33 std::chrono::microseconds codegenDuration;
36 int line = 0;
37 int column = 0;
38 bool codegenSuccessful = true;
39
40 bool operator<(const AotStatsEntry &) const;
41};
42
43class Q_QMLCOMPILER_EXPORT AotStats
44{
46
47public:
48 const QHash<QString, QHash<QString, QList<AotStatsEntry>>> &entries() const
49 {
50 return m_entries;
51 }
52
53 void addEntry(const QString &moduleId, const QString &filepath, const AotStatsEntry &entry);
54 void insert(const AotStats &other);
55
56 bool saveToDisk(const QString &filepath) const;
57
58 static std::optional<AotStats> parseAotstatsFile(const QString &aotstatsPath);
59 static std::optional<AotStats> aggregateAotstatsList(const QString &aotstatsListPath);
60
61 static AotStats fromJsonDocument(const QJsonDocument &);
62 QJsonDocument toJsonDocument() const;
63
64private:
65 // module Id -> filename -> stats m_entries
66 QHash<QString, QHash<QString, QList<AotStatsEntry>>> m_entries;
67};
68
69class Q_QMLCOMPILER_EXPORT QQmlJSAotCompilerStats
70{
71public:
72 static AotStats *instance() { return s_instance.get(); }
73
74 static bool recordAotStats() { return s_recordAotStats; }
75 static void setRecordAotStats(bool recordAotStats) { s_recordAotStats = recordAotStats; }
76
77 static QString moduleId() { return s_moduleId; }
78 static void setModuleId(const QString &moduleId) { s_moduleId = moduleId; }
79
80 static void addEntry(const QString &filepath, const QQmlJS::AotStatsEntry &entry);
81
82private:
83 static std::unique_ptr<AotStats> s_instance;
84 static QString s_moduleId;
85 static bool s_recordAotStats;
86};
87
88} // namespace QQmlJS
89
91
92#endif // QQMLJSCOMPILERSTATS_P_H
\inmodule QtCore\reentrant
const QHash< QString, QHash< QString, QList< AotStatsEntry > > > & entries() const
static void setModuleId(const QString &moduleId)
static void setRecordAotStats(bool recordAotStats)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
cache insert(employee->id(), employee)
Combined button and popup list for selecting options.
GLenum GLenum GLsizei void GLsizei void * column
GLuint entry
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
QSharedPointer< T > other(t)
[5]
std::chrono::microseconds codegenDuration