forked from qt-creator/qt-creator
FreezeDetector: Don't report nested calls to notify
Report only top level, otherwise reports may overlap. Change-Id: I30c2b2ca6368bd43c68ce8275af2e58e0c6c12c5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -182,13 +182,17 @@ public:
|
||||
void setFreezeTreshold(std::chrono::milliseconds freezeAbove) { m_threshold = freezeAbove; }
|
||||
|
||||
bool notify(QObject *receiver, QEvent *event) override {
|
||||
if (m_inNotify)
|
||||
return QtSingleApplication::notify(receiver, event);
|
||||
using namespace std::chrono;
|
||||
const auto start = system_clock::now();
|
||||
const QPointer<QObject> p(receiver);
|
||||
const QString className = QLatin1String(receiver->metaObject()->className());
|
||||
const QString name = receiver->objectName();
|
||||
|
||||
m_inNotify = true;
|
||||
const bool ret = QtSingleApplication::notify(receiver, event);
|
||||
m_inNotify = false;
|
||||
|
||||
const auto end = system_clock::now();
|
||||
const auto freeze = duration_cast<milliseconds>(end - start);
|
||||
@@ -207,6 +211,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_inNotify = false;
|
||||
const QString m_align;
|
||||
std::chrono::milliseconds m_threshold = std::chrono::milliseconds(100);
|
||||
};
|
||||
|
Reference in New Issue
Block a user