26 lines
779 B
C#
Raw Normal View History

2022-07-20 17:50:01 +08:00
using System.Threading;
using System.Threading.Tasks;
namespace RageCoop.Client
{
internal static class Statistics
{
2022-07-20 17:50:01 +08:00
public static int BytesDownPerSecond { get; private set; }
public static int BytesUpPerSecond { get; private set; }
static Statistics()
{
Task.Run(() =>
{
while (true)
{
2022-08-06 12:32:04 +08:00
var bu = Networking.Peer.Statistics.SentBytes;
var bd = Networking.Peer.Statistics.ReceivedBytes;
Thread.Sleep(1000);
2022-08-06 12:32:04 +08:00
BytesUpPerSecond=Networking.Peer.Statistics.SentBytes-bu;
BytesDownPerSecond=Networking.Peer.Statistics.ReceivedBytes-bd;
}
});
}
}
}