7 void print_load(const char *format) {
9 if (output_format == O_I3BAR)
10 printf("{\"name\":\"load\", \"full_text\":\"");
12 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun)
16 if (getloadavg(loadavg, 3) == -1)
19 for (walk = format; *walk != '\0'; walk++) {
25 if (BEGINS_WITH(walk+1, "1min")) {
26 (void)printf("%1.2f", loadavg[0]);
27 walk += strlen("1min");
30 if (BEGINS_WITH(walk+1, "5min")) {
31 (void)printf("%1.2f", loadavg[1]);
32 walk += strlen("5min");
35 if (BEGINS_WITH(walk+1, "15min")) {
36 (void)printf("%1.2f", loadavg[2]);
37 walk += strlen("15min");
41 if (output_format == O_I3BAR)
47 (void)fputs("Cannot read load\n", stderr);