Re: [PATCH] qemu: Provide virDomainGetCPUStats() implementation for session connection

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

 



On 1/17/23 15:15, Martin Kletzander wrote:
> On Tue, Jan 17, 2023 at 01:44:44PM +0100, Michal Privoznik wrote:
>> We have virDomainGetCPUStats() API which offers querying
>> statistics on host CPU usage by given guest. And it works in two
>> modes: getting overall stats (@start_cpu == -1, @ncpus == 1) or
>> getting per host CPU usage.
>>
>> For the QEMU driver it is implemented by looking into values
>> stored in corresponding cpuacct CGroup controller. Well, this
>> works for system instances, where libvirt has permissions to
>> create CGroups and place QEMU process into them. But it does not
>> fly for session connection, where no CGroups are set up.
>>
>> Fortunately, we can do something similar to v8.8.0-rc1~95 and use
>> virProcessGetStatInfo() to fill the overall stats. Unfortunately,
>> I haven't found any source of per host CPU usage, so we just
>> continue throwing an error in that case.
>>
> 
> Looks ok, but there's one thing that's bothering me a bit.  On non-Linux
> platforms this API would start to work and returning zeros.  Could that
> be fixed somehow in a nice fashion or should I treat that as a non-issue?

Good point, I've never realized that non-Linux version of
virProcessGetStatInfo() doesn't fail. Let me post a v2 in which I'll
change the function to return error followed by this patch.

Michal




[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]

  Powered by Linux