On 10/04/2007 04:00 PM, Christian Borntraeger wrote:The code in fs/proc/array.c is... interesting. 1. task_stime() converts p->se.sum_exec_runtime to a clock_t 2. it calls task_utime() which does the same thing (can it change between the two reads?), does some calculations that yield a clock_t, turns the result into a cputime and returns that 3. task_stime() then converts that result back into a clock_t and uses it! static cputime_t task_stime(struct task_struct *p) { clock_t stime; stime = nsec_to_clock_t(p->se.sum_exec_runtime) - cputime_to_clock_t(task_utime(p)); return clock_t_to_cputime(stime); } static cputime_t task_utime(struct task_struct *p) { clock_t utime = cputime_to_clock_t(p->utime), total = utime + cputime_to_clock_t(p->stime); u64 temp; temp = (u64)nsec_to_clock_t(p->se.sum_exec_runtime); if (total) { temp *= utime; do_div(temp, total); } utime = (clock_t)temp; return clock_t_to_cputime(utime); } -
| David Newall | Re: Slow DOWN, please!!! |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Christoph Lameter | Re: -mm merge plans for 2.6.23 |
| Roland Dreier | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Andreas Henriksson | [PATCH 06/12] Remove bogus reference to tc-filters(8) from tc(8) manpage. |
