Applied, thanks!

On Tue, Mar 26, 2019 at 1:09 PM Thomas De Schampheleire
<[email protected]> wrote:
>
> From: Thomas De Schampheleire <[email protected]>
>
> In particular useful when you want to evaluate the threads in batch mode:
>     top -Hbn1
>
> Signed-off-by: Philippe Belet <[email protected]>
> Signed-off-by: Thomas De Schampheleire <[email protected]>
> ---
>  procps/top.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/procps/top.c b/procps/top.c
> index 625409755..59b0adf04 100644
> --- a/procps/top.c
> +++ b/procps/top.c
> @@ -223,7 +223,8 @@ enum {
>         OPT_n = (1 << 1),
>         OPT_b = (1 << 2),
>         OPT_m = (1 << 3),
> -       OPT_EOF = (1 << 4), /* pseudo: "we saw EOF in stdin" */
> +       OPT_H = (1 << 4),
> +       OPT_EOF = (1 << 5), /* pseudo: "we saw EOF in stdin" */
>  };
>  #define OPT_BATCH_MODE (option_mask32 & OPT_b)
>
> @@ -1076,6 +1077,9 @@ static unsigned handle_input(unsigned scan_mask, 
> duration_t interval)
>  //usage:       IF_FEATURE_TOPMEM(
>  //usage:   "\n""       -m      Same as 's' key"
>  //usage:       )
> +//usage:       IF_FEATURE_SHOW_THREADS(
> +//usage:   "\n""       -H      Show threads"
> +//usage:       )
>
>  /* Interactive testing:
>   * echo sss | ./busybox top
> @@ -1110,7 +1114,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
>
>         /* all args are options; -n NUM */
>         make_all_argv_opts(argv); /* options can be specified w/o dash */
> -       col = getopt32(argv, "d:n:b"IF_FEATURE_TOPMEM("m"), &str_interval, 
> &str_iterations);
> +       col = getopt32(argv, "d:n:b"IF_FEATURE_TOPMEM("m")"H", &str_interval, 
> &str_iterations);
>  #if ENABLE_FEATURE_TOPMEM
>         if (col & OPT_m) /* -m (busybox specific) */
>                 scan_mask = TOPMEM_MASK;
> @@ -1129,6 +1133,11 @@ int top_main(int argc UNUSED_PARAM, char **argv)
>                         str_iterations++;
>                 iterations = xatou(str_iterations);
>         }
> +#if ENABLE_FEATURE_SHOW_THREADS
> +       if (col & OPT_H) {
> +               scan_mask |= PSSCAN_TASKS;
> +       }
> +#endif
>
>         /* change to /proc */
>         xchdir("/proc");
> --
> 2.19.2
>
> _______________________________________________
> busybox mailing list
> [email protected]
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to