From 4ba370b5cabf9a7e75bb45d107a3ed54871c80cb Mon Sep 17 00:00:00 2001 From: Joerg Date: Mon, 9 Oct 2023 21:11:26 +0200 Subject: [PATCH] Add a debug message, which appears when event in Mixxx application took longer than 20ms --- src/mixxxapplication.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mixxxapplication.cpp b/src/mixxxapplication.cpp index d3625f47b29..7aaea3d56eb 100644 --- a/src/mixxxapplication.cpp +++ b/src/mixxxapplication.cpp @@ -61,6 +61,8 @@ class QMouseEventEditable : public QMouseEvent { #endif }; +constexpr mixxx::Duration kEventNotifyExecTimeWarningThreshold = mixxx::Duration::fromMillis(20); + } // anonymous namespace #endif @@ -168,7 +170,23 @@ bool MixxxApplication::notify(QObject* target, QEvent* event) { default: break; } - return QApplication::notify(target, event); + + PerformanceTimer time; + time.start(); + + bool ret = QApplication::notify(target, event); + + if (time.elapsed() > kEventNotifyExecTimeWarningThreshold) { + qDebug() << "Processing event type" + << event->type() + << "for object" + << target->metaObject()->className() + << target->objectName() + << "took" + << time.elapsed().debugMillisWithUnit(); + } + + return ret; } bool MixxxApplication::touchIsRightButton() {