diff options
Diffstat (limited to 'cpus.h')
-rw-r--r-- | cpus.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +#ifndef CPUS_H +#define CPUS_H + +#include <unistd.h> + +static inline int get_number_cpus(void) +{ + return sysconf(_SC_NPROCESSORS_CONF); +} + +static inline int get_number_cpus_online(void) +{ + return sysconf(_SC_NPROCESSORS_ONLN); +} + +#endif /* CPUS_H */ |