Re: svn commit: r334864 - head/usr.bin/top

2018-06-09 Thread Eitan Adler
On 9 June 2018 at 16:13, Eitan Adler  wrote:
> On 9 June 2018 at 08:55, Eitan Adler  wrote:
>
 Another issue I just found is that if you start top with -P some columns
 don't show any values:
>
> Thanks to "git bisect" I've narrowed this down to r334822. Patch coming soon.

Fixed in r334903.



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r334864 - head/usr.bin/top

2018-06-09 Thread Eitan Adler
On 9 June 2018 at 08:55, Eitan Adler  wrote:

>>> Another issue I just found is that if you start top with -P some columns
>>> don't show any values:

Thanks to "git bisect" I've narrowed this down to r334822. Patch coming soon.




-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r334864 - head/usr.bin/top

2018-06-09 Thread Eitan Adler
On 8 June 2018 at 23:13, Florian Smeets  wrote:
> On 09.06.18 04:14, Eitan Adler wrote:
>> Author: eadler
>> Date: Sat Jun  9 02:14:33 2018
>> New Revision: 334864
>> URL: https://svnweb.freebsd.org/changeset/base/334864
>>
>> Log:
>>   top(1): use a different command to toggle tid vs pid
>
> Thank you.
>
> You cannot start top with -T unless you add something like the following:

I have a patch out for this, but svn is having issues right now (or at
least I am).

> Another issue I just found is that if you start top with -P some columns
> don't show any values:

>
> It is correct if you start top with -TP or -HP, or if you start top -P
> and then use H or T to switch back and forth. I'm not sure in which
> revision this was broken, it works with r333899.

I'm guessing this is because I forgot to initalize "prehead"
somewhere. I'd like to rewrite the entire header creation, but will
try and fix this. Thanks for the report!




-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r334864 - head/usr.bin/top

2018-06-09 Thread Eitan Adler
On 9 June 2018 at 08:54, Eitan Adler  wrote:
> On 8 June 2018 at 23:13, Florian Smeets  wrote:
>> On 09.06.18 04:14, Eitan Adler wrote:
>>> Author: eadler
>>> Date: Sat Jun  9 02:14:33 2018
>>> New Revision: 334864
>>> URL: https://svnweb.freebsd.org/changeset/base/334864
>>>
>>> Log:
>>>   top(1): use a different command to toggle tid vs pid
>>
>> Thank you.
>>
>> You cannot start top with -T unless you add something like the following:
>
> I have a patch out for this, but svn is having issues right now (or at
> least I am).
>
>> Another issue I just found is that if you start top with -P some columns
>> don't show any values:
>
>>
>> It is correct if you start top with -TP or -HP, or if you start top -P
>> and then use H or T to switch back and forth. I'm not sure in which
>> revision this was broken, it works with r333899.
>
> I'm guessing this is because I forgot to initalize "prehead"
> somewhere. I'd like to rewrite the entire header creation, but will
> try and fix this. Thanks for the report!

By header, I meant header and data format string :)


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r334864 - head/usr.bin/top

2018-06-09 Thread Florian Smeets via svn-src-head
On 09.06.18 04:14, Eitan Adler wrote:
> Author: eadler
> Date: Sat Jun  9 02:14:33 2018
> New Revision: 334864
> URL: https://svnweb.freebsd.org/changeset/base/334864
> 
> Log:
>   top(1): use a different command to toggle tid vs pid

Thank you.

You cannot start top with -T unless you add something like the following:

Index: top.c
===
--- top.c   (revision 334874)
+++ top.c   (working copy)
@@ -328,7 +328,7 @@
optind = 1;
}

