forked from mumble-voip/mumble
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEAT(server, client): Add rolling connection quality stats
Previously, only the total packet statistics since the user had connected were tracked. While a good start, these stats are not really helping to understand sudden connection problems. This commit adds additional server-side rolling packet stats which are updated every few seconds/minutes. These new stats are sent using additional fields in the UserStats protocol message and rendered in the UserInformation dialog in the client. Closes mumble-voip#5872
- Loading branch information
Showing
8 changed files
with
418 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright The Mumble Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file at the root of the | ||
// Mumble source tree or at <https://www.mumble.info/LICENSE>. | ||
|
||
#include "CryptState.h" | ||
|
||
void CryptState::updateRollingStats() { | ||
std::chrono::time_point< std::chrono::steady_clock > now = std::chrono::steady_clock::now(); | ||
|
||
// Update no more than every few seconds | ||
if ((now - m_rollingLastSampleTime) < m_rollingScanInterval) { | ||
return; | ||
} | ||
|
||
m_rollingLastSampleTime = now; | ||
|
||
PacketStatsSnapshot snapshotLocal; | ||
snapshotLocal.stats = m_statsLocal; | ||
snapshotLocal.timestamp = now; | ||
m_statsLocalReference.push(snapshotLocal); | ||
|
||
PacketStatsSnapshot snapshotRemote; | ||
snapshotRemote.stats = m_statsRemote; | ||
snapshotRemote.timestamp = now; | ||
m_statsRemoteReference.push(snapshotRemote); | ||
|
||
while (!m_statsLocalReference.empty() && (now - m_statsLocalReference.front().timestamp) > m_rollingWindow) { | ||
m_statsLocalReference.pop(); | ||
} | ||
|
||
while (!m_statsRemoteReference.empty() && (now - m_statsRemoteReference.front().timestamp) > m_rollingWindow) { | ||
m_statsRemoteReference.pop(); | ||
} | ||
|
||
if (!m_statsLocalReference.empty()) { | ||
m_statsLocalRolling.good = m_statsLocal.good - m_statsLocalReference.front().stats.good; | ||
m_statsLocalRolling.late = m_statsLocal.late - m_statsLocalReference.front().stats.late; | ||
m_statsLocalRolling.lost = m_statsLocal.lost - m_statsLocalReference.front().stats.lost; | ||
m_statsLocalRolling.resync = m_statsLocal.resync - m_statsLocalReference.front().stats.resync; | ||
} | ||
|
||
if (!m_statsRemoteReference.empty()) { | ||
m_statsRemoteRolling.good = m_statsRemote.good - m_statsRemoteReference.front().stats.good; | ||
m_statsRemoteRolling.late = m_statsRemote.late - m_statsRemoteReference.front().stats.late; | ||
m_statsRemoteRolling.lost = m_statsRemote.lost - m_statsRemoteReference.front().stats.lost; | ||
m_statsRemoteRolling.resync = m_statsRemote.resync - m_statsRemoteReference.front().stats.resync; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.