load.c (239B)
1 #include <stdlib.h> 2 #include <stdio.h> 3 4 int 5 loadread(void *arg, char *buf, size_t len) 6 { 7 double avgs[3]; 8 9 if (getloadavg(avgs, 3) < 0) 10 return -1; 11 snprintf(buf, len, "%.2f %.2f %.2f", 12 avgs[0], avgs[1], avgs[2]); 13 return 0; 14 }