-   while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:p:tw")) != EOF)
+   while ((i = getopt(ac, av, "CSIHPTabijJ:nquvzs:d:U:m:o:p:tw")) != EOF)
{
switch(i)
{

Another issue I just found is that if you start top with -P some columns
don't show any values:

CPU 0:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 1:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 2: % user, % nice,  1.2% system, % interrupt, 98.8% idle
CPU 3:  0.4% user, % nice,  0.4% system, % interrupt, 99.2% idle
CPU 4: % user, % nice,  0.4% system, % interrupt, 99.6% idle
CPU 5: % user, % nice,  2.4% system, % interrupt, 97.6% idle
CPU 6: % user, % nice,  0.4% system, % interrupt, 99.6% idle
CPU 7: % user, % nice,  2.4% system, % interrupt, 97.6% idle

It is correct if you start top with -TP or -HP, or if you start top -P
and then use H or T to switch back and forth. I'm not sure in which
revision this was broken, it works with r333899.

Florian



signature.asc
Description: OpenPGP digital signature


svn commit: r334864 - head/usr.bin/top

2018-06-08 Thread Eitan Adler
Author: eadler
Date: Sat Jun  9 02:14:33 2018
New Revision: 334864
URL: https://svnweb.freebsd.org/changeset/base/334864

Log:
  top(1): use a different command to toggle tid vs pid
  
  - By popular demand, implement a different switch ("T") for toggling
  between thread id and process id.
  - Add an assert that the size of command chars is as expected.
  - Also clean up some messiness I found when implementing this.
  - Further document the new flag.
  
  Requested by: flo, ronald-li...@klop.ws, bapt
  PR:   139389 (for the record)
  X-MFC-With:   r334474

Modified:
  head/usr.bin/top/commands.c
  head/usr.bin/top/machine.c
  head/usr.bin/top/machine.h
  head/usr.bin/top/top.1
  head/usr.bin/top/top.c
  head/usr.bin/top/top.h

Modified: head/usr.bin/top/commands.c
==
--- head/usr.bin/top/commands.c Fri Jun  8 22:06:32 2018(r334863)
+++ head/usr.bin/top/commands.c Sat Jun  9 02:14:33 2018(r334864)
@@ -99,6 +99,7 @@ r   - renice a process\n\
 s   - change number of seconds to delay between updates\n\
 S   - toggle the displaying of system processes\n\
 a   - toggle the displaying of process titles\n\
+T   - toggle the displaying of thread IDs\n\
 t   - toggle the display of this process\n\
 u   - display processes for only one user (+ selects all users)\n\
 w   - toggle the display of swap use for each process\n\

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Fri Jun  8 22:06:32 2018(r334863)
+++ head/usr.bin/top/machine.c  Sat Jun  9 02:14:33 2018(r334864)
@@ -433,8 +433,8 @@ format_header(const char *uname_field)
 * separate lines).
 */
prehead = smpmode ?
-   (ps.thread ? smp_header_tid_only : smp_header_thr_and_pid) :
-   (ps.thread ? up_header_tid_only : up_header_thr_and_pid);
+   (ps.thread_id ? smp_header_tid_only : 
smp_header_thr_and_pid) :
+   (ps.thread_id ? up_header_tid_only : up_header_thr_and_pid);
snprintf(Header, sizeof(Header), prehead,
jidlength, ps.jail ? " JID" : "",
namelength, namelength, uname_field,
@@ -828,7 +828,7 @@ get_process_info(struct system_info *si, struct proces
/* not in use */
continue;
 
-   if (sel->self != -1 && pp->ki_pid == sel->self)
+   if (!sel->self && pp->ki_pid == mypid)
/* skip self */
continue;
 

Modified: head/usr.bin/top/machine.h
==
--- head/usr.bin/top/machine.h  Fri Jun  8 22:06:32 2018(r334863)
+++ head/usr.bin/top/machine.h  Sat Jun  9 02:14:33 2018(r334864)
@@ -58,25 +58,26 @@ struct system_info
  */
 
 /*
- * the process_select struct tells get_process_info what processes we
- * are interested in seeing
+ * the process_select struct tells get_process_info what processes
+ * and information we are interested in seeing
  */
 
 struct process_select
 {
-int idle;  /* show idle processes */
-int self;  /* show self */
-int system;/* show system processes */
-int thread;/* show threads */
+bool idle; /* show idle processes */
+bool self; /* show self */
+bool system;   /* show system processes */
+bool thread;   /* show threads */
+bool thread_id;/* show thread ids */
 #define TOP_MAX_UIDS 8
 int uid[TOP_MAX_UIDS]; /* only these uids (unless uid[0] == -1) */
-int wcpu;  /* show weighted cpu */
+bool wcpu; /* show weighted cpu */
 int jid;   /* only this jid (unless jid == -1) */
-int jail;  /* show jail ID */
-int swap;  /* show swap usage */
-int kidle; /* show per-CPU idle threads */
-pid_t pid; /* only this pid (unless pid == -1) */
-char *command; /* only this command (unless == NULL) */
+bool jail; /* show jail ID */
+bool swap; /* show swap usage */
+bool kidle;/* show per-CPU idle threads */
+int pid;   /* only this pid (unless pid == -1) */
+const char *command;   /* only this command (unless == NULL) */
 };
 
 /* routines defined by the machine dependent module */

Modified: head/usr.bin/top/top.1
==
--- head/usr.bin/top/top.1  Fri Jun  8 22:06:32 2018(r334863)
+++ head/usr.bin/top/top.1  Sat Jun  9 02:14:33 2018(r334864)
@@ -116,6 +116,9 @@ Display the
 .IR jail (8)
 ID.
 .TP
+.B \-T
+Toggle displaying thread ID (tid) instead of