The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: AP <ap@zip.com.au>
To: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: Laurent Vivier <Laurent.Vivier@bull.net>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	lkml <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: /proc 2.6.24 changes for guest CPU accounting
Date: Tue, 24 Jun 2008 22:39:52 +1000	[thread overview]
Message-ID: <20080624123951.GJ2896@zip.com.au> (raw)
In-Reply-To: <cfd18e0f0806230351nd9eb54ei5e87734291ced9be@mail.gmail.com>

On Mon, Jun 23, 2008 at 12:51:11PM +0200, Michael Kerrisk wrote:
> > You must also notes that "user time" includes "guest time", if you want
> > real "user time" you must subtract "guest time".
> > The "guest time" is included in "user time" to not loose it when the
> > "reader" is not aware of the "guest time".
> 
> Hi Laurent (and Christian)
> 
> So, I just want to confirm.  You are saying that guest_time and
> cguest_time are respectively also included in the following fields
> 
>               utime %lu
...
>               cutime %ld
...
> Right?

If this function in ./kernel/sched.c is anything to go by and I'm not
being a complete noob, yes:

/*
 * Account guest cpu time to a process.
 * @p: the process that the cpu time gets accounted to
 * @cputime: the cpu time spent in virtual machine since the last update
 */
static void account_guest_time(struct task_struct *p, cputime_t cputime)
{
        cputime64_t tmp;
        struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;

        tmp = cputime_to_cputime64(cputime);

        p->utime = cputime_add(p->utime, cputime);
        p->gtime = cputime_add(p->gtime, cputime);

        cpustat->user = cputime64_add(cpustat->user, tmp);
        cpustat->guest = cputime64_add(cpustat->guest, tmp);
}

As such, I'll follow up with a new version of my previous patch.

AP

  reply	other threads:[~2008-06-24 13:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-22  7:31 /proc 2.6.24 changes for guest CPU accounting Michael Kerrisk
2008-06-23  8:28 ` Christian Borntraeger
2008-06-23  8:48 ` Laurent Vivier
2008-06-23 10:51   ` Michael Kerrisk
2008-06-24 12:39     ` AP [this message]
2008-06-24 12:43     ` [PATCH] Documentation: add descs for guest fields in stat procfs files AP
2008-06-24 20:38       ` Laurent Vivier
2008-06-25  3:28       ` Michael Kerrisk

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=20080624123951.GJ2896@zip.com.au \
    --to=ap@zip.com.au \
    --cc=Laurent.Vivier@bull.net \
    --cc=borntraeger@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mtk.manpages@gmail.com \
    --cc=mtk.manpages@googlemail.com \
    --cc=samuel.thibault@ens-lyon.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