Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Aug 2001 10:50:02 -0700 (PDT)
From:      Jonathan Chen <jon@FreeBSD.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/28367: top -d 1 will not show proper information concerning cpu states, nor will -d1
Message-ID:  <200108021750.f72Ho2E73277@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

The following reply was made to PR bin/28367; it has been noted by GNATS.

From: Jonathan Chen <jon@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, tspivey8@home.com
Cc:  
Subject: Re: bin/28367: top -d 1 will not show proper information concerning cpu states, nor will -d1
Date: Thu, 2 Aug 2001 13:49:14 -0400

 Unfortunately, due to the way top obtains the cpu statistics, fixing 
 top -d1 properly is a nontrivial task.  These cpu statistics are obtained 
 by reading some numbers twice and taking the differences.  Of course, if 
 you wish top -d1 to return immediately, you cannot get the cpu statistics.  
 You may wish to run top -d2 and ignore the first output.  Alternatively, 
 the following patch is a quick workaround to the problem if you must use 
 -d1.  This will not be integrated into FreeBSD, but you may wish to apply 
 it to your local source tree to get a "fixed" top.
 
 Top is a "contributed" software in FreeBSD.  This means that top is 
 maintained by someone outside of the FreeBSD community.  You may have 
 better response by directing further inquiries about top to its author:
 William LeFebvre <wnl@groupsys.com>  Of course, any FreeBSD specific 
 problems should still be submitted to us.
 
 Thank you for your interest in FreeBSD.
 
 -Jon
 
 [Patch included below]
 
 diff -u -r1.6 top.c
 --- contrib/top/top.c	2000/11/03 22:00:10	1.6
 +++ contrib/top/top.c	2001/08/02 17:34:11
 @@ -529,6 +529,12 @@
       *		indicates infinity (by being -1)
       */
  
 +    if (displays == 1) {
 +	get_system_info(&system_info);
 +	usleep(100000);
 +	dostates = Yes
 +    }
 +
      while ((displays == -1) || (displays-- > 0))
      {
  	/* get the current stats */

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108021750.f72Ho2E73277>