change net debug logging to kB/s

This commit is contained in:
Kae 2024-03-15 16:00:56 +11:00
parent 6208636d69
commit 658fab846e
2 changed files with 4 additions and 8 deletions

View File

@ -41,9 +41,6 @@ void PacketStatCollector::calculate() {
m_lastMixTime = currentTime; m_lastMixTime = currentTime;
m_stats.worstPacketSize = 0; m_stats.worstPacketSize = 0;
if (abs(elapsedTime) - m_calculationWindow < 0.0125f)
elapsedTime = m_calculationWindow;
for (auto& pair : m_unmixed) { for (auto& pair : m_unmixed) {
if (pair.second > m_stats.worstPacketSize) { if (pair.second > m_stats.worstPacketSize) {
m_stats.worstPacketType = pair.first; m_stats.worstPacketType = pair.first;

View File

@ -296,13 +296,12 @@ void UniverseClient::update(float dt) {
m_celestialDatabase->cleanup(); m_celestialDatabase->cleanup();
if (auto netStats = m_connection->incomingStats()) { if (auto netStats = m_connection->incomingStats()) {
LogMap::set("net_incoming_bps", netStats->bytesPerSecond); LogMap::set("net_total_incoming", strf("{:4.3f} kB/s", netStats->bytesPerSecond / 1000.f));
LogMap::set("net_worst_incoming", strf("{}:{}", PacketTypeNames.getRight(netStats->worstPacketType), netStats->worstPacketSize)); 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()) { if (auto netStats = m_connection->outgoingStats()) {
LogMap::set("net_outgoing_bps", netStats->bytesPerSecond); LogMap::set("net_total_outgoing", strf("{:4.3f} kB/s", netStats->bytesPerSecond / 1000.f));
LogMap::set("net_worst_outgoing", LogMap::set("net_worst_outgoing", strf("^cyan;{}^reset; ({:4.3f} kB/s)", PacketTypeNames.getRight(netStats->worstPacketType), (float)netStats->worstPacketSize / 1000.f));
strf("{}:{}", PacketTypeNames.getRight(netStats->worstPacketType), netStats->worstPacketSize));
} }
} }