| 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 QQMLJSCOMPILERSTATSREPORTER_P_H |
| 5 | #define QQMLJSCOMPILERSTATSREPORTER_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 <QTextStream> |
| 18 | |
| 19 | #include <qtqmlcompilerexports.h> |
| 20 | |
| 21 | #include <private/qqmljscompilerstats_p.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | namespace QQmlJS { |
| 26 | |
| 27 | class Q_QMLCOMPILER_EXPORT AotStatsReporter |
| 28 | { |
| 29 | public: |
| 30 | AotStatsReporter(const QQmlJS::AotStats &stats, const QStringList &emptyModules, |
| 31 | const QStringList &onlyBytecodeModules); |
| 32 | |
| 33 | QString format() const; |
| 34 | |
| 35 | private: |
| 36 | void formatDetailedStats(QTextStream &) const; |
| 37 | void formatSummary(QTextStream &) const; |
| 38 | QString formatSuccessRate(int codegens, int successes) const; |
| 39 | |
| 40 | const AotStats &m_aotstats; |
| 41 | const QStringList &m_emptyModules; |
| 42 | const QStringList &m_onlyBytecodeModules; |
| 43 | |
| 44 | struct Counters |
| 45 | { |
| 46 | int successes = 0; |
| 47 | int codegens = 0; |
| 48 | }; |
| 49 | |
| 50 | Counters m_totalCounters; |
| 51 | QHash<QString, Counters> m_moduleCounters; |
| 52 | QHash<QString, QHash<QString, Counters>> m_fileCounters; |
| 53 | QList<std::chrono::microseconds> m_successDurations; |
| 54 | }; |
| 55 | |
| 56 | } // namespace QQmlJS |
| 57 | |
| 58 | QT_END_NAMESPACE |
| 59 | |
| 60 | #endif // QQMLJSCOMPILERSTATSREPORTER_P_H |
| 61 | |