summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
Diffstat (limited to 'slstatus.c')
-rw-r--r--slstatus.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/slstatus.c b/slstatus.c
index 9884aaa..87e705d 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -342,6 +342,22 @@ ip(const char *interface)
return smprintf(unknowntext);
}
+/* load avg */
+char *
+load_avg(const char *null)
+{
+ double avgs[3];
+
+ /* try to get load avg */
+ if (getloadavg(avgs, 3) < 0) {
+ fprintf(stderr, "Error getting load avg.\n");
+ return smprintf(unknowntext);
+ }
+
+ /* return it */
+ return smprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]);
+}
+
/* ram free */
char *
ram_free(const char *null)