---
config.def.h | 6 ++++++
slstatus.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 6370008..f099bd1 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -3,6 +3,12 @@
/* interval between updates (in ms) */
static const int interval = 1000;
+/* number of CPU's to scale CPU usage for
+ * ideally, this number is detected repeatedly in runtime
+ * since it may even change ...
+ */
+static int ncpu = 1;
+
/* text to show if no value can be retrieved */
static const char unknown_str[] = "n/a";
diff --git a/slstatus.c b/slstatus.c
index cddc79a..ef79b03 100644
--- a/slstatus.c
+++ b/slstatus.c
_AT_@ -197,7 +197,7 @@ cpu_perc(void)
perc = 100 * ((b[0]+b[1]+b[2]+b[5]+b[6]) - (a[0]+a[1]+a[2]+a[5]+a[6])) /
((b[0]+b[1]+b[2]+b[3]+b[4]+b[5]+b[6]) - (a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]));
- return bprintf("%d", perc);
+ return bprintf("%d", (ncpu?:1)*perc);
}
static const char *
_AT_@ -221,7 +221,7 @@ cpu_iowait(void)
perc = 100 * ((b[4]) - (a[4])) /
((b[0]+b[1]+b[2]+b[3]+b[4]+b[5]+b[6]) - (a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]));
- return bprintf("%d", perc);
+ return bprintf("%d", (ncpu?:1)*perc);
}
static const char *
--
1.8.5.rc3
Received on Thu Sep 14 2017 - 23:59:15 CEST
This archive was generated by hypermail 2.3.0 : Fri Sep 15 2017 - 00:12:08 CEST