42 lines
810 B
C++
42 lines
810 B
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: HWInfo.hpp
|
|
Date: 2021-6-19
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include "HWInfo.hpp"
|
|
#include "CpuInfo.hpp"
|
|
#include "RamInfo.hpp"
|
|
|
|
#if defined(AURORA_IS_BSD_DERIVED)
|
|
#include <sys/types.h>
|
|
#include <sys/sysctl.h>
|
|
#endif
|
|
|
|
namespace Aurora::HWInfo
|
|
{
|
|
AuOptional<AuUInt> QueryBsdHwStat(int id)
|
|
{
|
|
#if defined(AURORA_IS_BSD_DERIVED)
|
|
int mib[4];
|
|
AuUInt stat;
|
|
size_t len = sizeof(stat);
|
|
|
|
mib[0] = CTL_HW;
|
|
mib[1] = id;
|
|
|
|
auto ret = sysctl(mib, 2, &stat, &len, NULL, 0);
|
|
return ret == 0 ? stat : {};
|
|
#else
|
|
return {};
|
|
#endif
|
|
}
|
|
|
|
void Init()
|
|
{
|
|
InitCpuInfo();
|
|
InitRamInfo();
|
|
}
|
|
} |