[Cbe-oss-dev] [PATCH 1/2]MARS/core: Tick counter api

Kazunori Asayama asayama at sm.sony.co.jp
Tue Nov 25 12:03:03 EST 2008


Arnd Bergmann wrote:
> The 32 bit version is ok, the 64 bit version is not. In general, it's much

I suppose even the 32bit version doesn't fix the problem. It looks like
the 32bit version considers only the case that upper 32bits are changed
by carry while reading lower 32bits.

To avoid the problem you mentioned, it is needed to read TB again while
lower 32bits are zero.

> easier to just use the gettimeofday() libc function, which is almost as
> fast, and is guaranteed to work correctly.

For our purposes, gettimeofday is insufficient. Our major motivation to
add this API function is to measure performance of various elements of
MARS (including the scheduler). However, SPU's gettimeofday issues 'stop
and signal' internally, so it has significant side effect on behavior of
MARS. If we use gettimeofday only on PPU side, it will become difficult
to measure time between PPU-SPU and/or SPU-SPU without significant side
effect or error of measurement (see 'background' part in my patch).

> 
> In general, functions named __foo are internal to the implementation and
> should not be used directly.

As I mentioned in my previous message, __mftb is one of PPU intrinsics
which are defined in "C/C++ Language Extensions for Cell
Broadband Engine Architecture", so I believe they are public. (all PPU
intrinsics begin with '__')

-- 
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list