Changeset 377

Show
Ignore:
Timestamp:
01/20/07 11:03:10 (17 years ago)
Author:
wagi
Message:

libfreebobavc: output reformated so it looks nice again (debugmodule used instead of
plain printfs)
debugmodule: use stdout instead of sterr.
DebugModuleManager?: print register and unregister only in higher debug levels

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libfreebob/src/debugmodule/debugmodule.cpp

    r360 r377  
    5454DebugModule::~DebugModule() 
    5555{ 
    56     cerr << "Unregistering "  
    57          << this->getName() 
    58          << " at DebugModuleManager" 
    59          << endl; 
     56    if ( m_level >= eDL_VeryVerbose ) { 
     57        cout << "Unregistering " 
     58             << this->getName() 
     59             << " at DebugModuleManager" 
     60             << endl; 
     61    } 
    6062    if ( !DebugModuleManager::instance()->unregisterModule( *this ) ) { 
    6163        cerr << "Could not unregister DebugModule at DebugModuleManager" 
    6264             << endl; 
    6365    } 
    64      
     66 
    6567} 
    6668 
     
    7981 
    8082    DebugModuleManager::instance()->va_print( format, arg ); 
    81      
     83 
    8284    va_end( arg ); 
    8385} 
     
    175177        if (mb_initialized) 
    176178                return true; 
    177                  
    178         fprintf(stderr, "DebugModuleManager init...\n"); 
     179 
     180        // if ( m_level >= eDL_VeryVerbose ) 
     181        //         cout << "DebugModuleManager init..." << endl; 
    179182 
    180183        pthread_mutex_init(&mb_write_lock, NULL); 
     
    255258        /* called WITHOUT the mb_write_lock */ 
    256259        while (mb_outbuffer != mb_inbuffer) { 
    257                 fputs(mb_buffers[mb_outbuffer], stderr); 
     260                fputs(mb_buffers[mb_outbuffer], stdout); 
    258261                mb_outbuffer = MB_NEXT(mb_outbuffer); 
    259262        } 
     
    265268 
    266269    DebugModuleManager *m=static_cast<DebugModuleManager *>(arg); 
    267      
     270 
    268271        /* The mutex is only to eliminate collisions between multiple 
    269272         * writer threads and protect the condition variable. */ 
     
    272275        while (m->mb_initialized) { 
    273276                pthread_cond_wait(&m->mb_ready_cond, &m->mb_write_lock); 
    274   
     277 
    275278                /* releasing the mutex reduces contention */ 
    276279                pthread_mutex_unlock(&m->mb_write_lock); 
     
    284287} 
    285288 
    286 void  
     289void 
    287290DebugModuleManager::print(const char *fmt, ...) 
    288291{ 
     
    315318 
    316319 
    317 void  
     320void 
    318321DebugModuleManager::va_print (const char *fmt, va_list ap) 
    319322{ 
    320323        char msg[MB_BUFFERSIZE]; 
    321          
     324 
    322325        /* format the message first, to reduce lock contention */ 
    323326        vsnprintf(msg, MB_BUFFERSIZE, fmt, ap); 
  • trunk/libfreebob/src/libfreebobavc/avc_generic.cpp

    r375 r377  
    174174 
    175175    if (getDebugLevel() >= DEBUG_LEVEL_VERY_VERBOSE) { 
    176         debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "%s:\n", getCmdName() ); 
    177         debugOutput( DEBUG_LEVEL_VERY_VERBOSE,  "  Request:"); 
     176        debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE, "%s:\n", getCmdName() ); 
     177        debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE,  "  Request:\n"); 
    178178        showFcpFrame( m_fcpFrame, fcpFrameSize ); 
    179179 
     
    181181        serialize( se_dbg ); 
    182182 
    183         debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 
     183        debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 
    184184                         se_dbg.getString().c_str()); 
    185185    } 
     
    206206            result = deserialize( de ); 
    207207 
    208             debugOutput( DEBUG_LEVEL_VERY_VERBOSE,"  Response:"); 
     208            debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE,"  Response:\n"); 
    209209            showFcpFrame( buf, de.getNrOfConsumedBytes() ); 
    210210 
     
    212212            serialize( se_dbg ); 
    213213 
    214             debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s", 
     214            debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 
    215215                             se_dbg.getString().c_str()); 
    216216        } 
     
    218218        default: 
    219219            debugWarning( "unexpected response received (0x%x)\n", m_eResponse ); 
    220             debugOutput( DEBUG_LEVEL_VERY_VERBOSE,"  Response:"); 
     220            debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE,"  Response:\n"); 
    221221 
    222222            BufferDeserialize de( buf, resp_len ); 
  • trunk/libfreebob/src/libfreebobavc/ieee1394service.cpp

    r374 r377  
    1 /* tempate.cpp 
    2  * Copyright (C) 2005 by Daniel Wagner 
     1/* ieee1394service.cpp 
     2 * Copyright (C) 2005,07 by Daniel Wagner 
    33 * 
    44 * This file is part of FreeBoB. 
     
    111111            "read: node 0x%X, addr = 0x%016X, length = %d\n", 
    112112            nodeId, addr, length); 
    113         printBuffer( length, buffer );         
     113        printBuffer( length, buffer ); 
    114114        #endif 
    115115 
     
    190190 
    191191    #ifdef DEBUG 
    192     debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "pre avc1394_transaction_block2\n" ); 
     192    debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "  pre avc1394_transaction_block2\n" ); 
    193193    printBuffer( len, buf ); 
    194194    #endif 
     
    203203 
    204204    #ifdef DEBUG 
    205     debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "post avc1394_transaction_block2\n" ); 
     205    debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "  post avc1394_transaction_block2\n" ); 
    206206    printBuffer( *resp_len, result ); 
    207207    #endif 
     
    244244                debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE,"\n"); 
    245245            } 
    246             debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE,"%4d: ",i*4); 
     246            debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE," %4d: ",i*4); 
    247247        } 
    248248        debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE,"%08X ",buffer[i]);