diff --git a/src/plugins/languageclient/progressmanager.cpp b/src/plugins/languageclient/progressmanager.cpp index 0f3580dcfb8..a2c6ae5ec2b 100644 --- a/src/plugins/languageclient/progressmanager.cpp +++ b/src/plugins/languageclient/progressmanager.cpp @@ -7,10 +7,14 @@ #include #include +#include + using namespace LanguageServerProtocol; namespace LanguageClient { +static Q_LOGGING_CATEGORY(LOGPROGRESS, "qtc.languageclient.progress", QtWarningMsg); + ProgressManager::ProgressManager() {} @@ -69,6 +73,8 @@ void ProgressManager::beginProgress(const ProgressToken &token, const WorkDonePr Core::FutureProgress *progress = Core::ProgressManager::addTask( interface->future(), title, languageClientProgressId(token)); m_progress[token] = {progress, interface}; + if (LOGPROGRESS().isDebugEnabled()) + m_timer[token].start(); reportProgress(token, begin); } @@ -101,6 +107,13 @@ void ProgressManager::endProgress(const ProgressToken &token, const WorkDoneProg } progress.progressInterface->setSubtitle(message); progress.progressInterface->setSubtitleVisibleInStatusBar(!message.isEmpty()); + auto timer = m_timer.take(token); + if (timer.isValid()) { + qCDebug(LOGPROGRESS) << QString("%1 took %2") + .arg(progress.progressInterface->title()) + .arg(QTime::fromMSecsSinceStartOfDay(timer.elapsed()) + .toString(Qt::ISODateWithMs)); + } } endProgress(token); } diff --git a/src/plugins/languageclient/progressmanager.h b/src/plugins/languageclient/progressmanager.h index 6db0b8899cf..0a940a960b3 100644 --- a/src/plugins/languageclient/progressmanager.h +++ b/src/plugins/languageclient/progressmanager.h @@ -5,6 +5,7 @@ #include +#include #include #include @@ -46,6 +47,7 @@ private: QMap m_progress; QMap m_titles; + QMap m_timer; }; } // namespace LanguageClient