* Getting Time Difference
@ 2003-01-16 16:48 ` Gilad Benjamini
0 siblings, 0 replies; 9+ messages in thread
From: Gilad Benjamini @ 2003-01-16 16:48 UTC (permalink / raw)
To: linux-mips
Hi,
I am porting code from a x86 platform.
That code uses rdtsc and cpu_khz to compute
the time difference between two events. Jiffies aren't good enough in this
case.
Looking through header files I can find a few MIPS replacements.
What is the "right" one to use ?
What is the best way to change the code so it can compile
and run on both platforms ?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Getting Time Difference
@ 2003-01-16 16:48 ` Gilad Benjamini
0 siblings, 0 replies; 9+ messages in thread
From: Gilad Benjamini @ 2003-01-16 16:48 UTC (permalink / raw)
To: linux-mips
Hi,
I am porting code from a x86 platform.
That code uses rdtsc and cpu_khz to compute
the time difference between two events. Jiffies aren't good enough in this
case.
Looking through header files I can find a few MIPS replacements.
What is the "right" one to use ?
What is the best way to change the code so it can compile
and run on both platforms ?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Getting Time Difference
2003-01-16 16:48 ` Gilad Benjamini
(?)
@ 2003-01-17 12:56 ` Ralf Baechle
-1 siblings, 0 replies; 9+ messages in thread
From: Ralf Baechle @ 2003-01-17 12:56 UTC (permalink / raw)
To: Gilad Benjamini; +Cc: linux-mips
On Thu, Jan 16, 2003 at 06:48:09PM +0200, Gilad Benjamini wrote:
> I am porting code from a x86 platform.
> That code uses rdtsc and cpu_khz to compute
> the time difference between two events. Jiffies aren't good enough in this
> case.
>
> Looking through header files I can find a few MIPS replacements.
> What is the "right" one to use ?
>
> What is the best way to change the code so it can compile
> and run on both platforms ?
Try do_gettimeofday().
Ralf
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Getting Time Difference
2003-01-16 16:48 ` Gilad Benjamini
(?)
(?)
@ 2003-01-20 19:50 ` Jun Sun
2003-01-20 20:15 ` Christoph Hellwig
-1 siblings, 1 reply; 9+ messages in thread
From: Jun Sun @ 2003-01-20 19:50 UTC (permalink / raw)
To: Gilad Benjamini; +Cc: linux-mips, jsun
On Thu, Jan 16, 2003 at 06:48:09PM +0200, Gilad Benjamini wrote:
> Hi,
> I am porting code from a x86 platform.
> That code uses rdtsc and cpu_khz to compute
> the time difference between two events. Jiffies aren't good enough in this
> case.
>
> Looking through header files I can find a few MIPS replacements.
> What is the "right" one to use ?
>
> What is the best way to change the code so it can compile
> and run on both platforms ?
>
I assume you are doing this inside kernel for some performance
measurement.
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)))
In mvl kernel we always calibrate mips_counter_frequency even if it
is not specified by board code. This is different from the current
linux-mips.org tree.
Jun
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Getting Time Difference
2003-01-20 19:50 ` Jun Sun
@ 2003-01-20 20:15 ` Christoph Hellwig
2003-01-20 20:19 ` Jun Sun
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2003-01-20 20:15 UTC (permalink / raw)
To: Jun Sun; +Cc: Gilad Benjamini, linux-mips
On Mon, Jan 20, 2003 at 11:50:59AM -0800, Jun Sun wrote:
> I assume you are doing this inside kernel for some performance
> measurement.
>
> In mvsita kernel we introduced an abstraction layer which consists
> of the following:
Do you have a pointer to the mvista tree (cvs/tarball/rpm/patch)?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Getting Time Difference
2003-01-20 20:15 ` Christoph Hellwig
@ 2003-01-20 20:19 ` Jun Sun
2003-01-20 20:29 ` Christoph Hellwig
0 siblings, 1 reply; 9+ messages in thread
From: Jun Sun @ 2003-01-20 20:19 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Gilad Benjamini, linux-mips, jsun
On Mon, Jan 20, 2003 at 08:15:31PM +0000, Christoph Hellwig wrote:
> On Mon, Jan 20, 2003 at 11:50:59AM -0800, Jun Sun wrote:
> > I assume you are doing this inside kernel for some performance
> > measurement.
> >
> > In mvsita kernel we introduced an abstraction layer which consists
> > of the following:
>
> Do you have a pointer to the mvista tree (cvs/tarball/rpm/patch)?
>
I don't think you can freely access it. Check with our marketing people.
Most of the work though is submitted back to the community, which of course
could take quite a while to show up, or sometimes get rejected and never
show up.
Jun
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Getting Time Difference
2003-01-20 20:19 ` Jun Sun
@ 2003-01-20 20:29 ` Christoph Hellwig
2003-01-20 20:48 ` Pete Popov
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2003-01-20 20:29 UTC (permalink / raw)
To: Jun Sun; +Cc: Gilad Benjamini, linux-mips
On Mon, Jan 20, 2003 at 12:19:51PM -0800, Jun Sun wrote:
> I don't think you can freely access it. Check with our marketing people.
> Most of the work though is submitted back to the community, which of course
> could take quite a while to show up, or sometimes get rejected and never
> show up.
That's not exactly a nice attitude :P
Maybe there's some mvista customer here who wants to use his/her right to
freely distribute it so I can add it to the other vendor trees at
kernelnewbies.org?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Getting Time Difference
2003-01-20 20:29 ` Christoph Hellwig
@ 2003-01-20 20:48 ` Pete Popov
0 siblings, 0 replies; 9+ messages in thread
From: Pete Popov @ 2003-01-20 20:48 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jun Sun, Gilad Benjamini, linux-mips
On Mon, 2003-01-20 at 12:29, Christoph Hellwig wrote:
> On Mon, Jan 20, 2003 at 12:19:51PM -0800, Jun Sun wrote:
> > I don't think you can freely access it. Check with our marketing people.
> > Most of the work though is submitted back to the community, which of course
> > could take quite a while to show up, or sometimes get rejected and never
> > show up.
>
> That's not exactly a nice attitude :P
All of that work is submitted to the community. Jun was talking about
the internal source tree not being freely accessible.
> Maybe there's some mvista customer here who wants to use his/her right to
> freely distribute it so I can add it to the other vendor trees at
> kernelnewbies.org?
I think the fact that it's not in the community tree means that it was
submitted but not accepted. Not everything we do for customers is of
interest to the community at large, which is to be expected, but that's
the main reason why sometimes bits get lost and never make it there.
Pete
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Getting Time Difference
[not found] <328392AA673C0A49B54DABA457E37DAA08C300@exchange>
@ 2003-01-21 18:13 ` Jun Sun
0 siblings, 0 replies; 9+ messages in thread
From: Jun Sun @ 2003-01-21 18:13 UTC (permalink / raw)
To: Gilad Benjamini; +Cc: Gilad Benjamini, linux-mips, jsun
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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-01-21 18:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[not found] <328392AA673C0A49B54DABA457E37DAA08C300@exchange>
2003-01-21 18:13 ` Jun Sun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.