forked from external/yambar
modules: use portable function to count cpus
This commit is contained in:
parent
6c10eb2153
commit
8d91cbd8a3
1 changed files with 2 additions and 3 deletions
|
@ -9,8 +9,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <sys/sysinfo.h>
|
|
||||||
|
|
||||||
#define LOG_MODULE "cpu"
|
#define LOG_MODULE "cpu"
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
|
@ -57,7 +56,7 @@ description(struct module *mod)
|
||||||
static uint32_t
|
static uint32_t
|
||||||
get_cpu_nb_cores()
|
get_cpu_nb_cores()
|
||||||
{
|
{
|
||||||
int nb_cores = get_nprocs();
|
int nb_cores = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
LOG_DBG("CPU count: %d", nb_cores);
|
LOG_DBG("CPU count: %d", nb_cores);
|
||||||
|
|
||||||
return nb_cores;
|
return nb_cores;
|
||||||
|
|
Loading…
Add table
Reference in a new issue