QtSingleApplication: Introduce QTC_FREEZE_DETECTOR env var

This may help with tracking the freezes in main thread.
By default, when QTC_FREEZE_DETECTOR is set, it detects
freezes above the 100 ms and prints the receiver object
and event type that triggered the freeze.

Change the default 100 ms threshold by setting the
QTC_FREEZE_DETECTOR to some different numeric value.

Change-Id: Ifb68c7648c09a5329f1f2aa39cd7e29e69a76052
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jarek Kobus
2023-05-02 19:47:49 +02:00
parent de247bff2b
commit a059f87754
3 changed files with 81 additions and 22 deletions

View File

@@ -22,29 +22,20 @@
#include <QDebug>
#include <QDir>
#include <QFontDatabase>
#include <QFileInfo>
#include <QFontDatabase>
#include <QLibraryInfo>
#include <QScopeGuard>
#include <QStyle>
#include <QTextStream>
#include <QThreadPool>
#include <QTimer>
#include <QTranslator>
#include <QUrl>
#include <QVariant>
#include <QSysInfo>
#include <QNetworkProxyFactory>
#include <QApplication>
#include <QMessageBox>
#include <QNetworkProxyFactory>
#include <QPixmapCache>
#include <QProcess>
#include <QScopeGuard>
#include <QStandardPaths>
#include <QTemporaryDir>
#include <QStyle>
#include <QTextCodec>
#include <QTextStream>
#include <QThreadPool>
#include <QTranslator>
#include <iterator>
#include <optional>
@@ -589,11 +580,12 @@ int main(int argc, char **argv)
SharedTools::QtSingleApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
int numberofArguments = static_cast<int>(options.appArguments.size());
int numberOfArguments = static_cast<int>(options.appArguments.size());
SharedTools::QtSingleApplication app((QLatin1String(Core::Constants::IDE_DISPLAY_NAME)),
numberofArguments,
options.appArguments.data());
std::unique_ptr<SharedTools::QtSingleApplication>
appPtr(SharedTools::createApplication(QLatin1String(Core::Constants::IDE_DISPLAY_NAME),
numberOfArguments, options.appArguments.data()));
SharedTools::QtSingleApplication &app = *appPtr;
QCoreApplication::setApplicationName(Core::Constants::IDE_CASED_ID);
QCoreApplication::setApplicationVersion(QLatin1String(Core::Constants::IDE_VERSION_LONG));
QCoreApplication::setOrganizationName(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR));