Skip to content

Commit

Permalink
Add CPU getters info
Browse files Browse the repository at this point in the history
  • Loading branch information
cfnptr committed Oct 27, 2024
1 parent 0a00421 commit 36fac9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions include/mpio/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion source/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 36fac9c

Please sign in to comment.