Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: Gilad Benjamini <gilad@riverhead.com>
Cc: Gilad Benjamini <yaelgilad@myrealbox.com>,
	linux-mips@linux-mips.org, jsun@mvista.com
Subject: Re: Getting Time Difference
Date: Tue, 21 Jan 2003 10:13:38 -0800	[thread overview]
Message-ID: <20030121101338.W2100@mvista.com> (raw)
In-Reply-To: <328392AA673C0A49B54DABA457E37DAA08C300@exchange>; from gilad@riverhead.com on Tue, Jan 21, 2003 at 07:48:57AM +0200

On Tue, Jan 21, 2003 at 07:48:57AM +0200, Gilad Benjamini wrote:
> > In mvsita kernel we introduced an abstraction layer which consists
> > of the following:
> > 
> > readclock_init()
> > readclock()
> > clock_to_usecs()
> > 
> > For MIPS in general, we use the following implementation:
> > 
> > #define readclock_init()
> > #define readclock(low)   do {                           \
> >         db_assert(mips_cpu.options & MIPS_CPU_COUNTER); \
> >         low = read_32bit_cp0_register(CP0_COUNT);       \
> >         } while (0)     
> > #define clock_to_usecs(clocks) ((clocks) / 
> > ((mips_counter_frequency / 1000000)))
> > 
> 
> Thx.
> How would I go about doing readclock to a 64 bit variable ?
> The 32 bit can wrap around pretty fast in today's processors.
>

This interface is meant for short and precise kernel timing
measurement.  Wraping around once does not cause problem as
long as the elapsed clock cycles is less than 2^32.  That gives 
you about 40 secs max interval on a CPU with 100MHz counter
frequency.

Jun

       reply	other threads:[~2003-01-21 18:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <328392AA673C0A49B54DABA457E37DAA08C300@exchange>
2003-01-21 18:13 ` Jun Sun [this message]
2003-01-16 16:48 Getting Time Difference Gilad Benjamini
2003-01-16 16:48 ` Gilad Benjamini
2003-01-17 12:56 ` Ralf Baechle
2003-01-20 19:50 ` Jun Sun
2003-01-20 20:15   ` Christoph Hellwig
2003-01-20 20:19     ` Jun Sun
2003-01-20 20:29       ` Christoph Hellwig
2003-01-20 20:48         ` Pete Popov

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=20030121101338.W2100@mvista.com \
    --to=jsun@mvista.com \
    --cc=gilad@riverhead.com \
    --cc=linux-mips@linux-mips.org \
    --cc=yaelgilad@myrealbox.com \
    /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