From nobody@FreeBSD.org  Mon Jul 11 23:17:51 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F1294106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 11 Jul 2011 23:17:51 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id E1ECA8FC16
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 11 Jul 2011 23:17:51 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p6BNHpqn092273
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 11 Jul 2011 23:17:51 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p6BNHpJ4092272;
	Mon, 11 Jul 2011 23:17:51 GMT
	(envelope-from nobody)
Message-Id: <201107112317.p6BNHpJ4092272@red.freebsd.org>
Date: Mon, 11 Jul 2011 23:17:51 GMT
From: Alexander Best <arundel@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] improve top(1)'s message for the interactive 'C' option
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         158819
>Category:       bin
>Synopsis:       [patch] improve top(1)'s message for the interactive 'C' option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jhb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 11 23:20:08 UTC 2011
>Closed-Date:    Mon Jul 18 21:19:50 UTC 2011
>Last-Modified:  Mon Jul 18 21:19:50 UTC 2011
>Originator:     Alexander Best
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #23 r223911=11f0313-dirty: Mon Jul 11 00:20:49 CEST 2011     arundel@otaku:/usr/obj/usr/git-freebsd-head/sys/ARUNDEL  amd64
>Description:
when switching between weighted and raw cpu mode via the interactive 'C' key, top only displays the following messsage:

"Displaying CPU" or "Displaying WCPU"

that's not really a grand description, is it? the attached patch improves the message imho.
>How-To-Repeat:
apply the attached patch!
>Fix:


Patch attached with submission follows:

diff --git a/contrib/top/top.c b/contrib/top/top.c
index 4e4d86d..01c5946 100644
--- a/contrib/top/top.c
+++ b/contrib/top/top.c
@@ -1029,8 +1029,8 @@ restart:
 			    case CMD_wcputog:
 				ps.wcpu = !ps.wcpu;
 				new_message(MT_standout | MT_delayed,
-				    " Displaying %sCPU",
-				    ps.wcpu ? "W" : "");
+				    " Displaying %s CPU usage.",
+				    ps.wcpu ? "weighted" : "raw");
 				header_text = format_header(uname_field);
 				reset_display();
 				putchar('\r');


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jhb 
Responsible-Changed-By: arundel 
Responsible-Changed-When: Mon Jul 11 23:45:28 UTC 2011 
Responsible-Changed-Why:  
Hi John, 

do you think this is a reasonable change request? If not, please feel free to 
close this PR. 

Cheers. 
Alex 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158819 

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/158819: [patch] improve top(1)'s message for the interactive 'C' option
Date: Tue, 12 Jul 2011 19:37:44 +0000

 bruce evans recommended in a private message to me that interactive commands
 which have an obvious impact (e.g. by only changing one column), should not
 trigger any message. in his opinion that would only distract the user, since
 the changes to the top output are obvious already.
 
 interactive commands which fall under that category are 'H', 'j' and 'C'.
 
 personally i don't feel distracted by these messages at all. if i hit the C
 key and "CPU" changes to "WCPU" with a message such as in the patch i attached
 in this problem report, i feel much better informed.
 
 for users not knowing what the difference between "CPU" and "WCPU" is, the
 message would pose a hint and they don't need to query the man page to find
 out what "WCPU" actually stands for.
 
 just my 0.02$ though.
 
 cheers.
 alex

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/158819: [patch] improve top(1)'s message for the interactive 'C' option
Date: Sat, 16 Jul 2011 07:28:49 +0000

 ...also the "." behind "usage" should be removed, since it's a K&R style bug,
 as noted by bruce evans. actually a few other messages already implemented in
 top feature this style bug, too ('z' or 'i/I' e.g.).
 
 cheers.
 alex

From: John Baldwin <jhb@freebsd.org>
To: bug-followup@freebsd.org,
 arundel@freebsd.org
Cc:  
Subject: Re: bin/158819: [patch] improve top(1)'s message for the interactive 'C' option
Date: Mon, 18 Jul 2011 12:09:09 -0400

 I mostly agree with Bruce about not needing messages for obvious changes.  
 That is why the initial patch to add 'P' did not include a message.
 
 However, in this case, this is merely tweaking a message.  While I think the 
 manpage is sufficient, this change doesn't really hurt either.
 
 -- 
 John Baldwin

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/158819: commit references a PR
Date: Mon, 18 Jul 2011 21:08:32 +0000 (UTC)

 Author: jhb
 Date: Mon Jul 18 21:08:14 2011
 New Revision: 224204
 URL: http://svn.freebsd.org/changeset/base/224204
 
 Log:
   Tweak the interactive description of CPU vs WCPU.
   
   PR:		bin/158819
   Submitted by:	arundel
   Approved by:	re (kib)
 
 Modified:
   head/contrib/top/top.c
 
 Modified: head/contrib/top/top.c
 ==============================================================================
 --- head/contrib/top/top.c	Mon Jul 18 21:04:35 2011	(r224203)
 +++ head/contrib/top/top.c	Mon Jul 18 21:08:14 2011	(r224204)
 @@ -1029,8 +1029,8 @@ restart:
  			    case CMD_wcputog:
  				ps.wcpu = !ps.wcpu;
  				new_message(MT_standout | MT_delayed,
 -				    " Displaying %sCPU",
 -				    ps.wcpu ? "W" : "");
 +				    " Displaying %s CPU",
 +				    ps.wcpu ? "weighted" : "raw");
  				header_text = format_header(uname_field);
  				reset_display();
  				putchar('\r');
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: jhb 
State-Changed-When: Mon Jul 18 21:19:38 UTC 2011 
State-Changed-Why:  
Patch committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158819 
>Unformatted:
