From 45fe8b57a5afbdfdc6fabcc77ab7e2c46c1df48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sun, 23 Aug 2026 00:14:06 +0200 Subject: [PATCH] [Client] Rename LagMonitor constants to SCREAMING_SNAKE_CASE Took 15 minutes --- cockatrice/src/client/lag_monitor.cpp | 8 ++++---- cockatrice/src/client/lag_monitor.h | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cockatrice/src/client/lag_monitor.cpp b/cockatrice/src/client/lag_monitor.cpp index f542df24c..5a7efe6df 100644 --- a/cockatrice/src/client/lag_monitor.cpp +++ b/cockatrice/src/client/lag_monitor.cpp @@ -5,7 +5,7 @@ LagMonitor::LagMonitor(QObject *parent) : QObject(parent) { timer = new QTimer(this); - timer->setInterval(TickIntervalMs); + timer->setInterval(TICK_INTERVAL_MS); connect(timer, &QTimer::timeout, this, &LagMonitor::checkTick); tickClock.start(); timer->start(); @@ -25,7 +25,7 @@ void LagMonitor::checkTick() { const qint64 gap = tickClock.restart(); - if (gap <= StallThresholdMs) { + if (gap <= STALL_THRESHOLD_MS) { return; } @@ -34,10 +34,10 @@ void LagMonitor::checkTick() record.durationMs = gap; stalls.append(record); - while (stalls.size() > MaxRecordedStalls) { + while (stalls.size() > MAX_RECORDED_STALLS) { stalls.removeFirst(); } qCWarning(LagMonitorLog, "Event loop stalled for %lld ms (threshold: %d ms)", static_cast(gap), - StallThresholdMs); + STALL_THRESHOLD_MS); } diff --git a/cockatrice/src/client/lag_monitor.h b/cockatrice/src/client/lag_monitor.h index 4476bc458..2dfdc2766 100644 --- a/cockatrice/src/client/lag_monitor.h +++ b/cockatrice/src/client/lag_monitor.h @@ -19,7 +19,7 @@ class QTimer; /** * @brief Detects main-thread event loop stalls ("UI freezes") from the inside. * - * A timer is expected to fire every TickIntervalMs of wall time. When the + * A timer is expected to fire every TICK_INTERVAL_MS of wall time. When the * observed gap greatly exceeds that interval, some other task blocked the * event loop for roughly the overshooting duration. This is what separates * "my client froze" from "the network is lagging" in user reports. @@ -38,9 +38,9 @@ public: qint64 durationMs = 0; ///< approximate length of the freeze }; - static constexpr int TickIntervalMs = 500; - static constexpr int StallThresholdMs = 2000; - static constexpr int MaxRecordedStalls = 32; + static constexpr int TICK_INTERVAL_MS = 500; + static constexpr int STALL_THRESHOLD_MS = 2000; + static constexpr int MAX_RECORDED_STALLS = 32; explicit LagMonitor(QObject *parent = nullptr); @@ -48,7 +48,7 @@ public: * @brief Stalls recorded during this session, oldest first. * * Intended consumers are log output and the diagnostics export. The list - * holds at most MaxRecordedStalls entries. + * holds at most MAX_RECORDED_STALLS entries. */ QList recentStalls() const;