AuroraRuntime/Source/IO/Net/AuSocketStats.cpp
Reece Wilson 267c2216b0 [+] UDP over socket API via existing INetSrvDatagram layer
(...missing send)
[+] AuIO::Buffer::ViewReader
[+] AuIO::Buffer::ViewSeekableReadable
[+] AuIO::Buffer::ViewWriter
[*] Clean up AuCompression
[*[ AuLog messages must always crunch for memory
[*] Various bug fixes
[*] Refactor+clean up
2022-12-12 23:50:05 +00:00

46 lines
983 B
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuSocketStats.cpp
Date: 2022-12-06
Author: Reece
***/
#include "Networking.hpp"
#include "AuSocketStats.hpp"
namespace Aurora::IO::Net
{
void SocketStats::AddBytes(AuUInt32 uBytes)
{
this->calculator.AddData(uBytes);
auto uNow = AuTime::CurrentClockMS();
if (!this->iFirstTime)
{
this->iFirstTime = uNow;
}
this->iLastTime = uNow;
this->uLastTimeSteadyMS = AuTime::SteadyClockMS();
}
AuInt64 SocketStats::GetFirstTickTimeMS()
{
return this->iFirstTime;
}
AuInt64 SocketStats::GetLastTickTimeMS()
{
return this->iLastTime;
}
AuUInt64 SocketStats::GetTotalBytesTransferred()
{
return this->calculator.GetTotalStats();
}
double SocketStats::GetApproximatedThroughput()
{
return this->calculator.GetEstimatedHertz();
}
}