AuroraRuntime/Source/HWInfo/AuCpuInfo.cpp

64 lines
1.4 KiB
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
2022-11-17 07:46:07 +00:00
File: AuCpuInfo.cpp
2021-06-27 21:25:29 +00:00
Date: 2021-6-12
Author: Reece
***/
2021-09-30 14:57:41 +00:00
#include <Source/RuntimeInternal.hpp>
2022-11-17 07:46:07 +00:00
#include "AuHWInfo.hpp"
#include "AuCpuInfo.hpp"
#include "AuCpuId.hpp"
2021-06-27 21:25:29 +00:00
#if defined(AURORA_IS_POSIX_DERIVED)
#include <stdlib.h>
#include <sys/sysinfo.h>
#endif
#if defined(AURORA_IS_MODERNNT_DERIVED)
2022-11-17 07:46:07 +00:00
#include "AuCpuInfo.NT.hpp"
#endif
#if defined(AURORA_IS_BSD_DERIVED)
2022-11-17 07:46:07 +00:00
#include "AuCpuInfo.BSD.hpp"
#endif
#if defined(AURORA_IS_LINUX_DERIVED)
2022-11-17 07:46:07 +00:00
#include "AuCpuInfo.Linux.hpp"
#endif
namespace Aurora::HWInfo
{
static void SetCpuTopology()
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
SetCpuTopologyNT();
#elif defined(AURORA_IS_BSD_DERIVED)
SetCpuTopologyBSD();
#elif defined(AURORA_IS_LINUX_DERIVED)
SetCpuTopologyLinux();
#elif defined(AURORA_IS_POSIX_DERIVED)
gCpuInfo.uSocket = 1;
gCpuInfo.uCores = 1;
gCpuInfo.uThreads = sysconf(_SC_NPROCESSORS_ONLN);
#endif
}
static void SetFakeTopologyIfMissing()
{
2022-03-20 12:50:36 +00:00
// This stunk
}
void InitCpuInfo()
{
gCpuInfo.bMaskMTContig = false;
gCpuInfo.bMaskMTHalf = false;
gCpuInfo.cpuArch = Aurora::Build::kCurrentArchitecture;
SetCpuId();
SetCpuTopology();
SetFakeTopologyIfMissing();
}
}