Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: WCPU column in top giving inf% and lots of nan%



On Friday 2008-07-18 18:55 +1000, Geoff Wing output:
:Running top (built after the directory move) gives me lots of bad data in
:the WCPU column on i386.  Anyone else?  Something wonky happen with the
:import in the new directory?

Coredumps also.  It's somehow weirdly dependent on the width of the
terminal.  137->140 and 149->152 segv but 160 wide gives me inf% and nan%

Compiling without optimisation or moving the "static char fmt[128]"
lines in m_netbsd.c or expanding the buffer (it only should use 80
chars) makes it play nicely.

This patch makes the main process display and the thread display share a
common passback area (and conveniently hides the real bug).

Regards,
Geoff

--- external/bsd/top/dist/machine/m_netbsd.c.org        2008-07-22 
10:08:21.000000000 +1000
+++ external/bsd/top/dist/machine/m_netbsd.c    2008-07-22 12:18:15.000000000 
+1000
@@ -759,6 +759,7 @@
                return format_next_proc(handle, get_userid);
 }
 
+static char fmt[128];          /* static area where result is built */
 
 char *
 format_next_proc(caddr_t handle, char *(*get_userid)(int))
@@ -772,7 +773,6 @@
        char state[10];
 #endif
        char wmesg[KI_WMESGLEN + 1];
-       static char fmt[128];           /* static area where result is built */
        char *pretty = "";
 
        /* find and remember the next proc structure */
@@ -865,7 +865,6 @@
        char state[10];
 #endif
        char wmesg[KI_WMESGLEN + 1];
-       static char fmt[128];           /* static area where result is built */
        char *pretty = "";
        char *comm;
        int uid;


Home | Main Index | Thread Index | Old Index