2008/9/28 Edwin Groothuis <edwin_at_freebsd.org>: > I have made an update for the top(1) utility in the FreeBSD base > system to get it from the 3.5b12 version to the 3.8b1 version. > > I have tried them on the amd64 architecture on FreeBSD -current and > FreeBSD 7.0 and on the i386 architecture on FreeBSD 7.0. > > The big new features are a line upper part with kernel statistics > (context-switches, traps, interrupts, faults etc) and the FLG table > (if you window is big enough) > > Some features specific to FreeBSD (dual display (press m)), threaded > processes, and jails have been ported to 3.8b1. > > The biggest fix (AFAICT) is the TIME and CPU table for threaded > processes, which are now calculated properly. > > The new code can be found on > http://www.mavetju.org/~edwin/freebsd-top-3.8b1-A.tar.gz > Go to 3.8b1/usr.sbin/top and run "make" there to produce the binary, > then run it via "./top". > > Please report any issues with it (compile time, run time) and a way > to reproduce it (if possible). Thanks for your help! > > Edwin btw, on my 6.2 it never changes 'Processes' count on 'S' press and always shows all(+system ) procs (as if it in 'S' mode). Base top does it. That is because 3.81 top has different semantics between active procs and total ones. 'Processes' count displays active procs (+ threads in 'H' mode). My small patch represents this. The first number displays actually displayed procs(and threads) and the second one displays all procs(and threads) in system. Index: top/freebsd-top-3.8b1-A/contrib/top/top.c =================================================================== --- top/freebsd-top-3.8b1-A/contrib/top/top.c (revision 5702) +++ top/freebsd-top-3.8b1-A/contrib/top/top.c (working copy) _at__at_ -567,7 +567,8 _at__at_ i_loadave(system_info.last_pid, system_info.load_avg); i_uptime(&(gstate->statics->boottime), &curr_time); i_timeofday(&curr_time); - i_procstates(system_info.p_total, system_info.procstates, gstate->pselect.threads); + i_procstates(system_info.p_total, system_info.p_active, + system_info.procstates, gstate->pselect.threads); if (gstate->show_cpustates) { i_cpustates(system_info.cpustates); _at__at_ -601,7 +602,8 _at__at_ u_loadave(system_info.last_pid, system_info.load_avg); i_timeofday(&curr_time); u_uptime(&(gstate->statics->boottime), &curr_time); - u_procstates(system_info.p_total, system_info.procstates, gstate->pselect.threads); + u_procstates(system_info.p_total, system_info.p_active, + system_info.procstates, gstate->pselect.threads); u_cpustates(system_info.cpustates); u_kernel(system_info.kernel); u_memory(system_info.memory); Index: top/freebsd-top-3.8b1-A/contrib/top/display.c =================================================================== --- top/freebsd-top-3.8b1-A/contrib/top/display.c (revision 5702) +++ top/freebsd-top-3.8b1-A/contrib/top/display.c (working copy) _at__at_ -1042,6 +1042,7 _at__at_ } static int ltotal = 0; +static int lactive = 0; static int lthreads = 0; /* _at__at_ -1050,13 +1051,14 _at__at_ void -i_procstates(int total, int *brkdn, int threads) +i_procstates(int total, int active, int *brkdn, int threads) { /* write current number of processes and remember the value */ display_fmt(0, y_procstate, 0, 0, - "%d %s: ", total, threads ? "threads" : "processes"); + "%d/%d %s: ", active, total, threads ? "threads" : "processes"); ltotal = total; + lactive = active; /* remember where the summary starts */ x_procstate = virt_x; _at__at_ -1073,24 +1075,24 _at__at_ } void -u_procstates(int total, int *brkdn, int threads) +u_procstates(int total, int active, int *brkdn, int threads) { /* if threads state has changed, do a full update */ if (lthreads != threads) { - i_procstates(total, brkdn, threads); + i_procstates(total, active, brkdn, threads); return; } /* update number of processes only if it has changed */ - if (ltotal != total) + if (ltotal != total || lactive != active) { display_fmt(0, y_procstate, 0, 0, - "%d", total); + "%d/%d", active, total); /* if number of digits differs, rewrite the label */ - if (digits(total) != digits(ltotal)) + if (digits(total) != digits(ltotal) || digits(active) != digits(lactive)) { display_fmt(-1, -1, 0, 0, " %s: ", threads ? "threads" : "processes"); x_procstate = virt_x; _at__at_ -1098,6 +1100,7 _at__at_ /* save new total */ ltotal = total; + lactive = active; } /* see if any of the state numbers has changed */ Index: top/freebsd-top-3.8b1-A/contrib/top/display.h =================================================================== --- top/freebsd-top-3.8b1-A/contrib/top/display.h (revision 5702) +++ top/freebsd-top-3.8b1-A/contrib/top/display.h (working copy) _at__at_ -49,8 +49,8 _at__at_ void i_uptime(time_t *bt, time_t *tod); void u_uptime(time_t *bt, time_t *tod); void i_timeofday(time_t *tod); -void i_procstates(int total, int *brkdn, int threads); -void u_procstates(int total, int *brkdn, int threads); +void i_procstates(int total, int active, int *brkdn, int threads); +void u_procstates(int total, int active, int *brkdn, int threads); void i_cpustates(int *states); void u_cpustates(int *states); void z_cpustates(); -- wbr, pluknetReceived on Tue Oct 21 2008 - 14:45:47 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:36 UTC