From 0b299f740d5161d1ff3a9b1d6987425062f18901 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 6 May 2011 13:17:26 +0200 Subject: [PATCH] Fix trailing whitespaces, document cpu_usage in manpage --- i3status.c | 4 ++-- man/i3status.man | 8 ++++++++ src/print_cpu_usage.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/i3status.c b/i3status.c index 542d270..ebef513 100644 --- a/i3status.c +++ b/i3status.c @@ -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;