diff options
-rw-r--r-- | i3status.c | 4 | ||||
-rw-r--r-- | man/i3status.man | 8 | ||||
-rw-r--r-- | src/print_cpu_usage.c | 2 |
3 files changed, 11 insertions, 3 deletions
@@ -226,7 +226,7 @@ int main(int argc, char *argv[]) { CFG_STR("format", "%5min %10min %15min", CFGF_NONE), CFG_END() }; - + cfg_opt_t usage_opts[] = { CFG_STR("format", "%usage", CFGF_NONE), CFG_END() @@ -376,7 +376,7 @@ int main(int argc, char *argv[]) { CASE_SEC_TITLE("cpu_temperature") print_cpu_temperature_info(atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format")); - + CASE_SEC("cpu_usage") print_cpu_usage(cfg_getstr(sec, "format")); } diff --git a/man/i3status.man b/man/i3status.man index 7813229..786271e 100644 --- a/man/i3status.man +++ b/man/i3status.man @@ -200,6 +200,14 @@ Gets the temperature of the given thermal zone. *Example format*: +T: %degrees °C+ +=== CPU Usage + +Gets the percentual CPU usage from +/proc/stat+. + +*Example order*: +cpu_usage+ + +*Example format*: +%usage+ + === Load Gets the system load (number of processes waiting for CPU time in the last diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c index d80693d..d5913b0 100644 --- a/src/print_cpu_usage.c +++ b/src/print_cpu_usage.c @@ -14,7 +14,7 @@ static int prev_idle = 0; * percentage. * */ -void print_cpu_usage(const char *format) { +void print_cpu_usage(const char *format) { const char *walk; char buf[1024]; int curr_user, curr_nice, curr_system, curr_idle, curr_total; |