Re: [time] add support for CLOCK_THREAD_CPUTIME_ID and CLOCK_PROCESS_CPUTIME_ID

From: Ulrich Drepper
Date: Fri Sep 24 2004 - 23:28:43 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christoph Lameter wrote:

> +int do_posix_clock_thread_gettime(struct timespec *tp)
> +{
> + jiffies_to_timespec(get_jiffies_64()-current->start_time, tp);
> + return 0;
> +}
> +
> +int do_posix_clock_process_gettime(struct timespec *tp)
> +{
> + jiffies_to_timespec(get_jiffies_64()-current->group_leader->start_time, tp);
> + return 0;
> +}
> +

This is pretty useless. Why would you need kernel support for this, it
just measures realtime.

We have an implementation of the CPU time in glibc which can easily be
changed to support clocks of this precision if there are no usable
timestamp counters (which is what is currently used).

And all this is not really what was really meant by "CPU time" in the
POSIX spec. We hijacked this symbol, maybe incorrectly so. What is
really meant is how much time a process/thread actually _uses_ the CPU
(hence the name). I.e., the information contained in struct rusage.

For this I would love to get kernel support and we hopefully have soon a
patch for this.

- --
? Ulrich Drepper ? Red Hat, Inc. ? 444 Castro St ? Mountain View, CA ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBVPNJ2ijCOnn/RHQRAjXeAJ0dUlvRmh6eDJLD6BtmjI3CNWC7pQCfZvAG
wSJclC6wagAwrYqL7/rdpVs=
=SLxp
-----END PGP SIGNATURE-----
-
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/