Measure time for update check (for debugging).

This commit is contained in:
LoRd_MuldeR 2017-03-29 23:42:39 +02:00
parent 9e5cf62209
commit 9c63c30d90
3 changed files with 19 additions and 4 deletions

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 7 #define VER_X264_MINOR 7
#define VER_X264_PATCH 9 #define VER_X264_PATCH 9
#define VER_X264_BUILD 1094 #define VER_X264_BUILD 1095
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)

View File

@ -44,6 +44,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
#include <QMap> #include <QMap>
#include <QElapsedTimer>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -189,9 +190,10 @@ void UpdaterDialog::keyPressEvent(QKeyEvent *event)
break; break;
case Qt::Key_F11: case Qt::Key_F11:
{ {
const QString logFilePath = MUtils::make_temp_file(MUtils::temp_folder(), "log", true); const QString logFilePath = MUtils::make_temp_file(MUtils::temp_folder(), "txt", true);
if (!logFilePath.isEmpty()) if (!logFilePath.isEmpty())
{ {
qWarning("Write log to: '%s'", MUTILS_UTF8(logFilePath));
QFile logFile(logFilePath); QFile logFile(logFilePath);
if (logFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) if (logFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
{ {
@ -298,8 +300,12 @@ void UpdaterDialog::checkForUpdates(void)
//Clear log //Clear log
m_logFile.clear(); m_logFile.clear();
//Init timer
m_elapsed.reset(new QElapsedTimer());
m_elapsed->start();
//Start the updater thread //Start the updater thread
QTimer::singleShot(250, m_thread.data(), SLOT(start())); QTimer::singleShot(125, m_thread.data(), SLOT(start()));
} }
void UpdaterDialog::threadStatusChanged(int status) void UpdaterDialog::threadStatusChanged(int status)
@ -367,12 +373,19 @@ void UpdaterDialog::threadStatusChanged(int status)
void UpdaterDialog::threadFinished(void) void UpdaterDialog::threadFinished(void)
{ {
m_success = m_thread->getSuccess(); m_success = m_thread->getSuccess();
QTimer::singleShot((m_success ? 1000 : 0), this, SLOT(updateFinished()));
ui->labelCancel->hide(); ui->labelCancel->hide();
QTimer::singleShot((m_success ? 500 : 0), this, SLOT(updateFinished()));
} }
void UpdaterDialog::updateFinished(void) void UpdaterDialog::updateFinished(void)
{ {
//Query the timer, if available
if (!m_elapsed.isNull())
{
const quint64 elapsed = m_elapsed->restart();
qDebug("Update check completed after %.2f seconds.", double(elapsed) / 1000.0);
}
//Restore cursor //Restore cursor
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();

View File

@ -25,6 +25,7 @@
#include <QMap> #include <QMap>
class QMovie; class QMovie;
class QElapsedTimer;
class SysinfoModel; class SysinfoModel;
namespace Ui namespace Ui
@ -89,6 +90,7 @@ private:
QScopedPointer<QMovie> m_animator; QScopedPointer<QMovie> m_animator;
QScopedPointer<MUtils::UpdateChecker> m_thread; QScopedPointer<MUtils::UpdateChecker> m_thread;
QScopedPointer<QElapsedTimer> m_elapsed;
unsigned long m_updaterProcess; unsigned long m_updaterProcess;
QStringList m_logFile; QStringList m_logFile;