AuroraRuntime/Source/HWInfo/AuCpuLoadSampler.hpp
2023-10-29 21:02:09 +00:00

36 lines
879 B
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: CpuLoadSampler.hpp
Date: 2023-10-28
Author: Reece
***/
#pragma once
namespace Aurora::HWInfo
{
struct CpuLoadSamplerState
{
double GetLoad(AuUInt32 uMinSamplePeriod, bool bThread, bool bCountKernelUsage);
AuUInt64 uPrevTimes[2] {};
double dPrevLoad {};
};
struct CpuLoadSamplerImpl : ICpuLoadSampler
{
CpuLoadSamplerImpl(AuUInt32 uMinSamplePeriodMS,
bool bThreadMode,
bool bCountKernelUsage);
~CpuLoadSamplerImpl();
double GetLoad() override;
AuUInt32 uMinSamplePeriod {};
bool bThreadMode {};
bool bCountKernelUsage {};
CpuLoadSamplerState processState;
AuTLSVariable<CpuLoadSamplerState> threadState;
};
}