AuroraRuntime/Source/HWInfo/AuCpuLoadSampler.hpp

37 lines
901 B
C++
Raw Normal View History

2023-10-28 15:00:57 +00:00
/***
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);
2023-10-28 15:00:57 +00:00
AuUInt64 uPrevTimes[2] {};
double dPrevLoad {};
2023-12-08 10:26:12 +00:00
bool bSet {};
2023-10-28 15:00:57 +00:00
};
struct CpuLoadSamplerImpl : ICpuLoadSampler
{
CpuLoadSamplerImpl(AuUInt32 uMinSamplePeriodMS,
bool bThreadMode,
bool bCountKernelUsage);
2023-10-28 15:00:57 +00:00
~CpuLoadSamplerImpl();
double GetLoad() override;
AuUInt32 uMinSamplePeriod {};
bool bThreadMode {};
bool bCountKernelUsage {};
2023-10-28 15:00:57 +00:00
CpuLoadSamplerState processState;
AuTLSVariable<CpuLoadSamplerState> threadState;
};
}