public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zack Weinberg <zack@codesourcery.com>
To: linux-kernel@vger.kernel.org
Subject: Re: What is supposed to replace clock_t?
Date: Sat, 13 Jul 2002 22:40:44 -0700	[thread overview]
Message-ID: <20020714054044.GF30675@codesourcery.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0207131103410.16670-100000@home.transmeta.com>

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

  parent reply	other threads:[~2002-07-14  5:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-13  8:34 What is supposed to replace clock_t? Tim Schmielau
2002-07-13 18:15 ` Linus Torvalds
2002-07-13 20:15   ` Albert D. Cahalan
2002-07-13 20:30     ` Thunder from the hill
2002-07-14 18:46     ` Linus Torvalds
2002-07-14  5:40   ` Zack Weinberg [this message]
2002-07-16 10:54   ` [patch 1/2] " Tim Schmielau
2002-07-16 11:00     ` [patch 2/2] " Tim Schmielau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020714054044.GF30675@codesourcery.com \
    --to=zack@codesourcery.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox