From 2641c2514e7c6eeea5a4042128fbf7055adbe68e Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 1 Oct 2021 12:36:44 +0200 Subject: [PATCH] CppEditor: Add timing information for semantic highlighting Change-Id: If53fd8c8895916a613629628b4555983c0d76ce6 Reviewed-by: David Schulz --- src/plugins/cppeditor/semantichighlighter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/cppeditor/semantichighlighter.cpp b/src/plugins/cppeditor/semantichighlighter.cpp index b4c1a6ff1ff..f3112a725be 100644 --- a/src/plugins/cppeditor/semantichighlighter.cpp +++ b/src/plugins/cppeditor/semantichighlighter.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -165,6 +166,8 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to) return; // aborted qCDebug(log) << "onHighlighterResultAvailable()" << from << to; + QElapsedTimer t; + t.start(); SyntaxHighlighter *highlighter = m_baseTextDocument->syntaxHighlighter(); QTC_ASSERT(highlighter, return); @@ -234,11 +237,17 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to) } if (parentheses.first.isValid()) TextDocumentLayout::setParentheses(parentheses.first, parentheses.second); + + qCDebug(log) << "onHighlighterResultAvailable() took" << t.elapsed() << "ms"; } void SemanticHighlighter::onHighlighterFinished() { QTC_ASSERT(m_watcher, return); + + QElapsedTimer t; + t.start(); + if (!m_watcher->isCanceled() && documentRevision() == m_revision) { SyntaxHighlighter *highlighter = m_baseTextDocument->syntaxHighlighter(); if (QTC_GUARD(highlighter)) { @@ -273,6 +282,7 @@ void SemanticHighlighter::onHighlighterFinished() } m_watcher.reset(); + qCDebug(log) << "onHighlighterFinished() took" << t.elapsed() << "ms"; } void SemanticHighlighter::connectWatcher()