summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authoreplanet <emeric.planet@gmail.com>2017-03-26 12:54:07 +0200
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2017-03-26 06:54:07 -0400
commit94651257cea4ff419f9cf2143d93193d5a5ccb96 (patch)
treeca563d7570df6c8e84e93a04ecf85037ab77eae8 /i3status.c
parent3ae0decbb33015fb111cdf7ea3d117bd6988cc05 (diff)
Multiple CPU support for cpu_usage (#209)
This change addresses the issue #199 asking for multiple CPU support. It takes an arbitrary CPU number and outputs its usage using the same arithmetics as for CPU aggregation. It currently doesn't support FreeBSD.
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/i3status.c b/i3status.c
index 3b9ab72..558f8ab 100644
--- a/i3status.c
+++ b/i3status.c
@@ -422,6 +422,7 @@ int main(int argc, char *argv[]) {
CFG_STR("format", "%usage", CFGF_NONE),
CFG_STR("format_above_threshold", NULL, CFGF_NONE),
CFG_STR("format_above_degraded_threshold", NULL, CFGF_NONE),
+ CFG_STR("path", "/proc/stat", CFGF_NONE),
CFG_FLOAT("max_threshold", 95, CFGF_NONE),
CFG_FLOAT("degraded_threshold", 90, CFGF_NONE),
CFG_CUSTOM_ALIGN_OPT,
@@ -751,7 +752,7 @@ int main(int argc, char *argv[]) {
CASE_SEC("cpu_usage") {
SEC_OPEN_MAP("cpu_usage");
- print_cpu_usage(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getstr(sec, "format_above_threshold"), cfg_getstr(sec, "format_above_degraded_threshold"), cfg_getfloat(sec, "max_threshold"), cfg_getfloat(sec, "degraded_threshold"));
+ print_cpu_usage(json_gen, buffer, cfg_getstr(sec, "format"), cfg_getstr(sec, "format_above_threshold"), cfg_getstr(sec, "format_above_degraded_threshold"), cfg_getstr(sec, "path"), cfg_getfloat(sec, "max_threshold"), cfg_getfloat(sec, "degraded_threshold"));
SEC_CLOSE_MAP;
}
}