From 36fac9c61ce4c69c80a8067f4d25b5edc155d180 Mon Sep 17 00:00:00 2001 From: Nikita Fediuchin Date: Sun, 27 Oct 2024 22:34:48 +0200 Subject: [PATCH] Add CPU getters info --- README.md | 4 +++- include/mpio/os.h | 6 ------ source/os.c | 3 ++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b4c9662..9def512 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ See the [documentation](https://cfnptr.github.io/mpio). * Common directory and file functions * App data and resources path getters -* CPU name, RAM size, CPU count getters +* CPU name (brand, model) getters +* Free and total RAM size getters +* Logical, physical, performance CPU count getters * Current clock (time stamp) getter * C and C++ implementations diff --git a/include/mpio/os.h b/include/mpio/os.h index e6d3a0f..e865041 100644 --- a/include/mpio/os.h +++ b/include/mpio/os.h @@ -39,12 +39,6 @@ int getLogicalCpuCount(); */ int getPhysicalCpuCount(); -/** - * @brief Returns system physical CPU count. (MT-Safe) - * @details Usefull for a foreground thread pool thread count. - */ -int getPhysicalCpuCount(); - /** * @brief Returns system performance CPU count. (MT-Safe) * @details Usefull for a foreground thread pool thread count. diff --git a/source/os.c b/source/os.c index b3ce8d0..39ef5cc 100644 --- a/source/os.c +++ b/source/os.c @@ -225,7 +225,8 @@ int getPerformanceCpuCount() { int cpuCount = -1; #if __linux__ - // TODO: use /sys/devices/system/cpu/cpu0/cpu_capacity + // TODO: use libcpuid approach with cpuid and affinity. + // https://github.com/anrieff/libcpuid/blob/master/libcpuid/cpuid_main.c#L96 #elif _WIN32 DWORD infoSize = 0; GetLogicalProcessorInformationEx(RelationProcessorCore, NULL, &infoSize);