AuroraRuntime/Include/Aurora/HWInfo/CpuLoadSampler.hpp

30 lines
1.1 KiB
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: CpuLoadSampler.hpp
Date: 2023-10-28
Author: Reece
Note: This API does not query system-wide CPU utilization
This belongs alongside AuProcess just about as much as our memory stat APIs do. I think it's fine to keep hardware perf query apis under AuHwInfo.
***/
#pragma once
namespace Aurora::HWInfo
{
struct ICpuLoadSampler
{
/**
* @brief
* @return a percentage (0 - 100; as a decimal) of the local process or thread CPU usage between ::GetLoad() calls, with respect to a uMinSamplePeriod averaging period.
*/
virtual double GetLoad() = 0;
};
AUKN_SHARED_SOO2_NCM(CpuLoadSampler, ICpuLoadSampler, 64,
((AuUInt32, bTriggered), (bool, bThreadMode)),
AuUInt32 uMinSamplePeriodMS = AuSToMS<AuUInt32>(1), // May be zero
bool bThreadMode = false); // False = Sample Process Usage | True = Sample Thread Usage
AUKN_SYM double GetProcessCPUUtilization();
}