From 658fab846e401b956530739f9ab4dce192362027 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:00:56 +1100 Subject: [PATCH] change net debug logging to kB/s --- source/game/StarNetPacketSocket.cpp | 3 --- source/game/StarUniverseClient.cpp | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/source/game/StarNetPacketSocket.cpp b/source/game/StarNetPacketSocket.cpp index e1feb1a..7a0724b 100644 --- a/source/game/StarNetPacketSocket.cpp +++ b/source/game/StarNetPacketSocket.cpp @@ -41,9 +41,6 @@ void PacketStatCollector::calculate() { m_lastMixTime = currentTime; m_stats.worstPacketSize = 0; - if (abs(elapsedTime) - m_calculationWindow < 0.0125f) - elapsedTime = m_calculationWindow; - for (auto& pair : m_unmixed) { if (pair.second > m_stats.worstPacketSize) { m_stats.worstPacketType = pair.first; diff --git a/source/game/StarUniverseClient.cpp b/source/game/StarUniverseClient.cpp index 7d455ba..f4efd50 100644 --- a/source/game/StarUniverseClient.cpp +++ b/source/game/StarUniverseClient.cpp @@ -296,13 +296,12 @@ void UniverseClient::update(float dt) { m_celestialDatabase->cleanup(); if (auto netStats = m_connection->incomingStats()) { - LogMap::set("net_incoming_bps", netStats->bytesPerSecond); - LogMap::set("net_worst_incoming", strf("{}:{}", PacketTypeNames.getRight(netStats->worstPacketType), netStats->worstPacketSize)); + LogMap::set("net_total_incoming", strf("{:4.3f} kB/s", netStats->bytesPerSecond / 1000.f)); + LogMap::set("net_worst_incoming", strf("^cyan;{}^reset; ({:4.3f} kB/s)", PacketTypeNames.getRight(netStats->worstPacketType), (float)netStats->worstPacketSize / 1000.f)); } if (auto netStats = m_connection->outgoingStats()) { - LogMap::set("net_outgoing_bps", netStats->bytesPerSecond); - LogMap::set("net_worst_outgoing", - strf("{}:{}", PacketTypeNames.getRight(netStats->worstPacketType), netStats->worstPacketSize)); + LogMap::set("net_total_outgoing", strf("{:4.3f} kB/s", netStats->bytesPerSecond / 1000.f)); + LogMap::set("net_worst_outgoing", strf("^cyan;{}^reset; ({:4.3f} kB/s)", PacketTypeNames.getRight(netStats->worstPacketType), (float)netStats->worstPacketSize / 1000.f)); } }