Re: [PATCH] Add all thread stats for TASKSTATS_CMD_ATTR_TGID

From: Guillaume Chazarain
Date: Mon Sep 10 2007 - 09:04:29 EST


Le Fri, 7 Sep 2007 16:37:57 -0700 (PDT),
Jonathan Lim <jlim@xxxxxxx> a Ãcrit :

> > Excellent, so can Guillaume change ac_btime to be just
> > tsk->start_time?
>
> I don't think so. Current time (xtime) is relative to the epoch;
> uptime and tsk->start_time (jiffies) are both relative to some boot
> time. So you need to subtract uptime from xtime to get the boot time
> relative to the epoch, then add tsk->start_time. The result is what
> ac_btime should be set to.
>
> I think his recent changes are as follows:
>
> --- a/kernel/tsacct.c Fri Aug 31 01:42:23 2007 -0700
> +++ b/kernel/tsacct.c Tue Aug 28 20:35:27 2007 +0200
> ...
> -void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
> +static void fill_wall_times(struct taskstats *stats, struct
> task_struct *task) ...
> - ts = timespec_sub(uptime, tsk->start_time);
> + ts = timespec_sub(uptime, task->start_time);
> ...
> - stats->ac_btime = get_seconds() - ts.tv_sec;
> ...
> + stats->ac_btime = get_seconds() - ts.tv_sec;
>
> So really no different from before, which is correct.

Yes, I just tried to make it clearer that the computations were needed
to get a wall time. Otherwise, as CSA seems to start using taskstats,
do my changes make sense for your usage?

Thanks.

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