Bug 174619
Summary: | top reports wrong values for CPU(s) in batch mode | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Brian McEntire <brianm> |
Component: | procps | Assignee: | Karel Zak <kzak> |
Status: | CLOSED ERRATA | QA Contact: | Brian Brock <bbrock> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | rawhide | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2006-04-20 22:54:49 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Brian McEntire
2005-11-30 18:59:03 UTC
In case it matters to troubleshooting, our RHEL4 systems have two CPUs. To be clear, the value of CPU idle from top -bn1 is not corrolated to interactive top. Just to give another data point, I found an RHEL4 system with only one CPU, it also demonstrates the same behaviour when top runs in batch mode. It's correct bahaviour. The top command calculates %CPU by looking at the change in CPU time values between samples. When you first run it, it has no previous sample to compare to, so these initial values are the percentages since boot. It means you need at least two loops. There is not other way how implement it. Sorry, closing as NOTABUG. I don't want to be a pain, but please take a second look. I'm not sure how they do it, but top -bn1 in both RH 7.2 and RHEL3 does not share this behavior. They provide real values on the first iteration. This seems like something that changed for the worse between RHEL3 and RHEL4. At a minimum, if the number given by the first iteration is bogus, it would be better to provide no value at all. It would also be earier to parse. The top command in RHEL3 uses sleep(1) during startup. It means the first loop is there but it's hidden for users. I don't think this is good solution for interactive mode. I've thought about it and I think we can add there a new option and the top with this option will follow old good behaviour in RHEL3. I'm goning to talk about it with upstream developer. Thanks for your patience ;-) Thank you! I haven't looked at the code so I don't know the difficulty of this, but maybe you could put that sleep(1) back, but only for when the -b switch is used. I don't want to change this behaviour in RHEL4 (due to possible regression). I will try improve it for FC5/RHEL5. It's more safe way. It's released to FC5 now. But it's implemented by CPULOOP=1 environment variable -- yeah, it's workaround... I don't want to release some FC/RHEL specific command line option now. I'm trying found some better solution with upstream maintainer too. Maybe there will be possible use something better than env. variable in future. BSD, AIX, and SysV all supply a per-process running average from the kernel. If the Linux kernel would supply that, then the first iteration of top could be both fast and correct. Note that this data is also required for ps to meet the requirements of the Single UNIX Specification. Right now ps is in violation, and not fixable in any remotely acceptable way. |