[+] AuOptional<AuUInt> Aurora::HWInfo::GetSwapSize()
[+] AuOptional<AuUInt> Aurora::HWInfo::GetPhysicalSize() utils
This commit is contained in:
parent
46850c9122
commit
627cdd069f
@ -29,19 +29,21 @@ namespace Aurora::HWInfo
|
||||
*/
|
||||
AUKN_SYM AuOptional<RamStat> GetMemStatSystem();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Physical Memory Used / Total Physical Memory
|
||||
* @return
|
||||
*/
|
||||
AUKN_SYM AuOptional<RamStat> GetMemStatPhysical();
|
||||
|
||||
|
||||
/**
|
||||
* @brief GetMemStatSystem at start-up
|
||||
* @return
|
||||
*/
|
||||
AUKN_SYM AuOptional<RamStat> GetMemStatStartup();
|
||||
|
||||
AUKN_SYM AuOptional<AuUInt> GetSwapSize();
|
||||
|
||||
AUKN_SYM AuOptional<AuUInt> GetPhysicalSize();
|
||||
|
||||
AUKN_SYM AuUInt32 GetPageSize();
|
||||
}
|
@ -271,6 +271,41 @@ namespace Aurora::HWInfo
|
||||
return gPageSize;
|
||||
}
|
||||
|
||||
AUKN_SYM AuOptional<AuUInt> GetSwapSize()
|
||||
{
|
||||
static AuOptional<AuUInt> gCached;
|
||||
if (gCached)
|
||||
{
|
||||
return gCached;
|
||||
}
|
||||
|
||||
if (auto opt = GetMemStatSystem())
|
||||
{
|
||||
if (auto optPhys = GetMemStatPhysical())
|
||||
{
|
||||
return gCached = (opt.value().qwAvailable - optPhys.value().qwAvailable);
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
AUKN_SYM AuOptional<AuUInt> GetPhysicalSize()
|
||||
{
|
||||
static AuOptional<AuUInt> gCached;
|
||||
if (gCached)
|
||||
{
|
||||
return gCached;
|
||||
}
|
||||
|
||||
if (auto optPhys = GetMemStatPhysical())
|
||||
{
|
||||
return gCached = optPhys.value().qwAvailable;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
static void SetPageSize()
|
||||
{
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
|
Loading…
Reference in New Issue
Block a user