cpu.h (334B)
1 #ifndef PLONG_CPU_H 2 #define PLONG_CPU_H 3 4 #include <stdint.h> 5 #include "json.h" 6 7 #define CPU_FIELDS(x) \ 8 x(user) \ 9 x(nice) \ 10 x(system) \ 11 x(idle) \ 12 x(iowait) \ 13 x(irq) \ 14 x(softirq) 15 16 struct cpu { 17 #define X(f) uintmax_t f; 18 CPU_FIELDS(X) 19 #undef X 20 }; 21 22 int cpu_init(struct cpu *c); 23 int cpu_poll(struct cpu *c, struct json *j); 24 25 #endif