[libvirt] PATCH: Implement vCPU cpuTime + cpu fields for QEMU
Daniel Veillard
veillard at redhat.com
Mon Jul 27 15:00:04 UTC 2009
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 at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list