Reece Wilson
7be2d3fbdc
[+] AuNet::ISocketStats [+] AuNet::ISocketChannel::GetRecvStats() [+] AuNet::ISocketChannel::GetSendStats() [+] AuIO::IOProcessor::RunTickEx(AuUInt32 dwTimeout) [*] Refactor clock APIs [+] Documentation in headers [+] AuIO::IIOPipeWork::GetStartTickMS() [+] AuIO::IIOPipeWork::GetLastTickMS() [+] AuIO::IIOPipeWork::GetPredictedThroughput() [+] AuIO::IIOPipeWork::GetBytesProcessed()
35 lines
731 B
C++
35 lines
731 B
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: TimerHighRes.hpp
|
|
Date: 2021-6-10
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::Time
|
|
{
|
|
class TimerHighRes
|
|
{
|
|
public:
|
|
TimerHighRes()
|
|
{
|
|
Start();
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
start_ = HighResClockNS();
|
|
}
|
|
|
|
AuUInt64 End()
|
|
{
|
|
auto re = std::clamp<AuInt64>(HighResClockNS() - start_, AuInt64(0), AuNumericLimits<AuInt64>::max());
|
|
if (re == AuNumericLimits<AuInt64>::max()) return 0; // ez overflow in subtract. get out of here in 2-3 branches
|
|
return re;
|
|
}
|
|
|
|
private:
|
|
AuUInt64 start_;
|
|
};
|
|
} |