mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[common] cpuinfo: add sockets to interface
This commit is contained in:
@@ -27,7 +27,8 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores)
|
||||
bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores,
|
||||
int * sockets)
|
||||
{
|
||||
FILE * cpuinfo = fopen("/proc/cpuinfo", "r");
|
||||
if (!cpuinfo)
|
||||
@@ -42,6 +43,9 @@ bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores)
|
||||
if (cores)
|
||||
*cores = 0;
|
||||
|
||||
if (sockets)
|
||||
*sockets = 1;
|
||||
|
||||
char buffer[1024];
|
||||
while (fgets(buffer, sizeof(buffer), cpuinfo))
|
||||
{
|
||||
|
@@ -95,7 +95,11 @@ static bool getCoreCount(int * cores, int * procs)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores)
|
||||
bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores,
|
||||
int * sockets)
|
||||
{
|
||||
if (sockets)
|
||||
*sockets = 1;
|
||||
|
||||
return getCPUModel(model, modelSize) && getCoreCount(cores, procs);
|
||||
}
|
||||
|
Reference in New Issue
Block a user