Skip to content

Commit b13e49e

Browse files
authored
fix: Track RTT in seconds rather than milliseconds (#1816)
* fix: Track RTT in seconds rather than milliseconds To maintain compatibility with the RNSM, which has been modified to only accept metrics in base units such as Bytes and Seconds, and not units with a metric prefix such as milliseconds. * Update test comparison value from ms to seconds
1 parent f1c61d3 commit b13e49e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,15 @@ public void TrackPacketReceived(uint packetCount)
462462
#endif
463463
}
464464

465-
public void TrackRttToServer(int rtt)
465+
public void TrackRttToServer(int rttMilliseconds)
466466
{
467467
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
468468
if (!CanSendMetrics)
469469
{
470470
return;
471471
}
472-
473-
m_RttToServerGauge.Set(rtt);
472+
var rttSeconds = rttMilliseconds * 1e-3;
473+
m_RttToServerGauge.Set(rttSeconds);
474474
#endif
475475
}
476476

com.unity.netcode.gameobjects/Tests/Runtime/Metrics/RttMetricsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public IEnumerator TrackRttMetricClientToServer()
9292
foreach (var clientGaugeMetricValue in clientGaugeMetricValues)
9393
{
9494
var rttValue = clientGaugeMetricValue.AssertMetricValueHaveBeenFound();
95-
Assert.That(rttValue, Is.GreaterThanOrEqualTo(1f));
95+
Assert.That(rttValue, Is.GreaterThanOrEqualTo(1e-3f));
9696
}
9797
}
9898
}

0 commit comments

Comments
 (0)