WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Snmp cpuRawIdle showing double

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Snmp cpuRawIdle showing double
From: Nathan March <nathan@xxxxxx>
Date: Wed, 06 Apr 2011 10:51:47 -0700
Delivery-date: Wed, 06 Apr 2011 10:52:30 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=gt.net; h=message-id:date :from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; s=mail; bh=VGvE461d6NYW MeaevPW1GqZOW0c=; b=wKf/SFsOm+DyC03A8ggCl0m+BPq5lw5oF3MEA5mx5RzZ Vqm/mkagfMNA4Sgza6kVdUqLeglxqaTtIpmPSb7jrJQoTFVskxzpv1jPKIRFKAPN t07KyiB0G7N3BlsV4zWivMHgVpAZcaOe2sNT5WHep7OekrqKQqGvnERG9XETI2I=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gt.net; h=message-id:date :from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=mail; b=trVEWJ BJ0UT2xSmG7Jb23TpmcaOyQ/MeSnnIH5e+rQgj02CfglPlaorFK1wnwBzyPk2pbk JM2Epl+HNCW7vpYzwhsRbll1b2eHNB+QkYLRCEJHk+zRp9YVcXJi+h9U3NWuMj/Y dP/n3BjzmWGC4BIyX7b8ZYlhdoBdVlpmiSmd0=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4D9B8538.8070908@xxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4D9B8538.8070908@xxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9
On 4/5/2011 2:10 PM, Nathan March wrote:
> Polling the UCE-SNMP-MIB::ssCpuRawIdle counter results in a total that's
> double the actual number of cpu's on the system, so for example:
>
> nms ~ # snmpwalk -v 2c -c 'XXX' xen1 1.3.6.1.4.1.2021.11.53 && sleep 60
> && snmpwalk -v 2c -c 'XXX' xen1 1.3.6.1.4.1.2021.11.53
> UCD-SNMP-MIB::ssCpuRawIdle.0 = Counter32: 1313274
> UCD-SNMP-MIB::ssCpuRawIdle.0 = Counter32: 1324862
>
> (1324862 - 1313274) / 6000 * 100 = 193%

Dug into the net-snmp source code to figure out where it pulls that data
from, here's a test case:

x=$(cat /proc/stat | grep cpu0 | awk '{print $5}') && sleep 60 &&
y=$(cat /proc/stat | grep cpu0 | awk '{print $5}') && echo -e
"X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)

xen1 ~ # x=$(cat /proc/stat | grep cpu0 | awk '{print $5}') && sleep 60
&& y=$(cat /proc/stat | grep cpu0 | awk '{print $5}') && echo -e
"X:$x\nY:$y\nIDLE:" $(echo "scale=3; ($y-$x)/6000*100" | bc)    
X:15718848
Y:15730453
IDLE: 193.400

>From the man page, it says the user_hz is 1/100th:

              cpu  3357 0 4313 1362393
                     The amount of time, measured in units of USER_HZ
(1/100ths of a second on most architectures, use sysconf(_SC_CLK_TCK) to
obtain the right value), that the system spent in user mode, user mode
                     with low priority (nice), system mode, and the idle
task, respectively.  The last value should be USER_HZ times the second
entry in the uptime pseudo-file.

and sysconf agrees:

xen1 ~ # perl -e 'use POSIX; print POSIX::sysconf(&POSIX::_SC_CLK_TCK);'
100

Anyone have any ideas?

This works as expected on a very outdated dom0 I have, 2.6.21 and xen
3.2.1. It seems to be broken on at least xen 4.0 (2.6.31.13) and above.

- Nathan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

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