Re: [vdsm] Fwd: Calculating the VM cpu usage percent out of the total VDS cpus

```Got this one solved, using:

int curVmCpuPercent =
vm.getUsageCpuPercent() * vm.getNumOfCpus()
```
----- Original Message -----

> From: "Kobi Ianko" <kia...@redhat.com>
> To: vdsm-de...@fedorahosted.org
> Sent: Monday, December 30, 2013 6:10:26 PM
> Subject: [vdsm] Fwd: Calculating the VM cpu usage percent out of the total
> VDS cpus

> Hi All,
> I have a followup question on what Dan replayed.

> When talking about CPU percentage is it out of the VM's virtual CPU(s) or is
> it out of whole VDS CPU(s)?

> In case of "out of vm's virtual CPU(s)", what will be the best way to get my
> goal(calculating the VM cpu usage percent out of the total VDS cpus)?
> I could count all virtual CPUS in the VDS host and calculate:
> (cpuUser+cpuSys)/(#cpusInVds*100)

> Suggestions will be much appreciated :)

> Dan - 10x for your help

> ----- Original Message -----

> > From: "Dan Kenigsberg" <dan...@redhat.com>
>
> > To: "Kobi Ianko" <kia...@redhat.com>
>
> > Cc: "Doron Fediuck" <dfedi...@redhat.com>
>
> > Sent: Monday, December 30, 2013 1:52:44 PM
>
> > Subject: Re: Calculating the VM cpu usage percent out of the total VDS cpus
>

> > On Sun, Dec 29, 2013 at 11:29:04AM -0500, Kobi Ianko wrote:
>
> > > Hi Dan,
>
> > > On my current task I need to understand how to extract a number that
> > > represents:
>
> > > The VM cpu usage percent out of the total VDS cpus.
>

> > vdsClient -s 0 getAllVmStats
>

> > provides cpuUser and cpuSys per VM. They represent the CPU percentage
>
> > used by this vm in user mode and kernel mode, respectively.
>
> > Note that percentage may be more than 100% for multi-processor VMs.
>

> > >
>
> > > I understand that you have vast knowledge in this section of the
>
> > > system, and I would appreciate your help.
>

> > Yeah, I'm old. But you should not be shy; it's better to ask such
>
> > questions on vdsm-de...@fedorahosted.org so more people could answer and
>
> > more people can learn.
>

> _______________________________________________
> vdsm-devel mailing list
> vdsm-devel@lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/vdsm-devel
```
```_______________________________________________
vdsm-devel mailing list
vdsm-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-devel
```