Re: [libvirt] PATCH: Implement vCPU cpuTime + cpu fields for QEMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 27, 2009 at 03:48:36PM +0100, Daniel P. Berrange wrote:
> The qemudDomainGetVcpus() method in QEMU driver has the following long
> standing todo item
> 
>                /* XXX cpu time, current pCPU mapping */
> 
> This has caused confusion for users, because they set affinity and then
> wonder why 'virsh vcpuinfo' constantly reports their guest as running
> on pCPU 0. This patch implements the missing bits, pulling it out of
> 
>   /proc/$PID/task/$TID/stat
> 
> ie, the per-vCPU thread status file
[...]
> -    if (fscanf(pidinfo, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %llu %llu", &usertime, &systime) != 2) {
> -        qemudDebug("not enough arg");
> +    /* See 'man proc' for information about what all these fields are. We're
> +     * only interested in a very few of them */
> +    if (fscanf(pidinfo,
> +               /* pid -> stime */
> +               "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %llu %llu"
> +               /* cutime -> endcode */
> +               "%*d %*d %*d %*d %*d %*u %*u %*d %*u %*u %*u %*u"
> +               /* startstack -> processor */
> +               "%*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*d %d",
> +               &usertime, &systime, &cpu) != 3) {

  the comments help but it's still frightening

> +        VIR_WARN0("cannot parse process status data");
> +        errno = -EINVAL;
>          return -1;
>      }

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]