[Top][All Lists]

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

Re: [fluid-dev] Inline Assembler

From: David Olofson
Subject: Re: [fluid-dev] Inline Assembler
Date: Sun, 25 Apr 2004 13:40:26 +0200
User-agent: KMail/1.5.4

On Sunday 25 April 2004 12.51, Tiemo Krueger - mycable.de wrote:
> Hi,
> it's not the SSE code, it's in fluid_sys.c the rdtsc code in the
> POSIX part of the code.
> If I define DARWIN I'll have some empty functions just returning 0
> and 1 instead
> using rdtsc. It seems just to use it to synchronize somehow with
> cpu time stamp,
> but to be honest I'm not so inside x86 asm and even not in
> fluidsynth. I want to
> port it to an embedded system where I don't have variations in CPU
> frequency
> so I could work-around this with some specific code.
> Perhaps you can give me an idea what kind of values are returned by
> rdtsc(void)
> and fluid_estimate_cpu_frequency(void)?
> Or shouldn't I think about this and use DARWIN define???

(Without actually looking at the code:) x86 RDTSC (ReaD Time Stamp 
Counter) reads a 64 bit counter that counts CPU core clocks; ie it 
increments 400,000,000 times/s on a 400 MHz CPU.

In order to transform this to more useful time units (say, ┬Ás), you 
need to figure out the CPU clock frequency, which is where 
fluid_estimate_cpu_frequency() would come in.

Now, I'm not sure what it's actually used for in FluidSynth. It's used 
in fluid_utime(), which in turn is used for calculating the CPU load, 
and maybe some other stuff. Since it's #defined to 0.0 on Mac OS 9 
for example, I would guess it's not strictly required to make things 

Anyway, don't you have POSIX gettimeofday() on your OS...? At least on 
Linux, that's usually based on some sort of hardware counter, and the 
resolution is usually better than milliseconds.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---

reply via email to

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