[libvirt] [PATCH 1/2] Get cpuMhz of virNodeGetInfo() from cpufreq/cpuinfo_max_freq, if exist

Eric Blake eblake at redhat.com
Mon Jan 31 22:46:39 UTC 2011


On 01/27/2011 02:51 AM, Minoru Usui wrote:
> virNodeGetInfo() gets from
> /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq, first.
> 
> Signed-off-by: Minoru Usui <usui at mxm.nes.nec.co.jp>

I haven't looked closely at this series yet...

> +    /*
> +     * nodeinfo->mhz should return maximum frequency,
> +     * but "cpu MHz" of /proc/cpuinfo is scaled by power saving feature.
> +     * So it gets cpufreq/cpuinfo_max_freq, if possible.
> +     */
> +    ret = get_cpu_value(0, "cpufreq/cpuinfo_max_freq", true);
> +    if (ret < 0)
> +	return -1;
> +    else if (ret != 1) {
> +	/* convert unit */
> +	cpu_mhz = ret / 1000;

But which units is this converting between, and should it truncate or
round up?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110131/19938812/attachment-0001.sig>


More information about the libvir-list mailing list