From owner-freebsd-current@FreeBSD.ORG Tue Oct 21 16:45:47 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6047D106566C for ; Tue, 21 Oct 2008 16:45:47 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from el-out-1112.google.com (el-out-1112.google.com [209.85.162.181]) by mx1.freebsd.org (Postfix) with ESMTP id 117AA8FC2E for ; Tue, 21 Oct 2008 16:45:46 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by el-out-1112.google.com with SMTP id v27so576419ele.13 for ; Tue, 21 Oct 2008 09:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=0UKE5bzTTq6dN+KcQUMXGuAZD3FxBrgx/OxMR3wNwKU=; b=pmXa/pnsm4agMNFQ4TDsL/0ytAXdFo2qAJqDAvm3mCF6ZGDSivmBFudBgLwronpnU3 tg4aqXqlAvKxScU81Bg2QIMehBRSFvK/1QXh5uFh26BzVAhGJ3v7VoI6ceZSgHZ9TW2x mC48/9CKOrhvsXyJh9bNf1NxwJHfJraMtpvtA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=SpnYg0avCWSuYhYBfOZD7CgH6NhLzVWiXLh0yr3lhlA+UlO3/Sg3UlnHxFdrcELnna +66jY7ka6DXO0o8s8gCgi75oJr8DfZ4NEuEYhKg7sSi4dS2TCnRghDnKX6p9tElX5T59 u4kfShvabjAodPuk54DZKOYwsfYCzGgQbakUY= Received: by 10.90.68.12 with SMTP id q12mr2317893aga.30.1224607546195; Tue, 21 Oct 2008 09:45:46 -0700 (PDT) Received: by 10.90.81.10 with HTTP; Tue, 21 Oct 2008 09:45:46 -0700 (PDT) Message-ID: Date: Tue, 21 Oct 2008 20:45:46 +0400 From: pluknet To: "Edwin Groothuis" In-Reply-To: <20080928054620.GA80250@k7.mavetju> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080928054620.GA80250@k7.mavetju> Cc: stable@freebsd.org, current@freebsd.org Subject: Re: Request for testing - top 3.8b1 in the base system X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2008 16:45:47 -0000 2008/9/28 Edwin Groothuis : > 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) @@ -567,7 +567,8 @@ 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); @@ -601,7 +602,8 @@ 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) @@ -1042,6 +1042,7 @@ } static int ltotal = 0; +static int lactive = 0; static int lthreads = 0; /* @@ -1050,13 +1051,14 @@ 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; @@ -1073,24 +1075,24 @@ } 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; @@ -1098,6 +1100,7 @@ /* 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) @@ -49,8 +49,8 @@ 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, pluknet