nel-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nel] ppc build


From: Vincent Caron
Subject: Re: [Nel] ppc build
Date: 26 Jan 2002 01:52:35 +0100

On Fri, 2002-01-25 at 18:41, nik gaffney wrote:
> 
> ok,. so nel (from yesterdays cvs) compiles + installs fine on debian-ppc with 
> only a little change to time_nl.cpp. for the moment, it just fudges a return 
> value to CTime::getPerformanceTime
> 
> specifcally here ->
> 
> #else // NL_OS_WINDOWS
>       unsigned long long int x;
>       __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
>       return x;
> #endif // NL_OS_WINDOWS
> 
> what is this line of asm actually doing?+
>  and could it also be done in c?

This is an invokation of the RDTSC x86 instruction, present in PPro/PII
and newer models. It gives the value of a 64bit counter which is init'ed
to zero at CPU boot, and inc'ed at each CPU cycle. You can't convert it
to 'real time' without the knowledge of the CPU internal clock speed.

I believe this is an unneeded optimisation because :

1) gettimeofday() is often precise enough (sub-millisec) for a game (say
100fps, thus 10ms average frame period)

2) the implementation of gettimeofday() on Linux (it's a system call, so
the glibc proto is only a thin wrapper) has been supporting RDTSC since
a while (see arch/i386/kernel/time.c:do_fast_gettimeoffset(void))

Conclusion: use gettimeofday() for time measures on Linux ! :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]