lkml.org 
[lkml]   [2002]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: What is supposed to replace clock_t?
Linus Torvalds wrote:
...
> Many of the binary interfaces are perfectly fine. In fact, there are
> very few binary interfaces that are fundamentally broken, the
> obvious one being the "times()" system call that nobody actually
> uses any more.

Er, no; people do still use times(). It is (as far as I know) the
only way for a process to determine how much wall-clock, user CPU, and
system CPU time it has consumed, all at once. If you use getrusage()
instead, you also have to call gettimeofday() to get the wall-clock
time, which at least doubles the overhead. [Both getrusage and
gettimeofday are somewhat more expensive than times, but I'm pretty
sure the trap cost dominates.] Profiling code tries very hard to have
as little overhead as possible.

As an application programmer, I would be perfectly happy to use an
extended getrusage() that gave me wall-clock time as a struct timeval.
But please do provide such an interface before deprecating times().

[While we're at it, it would be nice if the kernel would provide
useful values for more of the fields of struct rusage.]

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

\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.217 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site