Changeset 266

Show
Ignore:
Timestamp:
06/17/06 07:15:54 (16 years ago)
Author:
pieterpalmers
Message:

- temporary commit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libfreebob-2.0/src/debugmodule/debugmodule.h

    r244 r266  
    9494 
    9595#ifdef DEBUG 
    96  
     96     
    9797    #define debugOutput( level, format, args... )                  \ 
    9898                m_debugModule.print( level,                        \ 
     
    114114 
    115115#endif 
     116 
     117/* Enable preemption checking for Linux Realtime Preemption kernels. 
     118 * 
     119 * This checks if any RT-safe code section does anything to cause CPU 
     120 * preemption.  Examples are sleep() or other system calls that block. 
     121 * If a problem is detected, the kernel writes a syslog entry, and 
     122 * sends SIGUSR2 to the client. 
     123 */ 
     124 
     125#define DO_PREEMPTION_CHECKING 
     126 
     127#include <sys/time.h> 
     128  
     129#ifdef DO_PREEMPTION_CHECKING 
     130#define CHECK_PREEMPTION(onoff) \ 
     131        gettimeofday (1, (onoff)) 
     132#else 
     133#define CHECK_PREEMPTION(engine, onoff) 
     134#endif 
     135 
     136// Intel recommends that a serializing instruction  
     137// should be called before and after rdtsc.  
     138// CPUID is a serializing instruction.  
     139#define read_rdtsc(time) \ 
     140        __asm__ __volatile__( \ 
     141        "pushl %%ebx\n\t" \ 
     142        "cpuid\n\t" \ 
     143        "rdtsc\n\t" \ 
     144        "mov %%eax,(%0)\n\t" \ 
     145        "cpuid\n\t" \ 
     146        "popl %%ebx\n\t" \ 
     147        : /* no output */ \ 
     148        : "S"(&time) \ 
     149        : "eax", "ecx", "edx", "memory") 
     150 
     151static inline unsigned long debugGetCurrentTSC() { 
     152    unsigned retval; 
     153    read_rdtsc(retval); 
     154    return retval; 
     155} 
    116156 
    117157unsigned char toAscii( unsigned char c ); 
  • branches/libfreebob-2.0/src/libstreaming/AmdtpStreamProcessor.cpp

    r265 r266  
    4343// this is one milisecond of processing delay 
    4444#define TICKS_PER_SECOND 24576000 
    45 #define RECEIVE_PROCESSING_DELAY (TICKS_PER_SECOND * 1/1000) 
     45#define RECEIVE_PROCESSING_DELAY (TICKS_PER_SECOND * 2/1000) 
     46#define TRANSMIT_PROCESSING_DELAY RECEIVE_PROCESSING_DELAY 
    4647 
    4748namespace FreebobStreaming { 
     
    9192                      unsigned char *tag, unsigned char *sy, 
    9293                      int cycle, unsigned int dropped, unsigned int max_length) { 
    93  
     94     
    9495        struct iec61883_packet *packet = (struct iec61883_packet *) data; 
    9596        unsigned int nevents=0; 
    9697         
     98        unsigned long in_time=debugGetCurrentTSC(); 
     99         
    97100    packet->eoh0 = 0; 
    98  
     101     
     102#ifdef DEBUG 
     103    if(dropped>0) { 
     104        debugWarning("Dropped %d packets on cycle %d\n",dropped, cycle); 
     105    } 
     106#endif 
     107     
    99108    /* Our node ID can change after a bus reset, so it is best to fetch 
    100109     * our node ID for each packet. */ 
     
    128137                *tag = IEC61883_TAG_WITH_CIP; 
    129138                *sy = 0; 
    130                 return RAW1394_ISO_OK; 
     139         
     140                return RAW1394_ISO_DEFER; 
    131141        } 
    132142     
    133143    packet->fdf = m_fdf; 
    134144         
    135     debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "get packet...\n"); 
     145//     assert(m_handler->getDroppedCount()<5); 
     146         
     147//     debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "get packet...\n"); 
    136148         
    137149        // construct the packet cip 
     
    159171         
    160172    // FIXME: if m_last_bufferfill > 0 
    161     double ticks_per_frame=syncmaster->getTicksPerFrame()
     173    int ticks_per_frame=syncmaster->getTicksPerFrame()*1024
    162174 
    163175    // m_last_timestamp is the moment upon which the last 'period signal'   
     
    172184    // therefore the last sample of the xmit buffer lies at  
    173185    // T1 = timestamp + (nb_buffers * period) * ticks_per_frame 
    174     int T1 = m_last_timestamp + (m_nb_buffers * m_period) * ticks_per_frame
     186    int T1 = m_last_timestamp + (m_nb_buffers * m_period) * ticks_per_frame/1024
    175187     
    176188    // in reality however life is multithreaded, and we don't know 
     
    183195    int buffer_fill=freebob_ringbuffer_read_space(m_event_buffer)/m_dimension/sizeof(quadlet_t); 
    184196     
    185     int T2 = T1 - buffer_fill * ticks_per_frame
     197    int T2 = T1 - buffer_fill * (ticks_per_frame/1024)
    186198     
    187199    // normally:  nb_buffers * period > nb_frames_in_buffer 
     
    200212    // we therefore need to advance the timestamp with the equivalent of  
    201213    // 600 frames (600*ticks_per_frame) 
    202     int T3 = T2 + (m_handler->getBuffersize() * m_framerate * ticks_per_frame) / 8000; 
     214    int T3 = T2 + (m_handler->getBuffersize() * m_framerate * ticks_per_frame/1024) / 8000; 
    203215     
    204216    // we then need to add the processing delay for the receiving 
     
    223235    int TSEND = T3; 
    224236     
     237    // the xmit timestamp should then be the TSEND + PROCESSING_DELAY 
     238    int timestamp = TSEND + TRANSMIT_PROCESSING_DELAY; 
     239     
    225240    // if we take a look at TSEND we can determine if we are to send 
    226241    // the sample or not: 
     
    239254    if (cycle_wo_wraparound - (TSEND/3072) < -4000) { 
    240255        cycle_wo_wraparound +=8000; 
    241         debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"wraparound detected: %d %d %d\n",cycle, cycle_wo_wraparound, cycle - (TSEND/3072)); 
    242     } 
    243      
     256//         debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"wraparound detected: %d %d %d\n",cycle, cycle_wo_wraparound, cycle - (TSEND/3072)); 
     257    } 
     258   
    244259    if (TSEND < cycle_wo_wraparound*3072) { 
    245260        nevents=m_syt_interval; 
    246261        m_dbc += m_syt_interval; 
     262#ifdef DEBUG 
     263        if(timestamp<cycle_wo_wraparound*3072) { 
     264            unsigned int tmpsyt_cycles=timestamp/3072; 
     265            unsigned int tmpsyt_ticks=timestamp%3072; 
     266            unsigned int tmpsyt = (tmpsyt_cycles << 12) | tmpsyt_ticks; 
     267         
     268            debugWarning("Timestamp for cycle %d lies %d ticks in the past: %2u cycles + %04u ticks!\n",  
     269                cycle, cycle_wo_wraparound*3072-timestamp, 
     270                CYCLE_COUNTER_GET_CYCLES(tmpsyt), 
     271                CYCLE_COUNTER_GET_TICKS(tmpsyt)); 
     272        } 
     273#endif 
     274         
    247275    } else { // no-data 
     276   
    248277           // no-data packets have syt=0xFFFF 
    249278           // and have the usual amount of events as dummy data  
     
    258287                *sy = 0; 
    259288                 
    260                 debugOutput(DEBUG_LEVEL_VERBOSE,"Sending empty packet\n"); 
    261  
    262                 return RAW1394_ISO_OK; 
    263     } 
    264      
    265     // the xmit timestamp should then be the TSEND + PROCESSING_DELAY 
    266     int timestamp = TSEND + 3*3072; 
    267  
    268     debugOutput(DEBUG_LEVEL_VERBOSE,"Now=%4d/%8d, Tstamp=%8d, DT=%8d, T2=%8d, T3=%8d, last TS=%d, BF=%d\n", 
    269         cycle,(cycle*3072), 
    270         timestamp, 
    271         timestamp-(cycle*3072), 
    272         T2,T3, 
    273         m_last_timestamp, 
    274         buffer_fill); 
     289        if(packet->dbs) { 
     290//             debugOutput(DEBUG_LEVEL_VERY_VERBOSE,  
     291//                 "XMT %04d: CH = %d, FDF = %X. SYT = %6d, DBS = %3d, DBC = %3d, FMT = %3d, LEN = %4d (%2d)\n",  
     292//                 cycle, m_channel, packet->fdf, 
     293//                 packet->syt, 
     294//                 packet->dbs, 
     295//                 packet->dbc, 
     296//                 packet->fmt,  
     297//                 *length, 
     298//                 ((*length / sizeof (quadlet_t)) - 2)/packet->dbs); 
     299        } 
     300         
     301                debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Sending empty packet on cycle %d\n", cycle); 
     302         
     303        // FIXME: this is to prevent libraw to do loop over too 
     304        //        much packets at once (overflowing the receive side) 
     305        //        but putting it here is a little arbitrary 
     306         
     307     
     308                return RAW1394_ISO_DEFER; 
     309    } 
     310     
     311 
     312//     debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Now=%4d/%8d, Tstamp=%8d, DT=%8d, T2=%8d, T3=%8d, last TS=%d, BF=%d\n", 
     313//         cycle,(cycle*3072), 
     314//         timestamp, 
     315//         timestamp-(cycle*3072), 
     316//         T2,T3, 
     317//         m_last_timestamp, 
     318//         buffer_fill); 
    275319     
    276320        enum raw1394_iso_disposition retval = RAW1394_ISO_OK; 
     
    315359        packet->syt = ntohs(timestamp_cyclecounter & 0xffff); 
    316360         
    317         debugOutput(DEBUG_LEVEL_VERBOSE,"XMIT %d EVENTS, SYT %04X for cycle %2d: %08d (%2u cycles + %04u ticks)\n", 
    318           nevents, timestamp_cyclecounter & 0xFFFF, cycle, 
    319           CYCLE_COUNTER_TO_TICKS(timestamp_cyclecounter), 
    320           CYCLE_COUNTER_GET_CYCLES(timestamp_cyclecounter), 
    321           CYCLE_COUNTER_GET_TICKS(timestamp_cyclecounter) 
    322           ); 
     361//         debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"XMIT %d EVENTS, SYT %04X for cycle %2d: %08d (%2u cycles + %04u ticks)\n", 
     362//           nevents, timestamp_cyclecounter & 0xFFFF, cycle, 
     363//           CYCLE_COUNTER_TO_TICKS(timestamp_cyclecounter), 
     364//           CYCLE_COUNTER_GET_CYCLES(timestamp_cyclecounter), 
     365//           CYCLE_COUNTER_GET_TICKS(timestamp_cyclecounter) 
     366//           ); 
    323367    } 
    324368     
     
    329373    incrementFrameCounter(nevents); 
    330374     
    331     if(m_framecounter>m_period) { 
     375/*    if(m_framecounter>m_period) { 
    332376       retval=RAW1394_ISO_DEFER; 
    333     } 
     377    }*/ 
    334378     
    335379#ifdef DEBUG 
    336     if(packet->dbs) { 
    337         debugOutput(DEBUG_LEVEL_VERY_VERBOSE,  
    338             "XMT: CH = %d, FDF = %X. SYT = %6d, DBS = %3d, DBC = %3d, FMT = %3d, LEN = %4d (%2d)\n",  
    339             m_channel, packet->fdf, 
    340             packet->syt, 
    341             packet->dbs, 
    342             packet->dbc, 
    343             packet->fmt,  
    344             *length, 
    345             ((*length / sizeof (quadlet_t)) - 2)/packet->dbs); 
    346     } 
     380//     if(packet->dbs) { 
     381//         debugOutput(DEBUG_LEVEL_VERY_VERBOSE,  
     382//             "XMT %04d: CH = %d, FDF = %X. SYT = %6d, DBS = %3d, DBC = %3d, FMT = %3d, LEN = %4d (%2d)\n",  
     383//             cycle, m_channel, packet->fdf, 
     384//             packet->syt, 
     385//             packet->dbs, 
     386//             packet->dbc, 
     387//             packet->fmt,  
     388//             *length, 
     389//             ((*length / sizeof (quadlet_t)) - 2)/packet->dbs); 
     390//     } 
    347391#endif 
    348392 
    349     m_PacketStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/(4*m_dimension)); 
    350          
     393    m_PacketStat.mark(debugGetCurrentTSC()-in_time); 
     394//     m_PacketStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/(4*m_dimension)); 
     395//      debugOutput(DEBUG_LEVEL_VERBOSE, "XMIT took: %d\n",debugGetCurrentTSC()-in_time); 
    351396    return retval; 
    352397 
     
    360405    int recv_bufferspace=freebob_ringbuffer_read_space(syncmaster->m_event_buffer)/syncmaster->m_dimension/4; 
    361406     
    362     debugOutput(DEBUG_LEVEL_VERBOSE,"XMT: %5d | RCV: %5d | DIFF: %5d | SUM: %5d \n", xmit_bufferspace, recv_bufferspace, xmit_bufferspace - recv_bufferspace, xmit_bufferspace + recv_bufferspace); 
     407    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"XMT: %5d | RCV: %5d | DIFF: %5d | SUM: %5d \n", xmit_bufferspace, recv_bufferspace, xmit_bufferspace - recv_bufferspace, xmit_bufferspace + recv_bufferspace); 
    363408#endif 
    364409 
     
    9921037    struct iec61883_packet *packet = (struct iec61883_packet *) data; 
    9931038    assert(packet); 
     1039        unsigned long in_time=debugGetCurrentTSC(); 
     1040 
     1041#ifdef DEBUG 
     1042    if(dropped>0) { 
     1043        debugWarning("Dropped %d packets on cycle %d\n",dropped, cycle); 
     1044    } 
     1045#endif 
    9941046     
    9951047    // how are we going to get this right??? 
    9961048//     m_running=true; 
    9971049     
    998     if((packet->fmt == 0x10) && (packet->fdf != 0xFF) && (packet->dbs>0) && (length>=2*sizeof(quadlet_t))) { 
     1050    if((packet->fmt == 0x10) && (packet->fdf != 0xFF) && (packet->syt != 0xFFFF) && (packet->dbs>0) && (length>=2*sizeof(quadlet_t))) { 
    9991051        unsigned int nevents=((length / sizeof (quadlet_t)) - 2)/packet->dbs; 
    10001052         
     
    10041056        // don't process the stream when it is not enabled. 
    10051057        if(m_disabled) { 
    1006             return RAW1394_ISO_OK
     1058            return RAW1394_ISO_DEFER
    10071059        } 
    10081060        debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "put packet...\n"); 
     
    10821134                    // implement a 1st order DLL to estimate the framerate 
    10831135                    // this is the number of ticks between two samples 
    1084                     double f=timestamp_difference; 
    1085                     double err = timestamp_difference / m_syt_interval; 
     1136                    float f=timestamp_difference; 
     1137                    float err = timestamp_difference / m_syt_interval; 
    10861138                    // now it contains the error between our estimate 
    10871139                    // and the current measurement 
     
    11011153#endif 
    11021154 
    1103                     const double coeff=0.0005; 
     1155                    const float coeff=0.0005; 
    11041156                    // integrate the error 
    11051157                    m_ticks_per_frame += coeff*err; 
     
    11071159                } 
    11081160                 
    1109                  debugOutput(DEBUG_LEVEL_VERBOSE,"R-SYT for cycle (%2d %2d)=>%2d: %5uT (%04uC + %04uT) %04X %04X %d\n", 
     1161                 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"R-SYT for cycle (%2d %2d)=>%2d: %5uT (%04uC + %04uT) %04X %04X %d\n", 
    11101162                 cycle,now_cycle_masked,delta_cycles, 
    11111163                 CYCLE_COUNTER_TO_TICKS(m_last_timestamp), 
     
    11341186        if(packet->dbs) { 
    11351187            debugOutput(DEBUG_LEVEL_VERY_VERBOSE,  
    1136                 "RCV: CH = %d, FDF = %X. SYT = %6d, DBS = %3d, DBC = %3d, FMT = %3d, LEN = %4d (%2d)\n",  
    1137                 channel, packet->fdf, 
     1188                "RCV %04d: CH = %d, FDF = %X. SYT = %6d, DBS = %3d, DBC = %3d, FMT = %3d, LEN = %4d (%2d)\n",  
     1189                cycle, channel, packet->fdf, 
    11381190                packet->syt, 
    11391191                packet->dbs, 
     
    11551207        // discard packet 
    11561208        // can be important for sync though 
    1157     } 
    1158      
    1159     m_PacketStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/(4*m_dimension)); 
     1209         
     1210        // FIXME: this is to prevent libraw to do loop over too 
     1211        //        much packets at once (draining the xmit side) 
     1212        //        but putting it here is a little arbitrary 
     1213        retval=RAW1394_ISO_DEFER; 
     1214    } 
     1215     
     1216    m_PacketStat.mark(debugGetCurrentTSC()-in_time); 
     1217     
     1218//     m_PacketStat.mark(freebob_ringbuffer_read_space(m_event_buffer)/(4*m_dimension)); 
    11601219     
    11611220    return retval; 
  • branches/libfreebob-2.0/src/libstreaming/AmdtpStreamProcessor.h

    r263 r266  
    192192        unsigned int getMaxPacketSize() {return 4 * (2 + m_syt_interval * m_dimension);};  
    193193 
    194     double getTicksPerFrame() {return m_ticks_per_frame;}; 
     194    float getTicksPerFrame() {return m_ticks_per_frame;}; 
    195195    unsigned int getPeriodTimeStamp() {return m_last_timestamp_at_period_ticks;}; 
    196196 
     
    213213    unsigned int m_last_timestamp_at_period_ticks; 
    214214     
    215     double m_ticks_per_frame; 
     215    float m_ticks_per_frame; 
    216216     
    217217    DECLARE_DEBUG_MODULE; 
  • branches/libfreebob-2.0/src/libstreaming/IsoHandlerManager.cpp

    r244 r266  
    5757} 
    5858 
     59// Intel recommends that a serializing instruction  
     60// should be called before and after rdtsc.  
     61// CPUID is a serializing instruction.  
     62#define read_rdtsc(time) \ 
     63        __asm__ __volatile__( \ 
     64        "pushl %%ebx\n\t" \ 
     65        "cpuid\n\t" \ 
     66        "rdtsc\n\t" \ 
     67        "mov %%eax,(%0)\n\t" \ 
     68        "cpuid\n\t" \ 
     69        "popl %%ebx\n\t" \ 
     70        : /* no output */ \ 
     71        : "S"(&time) \ 
     72        : "eax", "ecx", "edx", "memory") 
     73 
     74static inline unsigned long debugGetCurrentUTime() { 
     75    unsigned retval; 
     76    read_rdtsc(retval); 
     77    return retval; 
     78} 
    5979 
    6080bool IsoHandlerManager::Execute() 
     
    6383        int i=0; 
    6484        debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "enter...\n"); 
     85         
     86        unsigned long tstamp=debugGetCurrentUTime(); 
    6587 
    6688        err = poll (m_poll_fds, m_poll_nfds, m_poll_timeout); 
     89         
     90//      debugOutput(DEBUG_LEVEL_VERBOSE, "Poll took: %6d\n", debugGetCurrentUTime()-tstamp); 
    6791         
    6892        if (err == -1) { 
     
    86110                        IsoHandler *s=m_IsoHandlers.at(i); 
    87111                        assert(s); 
     112                         
     113                        unsigned int packetcount_prev=s->getPacketCount(); 
     114                         
     115                        tstamp=debugGetCurrentUTime(); 
     116                         
    88117                        s->iterate(); 
     118/*                      debugOutput(DEBUG_LEVEL_VERBOSE, "Iterate %p: time: %6d | packets: %3d\n",  
     119                             s, debugGetCurrentUTime()-tstamp, s->getPacketCount()-packetcount_prev 
     120                             );*/ 
    89121                } 
    90122        } 
     
    255287                // occurs at a period boundary (optimal CPU use) 
    256288                 
    257                 // NOTE: try and use 2 hardware interrupts per period for better latency. 
    258                 unsigned int max_packet_size=2 * getpagesize() / packets_per_period; 
     289                // NOTE: try and use 4 hardware interrupts per period for better latency. 
     290                unsigned int max_packet_size=4 * getpagesize() / packets_per_period; 
    259291                if (max_packet_size < stream->getMaxPacketSize()) { 
    260292                        max_packet_size=stream->getMaxPacketSize(); 
     
    306338                unsigned int packets_per_period=stream->getPacketsPerPeriod(); 
    307339                // hardware interrupts occur when one DMA block is full, and the size of one DMA 
    308                 // block = PAGE_SIZE. Setting the max_packet_size makes sure that the HW irq is  
     340                // block = PAGE_SIZE. Setting the max_packet_size makes sure that the HW irq  
    309341                // occurs at a period boundary (optimal CPU use) 
    310                 // NOTE: try and use 2 interrupts per period for better latency. 
    311                 unsigned int max_packet_size=2 * getpagesize() / packets_per_period; 
     342                // NOTE: try and use 4 interrupts per period for better latency. 
     343                unsigned int max_packet_size=4 * getpagesize() / packets_per_period; 
    312344                if (max_packet_size < stream->getMaxPacketSize()) { 
    313345                        max_packet_size=stream->getMaxPacketSize(); 
    314346                } 
    315347                 
    316               int irq_interval=packets_per_period / 4; 
    317         if(irq_interval <= 0) irq_interval=1; 
    318  
     348              int irq_interval=packets_per_period / 4; 
     349               if(irq_interval <= 0) irq_interval=1; 
     350         
    319351                // the transmit buffer size should be as low as possible for latency.  
    320352                // note however that the raw1394 subsystem tries to keep this buffer 
  • branches/libfreebob-2.0/src/libstreaming/StreamProcessorManager.cpp

    r265 r266  
    226226        bool this_period_ready; 
    227227         
    228         debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "enter...\n"); 
     228        unsigned long tstamp_enter=debugGetCurrentTSC(); 
     229         
     230//      debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "------------- EXECUTE -----------\n"); 
     231         
    229232        if(!m_isoManager->Execute()) { 
    230233                debugFatal("Could not execute isoManager\n"); 
    231234                return false; 
    232235        } 
     236         
     237        unsigned long tstamp_iso=debugGetCurrentTSC(); 
    233238         
    234239        debugOutput( DEBUG_LEVEL_VERY_VERBOSE, " RCV PROC: "); 
     
    261266        } 
    262267        debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE, "\n"); 
     268         
     269        unsigned long tstamp_periodcheck=debugGetCurrentTSC(); 
    263270 
    264271        if(xrun_has_occured) { 
     
    293300                m_nbperiods++; 
    294301        } 
     302         
     303        unsigned long tstamp_exit=debugGetCurrentTSC(); 
     304         
     305//      debugOutput( DEBUG_LEVEL_VERBOSE, "EXECUTE TIME: ISO: %6d | PeriodCheck: %6d | FrameCounter: %6d \n", 
     306//         tstamp_iso-tstamp_enter, tstamp_periodcheck-tstamp_iso, tstamp_exit-tstamp_periodcheck 
     307//         ); 
    295308 
    296309        return true; 
  • branches/libfreebob-2.0/src/libstreaming/streamstatistics.cpp

    r243 r266  
    4040 
    4141void StreamStatistics::dumpInfo() { 
    42     printf("--- Stats for %s: min=%ld avg=%f max=%ld cnt=%ld sum=%ld\n",m_name.c_str(), 
    43         m_min,m_average,m_max,m_count,m_sum); 
     42    printf("--- Stats for %s: min=%ld avg=%f max=%ld cnt=%ld sum=%ld\n",m_name.c_str(), 
     43        m_min,m_average,m_max,m_count,m_sum); 
    4444} 
    4545 
  • branches/libfreebob-2.0/src/libutil/PosixThread.cpp

    r254 r266  
    3030#include <assert.h> 
    3131 
    32 #define debugOutput( level, format, args... ) 
    33 #define debugError( format, args... ) 
    34  
    3532namespace FreebobUtil 
    3633{ 
     34 
     35IMPL_DEBUG_MODULE( Thread, Thread, DEBUG_LEVEL_VERBOSE ); 
    3736 
    3837void* PosixThread::ThreadHandler(void* arg) 
     
    7271    if (fRealTime) { 
    7372 
    74         debugOutput( DEBUG_LEVEL_VERBOSE, "Create RT thread\n"); 
     73        debugOutput( DEBUG_LEVEL_VERBOSE, "Create RT thread with priority %d\n", fPriority); 
    7574 
    7675        /* Get the client thread to run as an RT-FIFO 
     
    8180        pthread_attr_init(&attributes); 
    8281 
    83         //if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_FIFO))) { 
     82        if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_FIFO))) { 
    8483 
    85         if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_RR))) { 
     84        //if ((res = pthread_attr_setschedpolicy(&attributes, SCHED_RR))) { 
    8685            debugError("Cannot set FIFO scheduling class for RT thread  %d %s", res, strerror(errno)); 
    8786            return -1; 
  • branches/libfreebob-2.0/src/libutil/Thread.h

    r254 r266  
    2727#ifndef __THREAD__ 
    2828#define __THREAD__ 
     29 
     30#include "../debugmodule/debugmodule.h" 
    2931 
    3032#include "Atomic.h" 
     
    8587 
    8688        virtual pthread_t GetThreadID() = 0; 
     89         
     90    protected: 
     91                DECLARE_DEBUG_MODULE; 
     92 
    8793}; 
    8894