public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: One quick quenstion about PXA sched_clock resolution?
Date: Mon, 8 Nov 2010 11:01:19 +0100	[thread overview]
Message-ID: <20101108100119.GR16938@pengutronix.de> (raw)
In-Reply-To: <3f0ffa72.f9b4.12c2ab386e4.Coremail.bill_carson@126.com>

[added Nico to Cc:]

On Mon, Nov 08, 2010 at 04:56:37PM +0800, rocky wrote:
> Hi
> 
> I'am working on an ARM linux porting project, which need to implement sched_clock of our own.
> have a glance at PXA sched_clock timplementation, puzzled about the following notes.
> 
> 
> /*
>  * This is PXA's sched_clock implementation. This has a resolution
>  * of at least 308 ns and a maximum value of 208 days.
>  *
>  * The return value is guaranteed to be monotonic in that range as
>  * long as there is always less than 582 seconds between successive
>  * calls to sched_clock() which should always be the case in practice.
>  */
> 
> 
> 
> 
> PXA series chips have system clock in 3250000/3249600/3686400 HZ.
> I do the math like this:
> 
> ####Where does 308 ns come from?
> 
> 
> ns of one clcok cycle:
> 307.69     (10^9/3250000);
> 307.73     (10^9/3249600);
> 271.26     (10^9/3686400 )
> this is the highest resolution mentioned in above notes;
Seems correct.  I think "at least" above means 308 ns or better (i.e.
shorter).
> 
> 
> ####Where does 582 seconds come from?
> 
> 660.76(0x80000000/3250000);
> 660.84(0x80000000/3249600); 
> 582.54(0x80000000/3686400 );
Seems correct, too.

> Question is how does 208 days pop out?
> Can anyone give me some hints?
> thanks
I didn't check it, but I guess after 208 days sched_clock overflows.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2010-11-08 10:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-08  8:56 One quick quenstion about PXA sched_clock resolution? rocky
2010-11-08 10:01 ` Uwe Kleine-König [this message]
2010-11-08 14:42   ` Nicolas Pitre
     [not found]   ` <1f408c.28b5.12c2e554f1b.Coremail.bill_carson@126.com>
2010-11-09  2:07     ` Nicolas Pitre

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=20101108100119.GR16938@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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