| Summary: | top -d 1 will not show proper information concerning cpu states, nor will -d1 | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Tyler Spivey <tspivey8> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Tyler Spivey
2001-06-23 17:00:12 UTC
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 */ State Changed From-To: open->closed Impossible to correct problem without major modification to top. Workaround provided and user refered to top maintainer. |