New AzNetworking metrics display plus connection quality debug widgets using ImGui
Signed-off-by: kberg-amzn <karlberg@amazon.com>
This commit is contained in:
@@ -22,6 +22,7 @@ namespace AzNetworking
|
||||
const AZ::TimeMs deltaTimeMs = currentTimeMs - m_lastLoggedTimeMs;
|
||||
|
||||
m_atoms[m_activeAtom].m_bytesTransmitted += byteCount;
|
||||
m_atoms[m_activeAtom].m_packetsSent++;
|
||||
m_atoms[m_activeAtom].m_timeAccumulatorMs += deltaTimeMs;
|
||||
|
||||
if (m_atoms[m_activeAtom].m_timeAccumulatorMs >= m_maxSampleTimeMs)
|
||||
@@ -32,6 +33,11 @@ namespace AzNetworking
|
||||
m_lastLoggedTimeMs = currentTimeMs;
|
||||
}
|
||||
|
||||
void DatarateMetrics::LogPacketLost()
|
||||
{
|
||||
m_atoms[m_activeAtom].m_packetsLost++;
|
||||
}
|
||||
|
||||
float DatarateMetrics::GetBytesPerSecond() const
|
||||
{
|
||||
const uint32_t sampleAtom = 1 - m_activeAtom;
|
||||
@@ -47,6 +53,18 @@ namespace AzNetworking
|
||||
return (bytesLogged * 1000.0f) / sampleTime; // (* 1000) to convert from bytes per millisecond to bytes per second
|
||||
}
|
||||
|
||||
float DatarateMetrics::GetLossRatePercent() const
|
||||
{
|
||||
const uint32_t sampleAtom = 1 - m_activeAtom;
|
||||
|
||||
if (m_atoms[sampleAtom].m_packetsSent == 0)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return float(m_atoms[sampleAtom].m_packetsLost) / float(m_atoms[sampleAtom].m_packetsSent);
|
||||
}
|
||||
|
||||
void ConnectionComputeRtt::LogPacketSent(PacketId packetId, AZ::TimeMs currentTimeMs)
|
||||
{
|
||||
for (uint32_t i = 0; i < MaxTrackableEntries; i++)
|
||||
|
||||
Reference in New Issue
Block a user