diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-04 12:50:59 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-04 12:50:59 +0100 |
commit | 917693b5b3d1ece0ade489bc4d922bfa368b979e (patch) | |
tree | fe26173703160dc3e50ec2d4f027ce9c0db3e01c /procps | |
parent | 197202d435bcb3df7268c8fbb66c05ff78e645ac (diff) | |
download | busybox-w32-917693b5b3d1ece0ade489bc4d922bfa368b979e.tar.gz busybox-w32-917693b5b3d1ece0ade489bc4d922bfa368b979e.tar.bz2 busybox-w32-917693b5b3d1ece0ade489bc4d922bfa368b979e.zip |
top: make 's' display easier to understand
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r-- | procps/top.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/procps/top.c b/procps/top.c index d76d9af78..f5c0a123f 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -696,12 +696,12 @@ static int topmem_sort(char *a, char *b) | |||
696 | return inverted ? -n : n; | 696 | return inverted ? -n : n; |
697 | } | 697 | } |
698 | 698 | ||
699 | /* Cut "NNNN " out of " NNNN kb" */ | 699 | /* Cut "NNNN" out of " NNNN kb" */ |
700 | static char *grab_number(char *str, const char *match, unsigned sz) | 700 | static char *grab_number(char *str, const char *match, unsigned sz) |
701 | { | 701 | { |
702 | if (strncmp(str, match, sz) == 0) { | 702 | if (strncmp(str, match, sz) == 0) { |
703 | str = skip_whitespace(str + sz); | 703 | str = skip_whitespace(str + sz); |
704 | (skip_non_whitespace(str))[1] = '\0'; | 704 | (skip_non_whitespace(str))[0] = '\0'; |
705 | return xstrdup(str); | 705 | return xstrdup(str); |
706 | } | 706 | } |
707 | return NULL; | 707 | return NULL; |
@@ -768,19 +768,19 @@ static void display_topmem_header(int scr_width, int *lines_rem_p) | |||
768 | } | 768 | } |
769 | fclose(fp); | 769 | fclose(fp); |
770 | 770 | ||
771 | #define S(s) (s ? s : "0 ") | 771 | #define S(s) (s ? s : "0") |
772 | snprintf(linebuf, sizeof(linebuf), | 772 | snprintf(linebuf, sizeof(linebuf), |
773 | "Mem %stotal %sanon %smap %sfree", | 773 | "Mem total:%s anon:%s map:%s free:%s", |
774 | S(total), S(anon), S(map), S(mfree)); | 774 | S(total), S(anon), S(map), S(mfree)); |
775 | printf(OPT_BATCH_MODE ? "%.*s\n" : "\e[H\e[J%.*s\n", scr_width, linebuf); | 775 | printf(OPT_BATCH_MODE ? "%.*s\n" : "\e[H\e[J%.*s\n", scr_width, linebuf); |
776 | 776 | ||
777 | snprintf(linebuf, sizeof(linebuf), | 777 | snprintf(linebuf, sizeof(linebuf), |
778 | " %sslab %sbuf %scache %sdirty %swrite", | 778 | " slab:%s buf:%s cache:%s dirty:%s write:%s", |
779 | S(slab), S(buf), S(cache), S(dirty), S(mwrite)); | 779 | S(slab), S(buf), S(cache), S(dirty), S(mwrite)); |
780 | printf("%.*s\n", scr_width, linebuf); | 780 | printf("%.*s\n", scr_width, linebuf); |
781 | 781 | ||
782 | snprintf(linebuf, sizeof(linebuf), | 782 | snprintf(linebuf, sizeof(linebuf), |
783 | "Swap %stotal %sfree", // TODO: % used? | 783 | "Swap total:%s free:%s", // TODO: % used? |
784 | S(swaptotal), S(swapfree)); | 784 | S(swaptotal), S(swapfree)); |
785 | printf("%.*s\n", scr_width, linebuf); | 785 | printf("%.*s\n", scr_width, linebuf); |
786 | 786 | ||