pcp
[Top] [All Lists]

Re: [pcp] Confusion about metricConvert() value for kernel.all.cpu.user

To: pcp@xxxxxxxxxxx
Subject: Re: [pcp] Confusion about metricConvert() value for kernel.all.cpu.user
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Tue, 11 Aug 2015 07:44:34 +1000
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <CANbxzdX9xrdumqJToqnxvDnV5prm9rJZ+BGB_D4QK7yHpA2T3w@xxxxxxxxxxxxxx>
References: <CANbxzdVdC91nn8WG8MXNu=LjP32ehO4VAa7tKNVuUONOyJh8uA@xxxxxxxxxxxxxx> <87si7wxjpv.fsf@xxxxxxxxxx> <CANbxzdWJ5FoO72EHZyA9jVJ7us1C6qOshzxcyO9vynayeO01Nw@xxxxxxxxxxxxxx> <y0mr3nfuu2u.fsf@xxxxxxxx> <CANbxzdX9xrdumqJToqnxvDnV5prm9rJZ+BGB_D4QK7yHpA2T3w@xxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0
On 07/08/15 23:19, Rohan Arora wrote:
If I simply do a metricConvert() for kernel.all.cpu.user and then divide
the value by 10, I end up with values that are ~30% higher than what top
shows me, or it shows 0% when top does not. However, I do get values
that are quite close by doing the following:
         float(user) / (user + nice + sys + idle + intr + steal + guest
+ vuser + total + soft + hard) * 100

Do you know why there might such a difference in the values using the
method that you described and top? Also, is the method I mentioned above
a valid way to measure the user cpu usage?

How many CPUs in your system?

For an N CPU system, the kernel.all.cpu.* metrics will sum to N,000 milliseconds per second, so to get percentages in the range 0-100 you typically have to divide by hinv.ncpu.

<Prev in Thread] Current Thread [Next in Thread>