*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config MPSTAT
+//config: bool "mpstat (10 kb)"
+//config: default y
+//config: help
+//config: Per-processor statistics
//applet:IF_MPSTAT(APPLET(mpstat, BB_DIR_BIN, BB_SUID_DROP))
+/* shouldn't be noexec: "mpstat INTERVAL" runs indefinitely */
//kbuild:lib-$(CONFIG_MPSTAT) += mpstat.o
-//config:config MPSTAT
-//config: bool "mpstat"
-//config: default y
-//config: help
-//config: Per-processor statistics
-
#include "libbb.h"
#include <sys/utsname.h> /* struct utsname */
while (fgets(buf, sizeof(buf), fp)) {
//bb_error_msg("/proc/stat:'%s'", buf);
- if (strncmp(buf, "intr ", 5) == 0) {
+ if (is_prefixed_with(buf, "intr ")) {
/* Read total number of IRQs since system boot */
sscanf(buf + 5, "%"FMT_DATA"u", &irq->irq_nr);
}
//usage: "\n -u Report CPU utilization"
int mpstat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int mpstat_main(int UNUSED_PARAM argc, char **argv)
+int mpstat_main(int argc UNUSED_PARAM, char **argv)
{
char *opt_irq_fmt;
char *opt_set_cpu;