[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: top -h doesn't display Thread Names
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2011-06-18 13:53:25
Message-ID: 201106181553.25159.vda.linux () googlemail ! com
[Download RAW message or body]

On Friday 17 June 2011 15:06, Daniel Ng wrote:
> Hi,
> 
> I've noticed a bug with busybox's 'top' command-
> 
> When the 'display threads' option is enabled with the '-h' parameter, the 
> individual thread names should be displayed in the 'COMMAND' column, in place 
> of arg0. 
> This is how the standard version of top behaves.
> 
> The current busybox code results in only arg0 being displayed. 
> Hence, for multiple threads spawned under the one process, only the process' 
> arg0 entry will show in the 'COMMAND' column for each thread. 
> The multiple threads would be displayed, but you can't easily tell which 
> thread is which because their displayed COMMAND is the same arg0.
> 
> ie.-
> 
> Say you have an executable called 'myProgram' that spawns 4 threads.
> 
> The current incorrect behaviour of 'top':
> 
> COMMAND
> myProgram
> myProgram
> myProgram
> myProgram
> 
> vs. what it should be:
> 
> COMMAND
> myThread1
> myThread2
> myThread3
> myThread4
> 
> The root cause is that read_cmdline() is used to display the COMMAND column, 
> regardless of whether the '-h' option is set.
> 
> Unfortunately, read_cmdline() is called by display_process_list(). This 
> function doesn't know if the '-h' option was set.
> 
> The only solution I can think of is to change the parameters of 
> display_process_list() so that it knows if '-h' was set.
> 
> However, this feels like a bit of a hack, just to deal with this special case.
> 
> Can anyone suggest a better soultion?

Fixed in git:

http://git.busybox.net/busybox/commit/?id=5331e382f72a606c026424e95fcc7dc50a25608c

Please let me know if this doesn't solve your problem.
-- 
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic