Messages in this thread | | | Date | Sat, 13 Jul 2002 22:40:44 -0700 | From | Zack Weinberg <> | Subject | Re: 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/
| |