From: Eugene Surovegin <ebs@ebshome.net>
To: Steven Scholz <steven.scholz@imc-berlin.de>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: MPC8xx: resolution of gettimeofday() ?
Date: Thu, 18 May 2006 09:48:12 -0700 [thread overview]
Message-ID: <20060518164812.GA21075@gate.ebshome.net> (raw)
In-Reply-To: <446C8E70.3040601@imc-berlin.de>
On Thu, May 18, 2006 at 05:10:40PM +0200, Steven Scholz wrote:
> Hi all,
>
> what is the resolution of gettimeofday() for an MPC8xx?
>
> IIUC then the "decrementer" is used to generate the timer interrupts every 10ms.
>
> This decrementer runs at cpuclk/16. Thus with 80MHz CPU clock has a
> resolution of 16/80MHz = 200ns and overflows every 50000 ticks.
>
> But is this decrementer used to update xtime?
> Will gettimeofday() have a resolution of 200ns?
>
> How about linux 2.4 where xtime is a "struct timeval" rather then "struct
> timespec"?
>
> This trivial test programm
>
> struct timeval first, next;
> double diff;
>
> gettimeofday(&first, NULL);
> do {
> gettimeofday(&next, NULL);
> } while (first.tv_usec == next.tv_usec &&
> first.tv_sec == next.tv_sec);
>
> diff = ((double) next.tv_sec - (double) first.tv_sec) * 1e6;
> diff += (double) (next.tv_usec - first.tv_usec);
>
> printf ("Resolution gettimeofday() = %g ?s\n", diff);
>
> says it's between 13 - 16 ?s on a linux-2.4.20. Could that be? how does this
> relate to the decrementer frequency?
Usually on PPC we use timebase to interpolate time between Decrementer
interrupts. In this case gettimeofday resolution is determined by
timebase resolution which is quite high (megahertz range).
--
Eugene
next prev parent reply other threads:[~2006-05-18 16:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-18 15:10 MPC8xx: resolution of gettimeofday() ? Steven Scholz
2006-05-18 16:48 ` Eugene Surovegin [this message]
2006-05-19 8:08 ` Steven Scholz
2006-05-19 17:55 ` Eugene Surovegin
2006-05-22 11:03 ` Steven Scholz
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=20060518164812.GA21075@gate.ebshome.net \
--to=ebs@ebshome.net \
--cc=linuxppc-embedded@ozlabs.org \
--cc=steven.scholz@imc-berlin.de \
/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;
as well as URLs for NNTP newsgroup(s).