RFR - 6526682: JConsole shows negative CPU Usage
Mario Torre
neugens.limasoftware at gmail.com
Tue Jun 4 03:02:29 PDT 2013
I agree with Erik and Staffan,
I was actually a bit surprised this passed the review status so quickly.
The code right before that line is:
float cpuUsage = Math.min(99F, elapsedCpu / (elapsedTime * 10000F *
result.nCPUs));
I would look at elapsedTime as a suspect here.
It really seems to me something's wrong from the reporting bean, but
this fix doesn't necessarily make "the UI robust enough to fix data
from the Mxbean", it's just clamping the value to the allowed limit.
Cheers,
Mario
2013/6/4 Staffan Larsen <staffan.larsen at oracle.com>:
> I agree with Erik that this will just be hiding another problem (and making that problem harder to find).
>
> /Staffan
>
> On 1 jun 2013, at 10:06, Erik Gahlin <erik.gahlin at oracle.com> wrote:
>
>> Nils, do you know why you get a negative number?
>>
>> As I remember it, the MBean returns -1 if the value is not available on the platform. I think there should be a message that tells the user that
>>
>> Now it's just a matter of time before somebody files a bug that they got 0% instead of the CPU load they actually have on their machine. The negative value was at least a hint to the user that the value can't be trusted
>>
>> Erik
>>
>>
>> On 31 maj 2013, at 13:59, Nils Loodin <nils.loodin at oracle.com> wrote:
>>
>>> Simple fix to not show negative CPU usage in JConsole:
>>>
>>> http://cr.openjdk.java.net/~nloodin/6526682/webrev.00/
>>>
>>> Regards,
>>> Nils Loodin
>
--
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF
IcedRobot: www.icedrobot.org
Proud GNU Classpath developer: http://www.classpath.org/
Read About us at: http://planet.classpath.org
OpenJDK: http://openjdk.java.net/projects/caciocavallo/
Please, support open standards:
http://endsoftpatents.org/
More information about the serviceability-dev
mailing list