Re: [linux-audio-dev] MCS: 64 bit timestamps?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] MCS: 64 bit timestamps?
From: Paul Barton-Davis (pbd_AT_Op.Net)
Date: ma loka   11 1999 - 01:00:02 EDT


>> another word about timestamps though. you suggested that in order to
>> call engine->timestamp(), a sensor thread would have to preempt the
> ^^^^^^^^^^^^^^^^^^^
>What does this function do, exactly?

msc_time_t
Engine::timestamp ()

{
        /* greatly un-inlined to make function clear ... */

        tsc_t current_cycle_counter;
        tsc_t cycle_diff;
        msc_time_t now;

        current_cycle_counter = read_tsc ();
        cycle_diff = current_cycle_counter -
                     cycle_counter_at_start_of_control_loop;
        now = (msc_time_t) (samples_per_cycle * (float) cycle_diff));

        return now;
}

all the engine has to do is to compute samples_per_cycle during its
initialization, and then update
    
    cycle_counter_at_start_of_control_loop => pretty obvious semantics

all other threads can access the current engine timestamp without
affecting the engine thread in any way.

this doesn't take sample clock drift into account. the engine would
have to deal with this by adjusting the
cycle_counter_at_start_of_control_loop value at appropriate intervals
to shift everyone's idea of the current time.

OK ?

--p


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:27:13 EST