public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: kvm@vger.kernel.org
Subject: [Bug 55061] cpu stats reported in cgroup file is erroneous
Date: Tue, 26 Mar 2013 17:24:51 +0000 (UTC)	[thread overview]
Message-ID: <20130326172451.3C63311F94A@bugzilla.kernel.org> (raw)
In-Reply-To: <bug-55061-28872@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=55061





--- Comment #2 from Roopa Govind <roopagovind@yahoo.com>  2013-03-26 17:24:51 ---
(In reply to comment #1)
> user_time and system_time reported by virsh are from the point of view of the
> domain on the host machine. Assuming it is QEMU, the stats reported are for the
> QEMU process which is created when VM is started.
> 

Agree, it is reported under cpuacct.usage file under the /<guest-name>/ cgroup.

> A while 1 loop inside VM would only change the vcpu_time and cpu_time.
> Therefore, user_time or system_time would not be modified at all. cgroups
> inside the VM is proper place to look for the stats you are looking for.

I beg to disagree here. I performed this test.

For my guest my 
1. # of vcpus = # of host cpus
2. Used cpu load generator (https://github.com/beloglazov/cpu-load-generator)
inside the guest to generate 90% load for 600 seconds.

#python cpu-load-generator.py -n 4 600 test.data

test.data has values 90 and 80 (for generating 90% and 80% load)

3. changed the cpu shares for my cgroup /<guest-name> to 4096 and to my rest of
the system to 200 using cgset

4. Now ran a sar utility on the host with following options

sar -u ALL 1 600 

and i could see that my %guest utilization percentage shot up to ~90% and ~80%
respectively and %idle was showing ~10% and ~20% while the cpu-load generator
was running inside the guest. 

As soon as the cpu-load-generator stopped the cpu utilization drastically
reduced to 95% idle and 5% utilization.

When I observed the cgroup cpuacct.usage file for my guest under /<guest-name>,
i found that user time < system time.


Now i repeated steps 1-4 with a twist. Before start of my cpu-load-generator in 
my guest, i cleared the cpuacct.usage file to 0 value using the cgset -r
cpuacct.usage=0 /<guest-name>

and reran the whole steps. Now I could find that my user time was drastically
improving compared to system time in cpuacct.usage file. So it does report it
correctly if I set the values to 0 before starting my test.

Let me know if you like to see some screenshots, i can provide you the same.

Thank You for looking into this.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

  parent reply	other threads:[~2013-03-26 17:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 16:14 [Bug 55061] New: cpu stats reported in cgroup file is erroneous bugzilla-daemon
2013-03-23 11:22 ` [Bug 55061] " bugzilla-daemon
2013-03-26 17:24 ` bugzilla-daemon [this message]
2013-03-26 17:28 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130326172451.3C63311F94A@bugzilla.kernel.org \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox