AuroraRuntime/Source/HWInfo/AuCpuLoadSampler.hpp

37 lines
931 B
C++

/***
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 ProcessLoadSamplerState
{
double GetLoad(AuUInt32 uMinSamplePeriod, bool bThread, bool bCountKernelUsage);
AuUInt64 uPrevTimes[2] {};
double dPrevLoad {};
bool bSet {};
};
struct ProcessLoadSamplerImpl : IProcessLoadSampler
{
ProcessLoadSamplerImpl(AuUInt32 uMinSamplePeriodMS,
bool bThreadMode,
bool bCountKernelUsage);
~ProcessLoadSamplerImpl();
double GetLoad() override;
AuUInt32 uMinSamplePeriod {};
bool bThreadMode {};
bool bCountKernelUsage {};
ProcessLoadSamplerState processState;
AuTLSVariable<ProcessLoadSamplerState> threadState;
};
}