My slstatus configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

load_avg.c 257 B

1234567891011121314151617
  1. #include <err.h>
  2. #include <stdlib.h>
  3. #include "util.h"
  4. const char *
  5. load_avg(const char *fmt)
  6. {
  7. double avgs[3];
  8. if (getloadavg(avgs, 3) < 0) {
  9. warnx("Failed to get the load avg");
  10. return NULL;
  11. }
  12. return bprintf(fmt, avgs[0], avgs[1], avgs[2]);
  13. }