Show
Ignore:
Timestamp:
06/23/12 07:03:54 (9 years ago)
Author:
jwoithe
Message:

A second pass at addressing ticket #242. Define a global clock source within the SystemTimeSource? object and use this whenever clock_gettime() is called. On systems which support the new raw1394_read_cycle_timer_and_clock() libraw1394 call and CLOCK_MONOTONIC_RAW, these changes should ensure that all timing-sensitive parts of FFADO are using the same clock source. System tests under tests/systemtests/ have not been converted to use this new framework because they exist for different purposes and are not using the FFADO streaming infrastructure.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libieee1394/ieee1394service.cpp

    r2167 r2171  
    22 * Copyright (C) 2005-2008 by Daniel Wagner 
    33 * Copyright (C) 2005-2008 by Pieter Palmers 
     4 * Copyright (C) 2012 by Jonathan Woithe 
    45 * 
    56 * This file is part of FFADO 
     
    351352        if (raw1394_read_cycle_timer_and_clock != NULL) { 
    352353            err = raw1394_read_cycle_timer_and_clock(m_util_handle, &cycle_timer, &local_time, CLOCK_MONOTONIC_RAW); 
    353             if (!err
     354            if (!err && Util::SystemTimeSource::setSource(CLOCK_MONOTONIC_RAW)==true
    354355                m_have_read_ctr_and_clock = true; 
    355356        } 
    356357 
    357         if (m_have_read_ctr_and_clock) 
    358             debugOutput(DEBUG_LEVEL_VERBOSE, "This system supports the raw1394_read_cycle_timer_and_clock call, using it.\n"); 
    359         else { 
     358        if (m_have_read_ctr_and_clock) { 
     359            debugOutput(DEBUG_LEVEL_VERBOSE, "This system supports the raw1394_read_cycle_timer_and_clock call and the\n"); 
     360            debugOutput(DEBUG_LEVEL_VERBOSE, "CLOCK_MONOTONIC_RAW clock source; using them.\n"); 
     361        } else { 
    360362            debugOutput(DEBUG_LEVEL_VERBOSE, "This system supports the raw1394_read_cycle_timer call, using it.\n"); 
    361             debugOutput(DEBUG_LEVEL_NORMAL, "The raw1394_read_cycle_timer_and_clock call is not available.\n"); 
     363            debugOutput(DEBUG_LEVEL_NORMAL, "The raw1394_read_cycle_timer_and_clock call and/or the CLOCK_MONOTONIC_RAW\n"); 
     364            debugOutput(DEBUG_LEVEL_NORMAL, "clock source is not available.\n"); 
    362365            debugOutput(DEBUG_LEVEL_NORMAL, "Fallback to raw1394_read_cycle_timer.\n"); 
    363366            debugOutput(DEBUG_LEVEL_NORMAL, "FFADO may be susceptible to NTP-induced clock discontinuities.\n"); 
    364             debugOutput(DEBUG_LEVEL_NORMAL, "Upgrade libraw1394 to version 2.1.0 or later if this is an issue.\n"); 
     367            debugOutput(DEBUG_LEVEL_NORMAL, "If this is an issue, upgrade libraw1394 to version 2.1.0 or later and/or\n"); 
     368            debugOutput(DEBUG_LEVEL_NORMAL, "kernel 2.6.28 or later.\n"); 
    365369        } 
    366370    } 
     
    538542    if (m_have_read_ctr_and_clock) { 
    539543        int err; 
    540         err = raw1394_read_cycle_timer_and_clock(m_util_handle, cycle_timer, local_time, CLOCK_MONOTONIC_RAW); 
     544        err = raw1394_read_cycle_timer_and_clock(m_util_handle, cycle_timer, local_time,  
     545                  Util::SystemTimeSource::getSource()); 
    541546        if(err) { 
    542547            debugWarning("raw1394_read_cycle_timer_and_clock: %s\n", strerror(err)); 
  • trunk/libffado/src/libieee1394/IsoHandlerManager.cpp

    r2076 r2171  
    398398    int result; 
    399399 
    400     if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { 
     400    if (Util::SystemTimeSource::clockGettime(&ts) == -1) { 
    401401        debugError("clock_gettime failed\n"); 
    402402        return eAR_Error;