diff options
Diffstat (limited to 'overlay/cpu-top.c')
-rw-r--r-- | overlay/cpu-top.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/overlay/cpu-top.c b/overlay/cpu-top.c index 4e31da1b..c134d409 100644 --- a/overlay/cpu-top.c +++ b/overlay/cpu-top.c @@ -25,10 +25,20 @@ #include <stdio.h> #include <unistd.h> #include <fcntl.h> +#include <string.h> #include <errno.h> #include "cpu-top.h" +int cpu_top_init(struct cpu_top *cpu) +{ + memset(cpu, 0, sizeof(*cpu)); + + cpu->nr_cpu = sysconf(_SC_NPROCESSORS_ONLN); + + return 0; +} + int cpu_top_update(struct cpu_top *cpu) { struct cpu_stat *s = &cpu->stat[cpu->count++&1]; |