AuroraRuntime/Source/HWInfo/AuCoreLoadSampler.hpp

44 lines
1.2 KiB
C++
Raw Normal View History

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuCpuLoadSampler.hpp
Date: 2023-10-28
Author: Reece
***/
#pragma once
namespace Aurora::HWInfo
{
struct CoreLoadSamplerState
{
double GetLoad(AuUInt32 uMinSamplePeriod,
AuUInt8 uThread,
bool bCountKernelUsage);
AuUInt64 uPrevSteadyTime {};
AuUInt64 uPrevTimes[256] {};
double dPrevLoad[256] {};
double dCurrentLoad[256] {};
double dCurrentLoadAll {};
AuUInt64 uCount {};
bool bSet {};
};
struct CoreLoadSamplerImpl : ICoreLoadSampler
{
CoreLoadSamplerImpl(AuUInt32 uMinSamplePeriodMS,
bool bCountKernelUsage);
~CoreLoadSamplerImpl();
double GetCoreLoad(AuUInt8 uCore) override;
double GetTotalLoad() override;
double GetTotalLoadCached() override;
double GetCoreLoadCached(AuUInt8 uCore) override;
double *GetCoreLoadsCached(AuUInt32 *pOut) override;
AuUInt32 uMinSamplePeriod {};
bool bCountKernelUsage {};
CoreLoadSamplerState state;
};
}