diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-06-04 00:08:47 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-06-04 00:08:47 +0200 |
commit | a7422da9eb920e217751f7a34b1aafba27029b52 (patch) | |
tree | 3297dcc2dd2cdfdf8dda1d90c57a3cc013895522 /cpus.h | |
parent | 9e4cf71371187927a6eb7cc4fe32b67d58a93010 (diff) |
cpus: break out cpu related functions from xutils
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
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 */ |