aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljscompiler.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2025-12-12 15:08:05 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2025-12-19 10:46:06 +0100
commit5b2b9afb39cf25139bc8cc93cf646fcd9634c2de (patch)
treeaa01878d72fdddbd090a60db95f74f7c3cfb9086 /src/qmlcompiler/qqmljscompiler.cpp
parent54b5bfb667fba5de1f1e3c89e1329ca0301cbce0 (diff)
AOT stats: do not use high_resolution_clock
There is actually no guarantee that it's monotonic. Instead, use QElapsedTimer (we could also use monotonic_clock, but the Qt API is more convenient, except for the missing chrono return type). Pick-to: 6.11 6.10 Change-Id: Iccdc988d0ff54dd9403f99d05b2c22fe8459ebe2 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index 916f30b125..2efdb826f6 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -23,6 +23,7 @@
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qloggingcategory.h>
+#include <QtCore/qelapsedtimer.h>
#include <QtQml/private/qqmlsignalnames_p.h>
@@ -797,15 +798,16 @@ QQmlJSAotFunction QQmlJSAotCompiler::doCompileAndRecordAotStats(
const QV4::Compiler::Context *context, QQmlJSCompilePass::Function *function,
const QString &name, QQmlJS::SourceLocation location)
{
- auto t1 = std::chrono::high_resolution_clock::now();
+ QElapsedTimer timer {};
+ timer.start();
QQmlJSAotFunction result;
if (!m_logger->currentFunctionHasCompileError())
result = doCompile(context, function);
- auto t2 = std::chrono::high_resolution_clock::now();
+ auto elapsed = std::chrono::milliseconds { timer.elapsed() };
if (QQmlJS::QQmlJSAotCompilerStats::recordAotStats()) {
QQmlJS::AotStatsEntry entry;
- entry.codegenDuration = std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1);
+ entry.codegenDuration = elapsed;
entry.functionName = name;
entry.message = m_logger->currentFunctionWasSkipped()
? m_logger->currentFunctionCompileSkipMessage()