2022-12-06 22:53:37 +00:00
|
|
|
/***
|
|
|
|
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;
|
2022-12-12 23:50:05 +00:00
|
|
|
this->uLastTimeSteadyMS = AuTime::SteadyClockMS();
|
2022-12-06 22:53:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|