aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-12-13 15:17:22 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2010-12-13 15:17:22 +0100
commita6041860f878142e91be7889a26742e25f323c8f (patch)
treea0d3565adcf8857c36a34b4b6da16e9a666aebbf /procps
parentda6fb7e33100e5135e3e898dd157e6c729b34d7c (diff)
downloadbusybox-w32-a6041860f878142e91be7889a26742e25f323c8f.tar.gz
busybox-w32-a6041860f878142e91be7889a26742e25f323c8f.tar.bz2
busybox-w32-a6041860f878142e91be7889a26742e25f323c8f.zip
nmeter: deprecate %NNNd specified, use -d MSEC instead
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/Config.src6
-rw-r--r--procps/Kbuild.src1
-rw-r--r--procps/nmeter.c50
3 files changed, 45 insertions, 12 deletions
diff --git a/procps/Config.src b/procps/Config.src
index 338d75c34..cf664eeb2 100644
--- a/procps/Config.src
+++ b/procps/Config.src
@@ -46,12 +46,6 @@ config KILLALL5
46 default y 46 default y
47 depends on KILL 47 depends on KILL
48 48
49config NMETER
50 bool "nmeter"
51 default y
52 help
53 Prints selected system stats continuously, one line per update.
54
55config PGREP 49config PGREP
56 bool "pgrep" 50 bool "pgrep"
57 default y 51 default y
diff --git a/procps/Kbuild.src b/procps/Kbuild.src
index 791d65670..89b1cc094 100644
--- a/procps/Kbuild.src
+++ b/procps/Kbuild.src
@@ -11,7 +11,6 @@ lib-$(CONFIG_FREE) += free.o
11lib-$(CONFIG_FUSER) += fuser.o 11lib-$(CONFIG_FUSER) += fuser.o
12lib-$(CONFIG_KILL) += kill.o 12lib-$(CONFIG_KILL) += kill.o
13lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash 13lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash
14lib-$(CONFIG_NMETER) += nmeter.o
15lib-$(CONFIG_PGREP) += pgrep.o 14lib-$(CONFIG_PGREP) += pgrep.o
16lib-$(CONFIG_PKILL) += pgrep.o 15lib-$(CONFIG_PKILL) += pgrep.o
17lib-$(CONFIG_PIDOF) += pidof.o 16lib-$(CONFIG_PIDOF) += pidof.o
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 7836a90d5..ac019eb53 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -6,6 +6,40 @@
6 * Contact me: vda.linux@googlemail.com 6 * Contact me: vda.linux@googlemail.com
7 */ 7 */
8 8
9//config:config NMETER
10//config: bool "nmeter"
11//config: default y
12//config: help
13//config: Prints selected system stats continuously, one line per update.
14
15//applet:IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP))
16
17//kbuild:lib-$(CONFIG_NMETER) += nmeter.o
18
19//usage:#define nmeter_trivial_usage
20//usage: "[-d MSEC] FORMAT_STRING"
21//usage:#define nmeter_full_usage "\n\n"
22//usage: "Monitor system in real time"
23//usage: "\n"
24//usage: "\n -d MSEC Milliseconds between updates (default:1000)"
25//usage: "\n"
26//usage: "\nFormat specifiers:"
27//usage: "\n %Nc or %[cN] Monitor CPU. N - bar size (default:10)"
28//usage: "\n (displays: S:system U:user N:niced D:iowait I:irq i:softirq)"
29//usage: "\n %[niface] Monitor network interface 'iface'"
30//usage: "\n %m Monitor allocated memory"
31//usage: "\n %[mf] Monitor free memory"
32//usage: "\n %[mt] Monitor total memory"
33//usage: "\n %s Monitor allocated swap"
34//usage: "\n %f Monitor number of used file descriptors"
35//usage: "\n %Ni Monitor total/specific IRQ rate"
36//usage: "\n %x Monitor context switch rate"
37//usage: "\n %p Monitor forks"
38//usage: "\n %[pn] Monitor # of processes"
39//usage: "\n %b Monitor block io"
40//usage: "\n %Nt Show time (with N decimal points)"
41//usage: "\n %r Print <cr> instead of <lf> at EOL"
42
9//TODO: 43//TODO:
10// simplify code 44// simplify code
11// /proc/locks 45// /proc/locks
@@ -769,6 +803,7 @@ static void FAST_FUNC collect_info(s_stat *s)
769 803
770typedef s_stat* init_func(const char *param); 804typedef s_stat* init_func(const char *param);
771 805
806// Deprecated %NNNd is to be removed, -d MSEC supersedes it
772static const char options[] ALIGN1 = "ncmsfixptbdr"; 807static const char options[] ALIGN1 = "ncmsfixptbdr";
773static init_func *const init_functions[] = { 808static init_func *const init_functions[] = {
774 init_if, 809 init_if,
@@ -792,23 +827,28 @@ int nmeter_main(int argc UNUSED_PARAM, char **argv)
792 s_stat *first = NULL; 827 s_stat *first = NULL;
793 s_stat *last = NULL; 828 s_stat *last = NULL;
794 s_stat *s; 829 s_stat *s;
830 char *opt_d;
795 char *cur, *prev; 831 char *cur, *prev;
796 832
797 INIT_G(); 833 INIT_G();
798 834
799 xchdir("/proc"); 835 xchdir("/proc");
800 836
801 if (!argv[1])
802 bb_show_usage();
803
804 if (open_read_close("version", buf, sizeof(buf)-1) > 0) { 837 if (open_read_close("version", buf, sizeof(buf)-1) > 0) {
805 buf[sizeof(buf)-1] = '\0'; 838 buf[sizeof(buf)-1] = '\0';
806 is26 = (strstr(buf, " 2.4.") == NULL); 839 is26 = (strstr(buf, " 2.4.") == NULL);
807 } 840 }
808 841
809 // Can use argv[1] directly, but this will mess up 842 if (getopt32(argv, "d:", &opt_d))
843 init_delay(opt_d);
844 argv += optind;
845
846 if (!argv[0])
847 bb_show_usage();
848
849 // Can use argv[0] directly, but this will mess up
810 // parameters as seen by e.g. ps. Making a copy... 850 // parameters as seen by e.g. ps. Making a copy...
811 cur = xstrdup(argv[1]); 851 cur = xstrdup(argv[0]);
812 while (1) { 852 while (1) {
813 char *param, *p; 853 char *param, *p;
814 prev = cur; 854 prev = cur;