AuroraRuntime/Source/IO/Net/AuSocketStats.cpp

46 lines
983 B
C++
Raw Normal View History

/***
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();
}
}