lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070530001600.1d44f5b7.akpm@linux-foundation.org>
Date:	Wed, 30 May 2007 00:16:00 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	menage@...gle.com
Cc:	dev@...ru, xemul@...ru, serue@...ibm.com, vatsa@...ibm.com,
	ebiederm@...ssion.com, haveblue@...ibm.com,
	svaidy@...ux.vnet.ibm.com, balbir@...ibm.com, pj@....com,
	cpw@....com, ckrm-tech@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org, containers@...ts.osdl.org,
	mbligh@...gle.com, rohitseth@...gle.com, devel@...nvz.org
Subject: Re: [PATCH 02/10] Containers(V10): Example CPU accounting subsystem

On Tue, 29 May 2007 06:01:06 -0700 menage@...gle.com wrote:

> This example demonstrates how to use the generic container subsystem
> for a simple resource tracker that counts, for the processes in a
> container, the total CPU time used and the %CPU used in the last
> complete 10 second interval.
> 
> ...
>
> --- /dev/null
> +++ container-2.6.22-rc2-mm1/kernel/cpu_acct.c
> @@ -0,0 +1,185 @@
> +/*
> + * kernel/cpu_acct.c - CPU accounting container subsystem
> + *
> + * Copyright (C) Google Inc, 2006
> + *
> + * Developed by Paul Menage (menage@...gle.com) and Balbir Singh
> + * (balbir@...ibm.com)
> + *
> + */
>
> ...
>
> +static u64 cpuusage_read(struct container *cont,
> +			 struct cftype *cft)
> +{
> +	struct cpuacct *ca = container_ca(cont);
> +	u64 time;
> +
> +	spin_lock_irq(&ca->lock);
> +	cpuusage_update(ca);
> +	time = cputime64_to_jiffies64(ca->time);
> +	spin_unlock_irq(&ca->lock);
> +
> +	/* Convert 64-bit jiffies to seconds */
> +	time *= 1000;
> +	do_div(time, HZ);

hm, we have jiffies_to_lotsofthings, but we don't appear to have a
jiffies_to_seconds.  How odd.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