public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: abhijit <slashdev@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: do_gettimeofday( ) precision?
Date: Thu, 24 Jun 2004 12:29:55 +0530	[thread overview]
Message-ID: <7c07cd6904062323593201a558@mail.gmail.com> (raw)
In-Reply-To: <7c07cd6904062323437ff6ac69@mail.gmail.com>

On Thu, 24 Jun 2004 12:13:11 +0530, abhijit <slashdev@gmail.com> wrote:
>
> basically i want some counter w/ microsend resolution that fits into 32 bits.
> couple of possible solutions come to my mind:
> 
> [1]  use TSC and convert it to microsec
> [2] use get_timeofday( ) and convert to microsec
> [3] use xtime variable directly and convert to microsec
> (any other ways?)
> 
> conversion in [1] will be costly (a div involved).
> conversion in [2]/[3] can be done using bit operators. (usec|sec << 20)
> but [2] will incur function call overhead which i'd like to avoid.
> 
> so is using xtime directly ok and reliable?

ok. after reading up the source, i think xtime isn;t updated frequently and will
not have the required resolution :( so calling do_gettimeofday() seems the only
way out (unless somebody has any other idea).

btw why isn't do_gettimeofday( ) declared as "inline". so its bit
cheaper to call
especially where you are timestamping (say packets) often.

thanks
abhijit

      reply	other threads:[~2004-06-24  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-23 15:23 do_gettimeofday( ) precision? abhijit
2004-06-23 15:54 ` Lukasz Michal Rak
2004-06-24  6:43   ` abhijit
2004-06-24  6:59     ` abhijit [this message]

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=7c07cd6904062323593201a558@mail.gmail.com \
    --to=slashdev@gmail.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