Ignore:
Timestamp:
Dec 16, 2015, 1:03:16 PM (9 years ago)
Author:
alain
Message:

Modify instrumentation to save results on virtual disk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/mjpeg/mjpeg.c

    r741 r748  
    3131
    3232// macro to use a shared TTY
    33 #define PRINTF(...)    lock_acquire( &tty_lock ); \
    34                        giet_tty_printf(__VA_ARGS__);  \
    35                        lock_release( &tty_lock );
     33#define PRINTF(...)    do { lock_acquire( &tty_lock ); \
     34                            giet_tty_printf(__VA_ARGS__);  \
     35                            lock_release( &tty_lock ); } while(0);
    3636
    3737///////////////////////////////////////////////
     
    125125    if ( INTERACTIVE_MODE )
    126126    {
    127         PRINTF("\n[MJPEG] enter path for JPEG stream file (default is plan_48.mjpg)\n> ") 
     127        PRINTF("\n[MJPEG] enter path for JPEG stream file (default is plan_48.mjpg)\n> ");
    128128        giet_tty_gets( file_pathname , 256 );
    129129
     
    136136        else
    137137        {
    138             PRINTF("\n[MJPEG] enter image width\n> ") 
     138            PRINTF("\n[MJPEG] enter image width\n> ");
    139139            giet_tty_getw( &image_width );
    140             PRINTF("\n[MJPEG] enter image height\n> ") 
     140            PRINTF("\n[MJPEG] enter image height\n> "); 
    141141            giet_tty_getw( &image_height );
    142             PRINTF("\n") 
     142            PRINTF("\n");
    143143        }
    144144    }
     
    154154 
    155155    if ( USE_DCT_COPROC )
    156     { PRINTF("\n\n[MJPEG] stream %s / %d clusters / %d cores / DCT COPROC\n\n",
    157            file_pathname , x_size*y_size , nprocs ) }
     156    {
     157        PRINTF("\n\n[MJPEG] stream %s / %d clusters / %d cores / DCT COPROC\n\n",
     158               file_pathname , x_size*y_size , nprocs );
     159    }
    158160    else
    159     { PRINTF("\n\n[MJPEG] stream %s / %d clusters / %d cores / NO DCT COPROC\n\n",
    160            file_pathname , x_size*y_size , nprocs ) }
     161    {
     162        PRINTF("\n\n[MJPEG] stream %s / %d clusters / %d cores / NO DCT COPROC\n\n",
     163               file_pathname , x_size*y_size , nprocs );
     164    }
    161165
    162166    // compute nblocks_h & nblocks_w
     
    234238        pc = main_2_demux[n];
    235239        PRINTF(" - main_2_demux[%d]  = %x / &lock = %x / &buf = %x / size = %d\n",
    236                n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 ) 
     240               n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 );
    237241
    238242        pc = demux_2_vld_data[n];
    239243        PRINTF(" - demux_2_vld[%d] = %x / &lock = %x / &buf = %x / size = %d\n",
    240                n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 ) 
     244               n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 );
    241245
    242246        pc = vld_2_iqzz[n];
    243247        PRINTF(" - vld_2_iqzz[%d]  = %x / &lock = %x / &buf = %x / size = %d\n",
    244                n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 ) 
     248               n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 );
    245249
    246250        pc = iqzz_2_idct[n];
    247251        PRINTF(" - iqzz_2_idct[%d] = %x / &lock = %x / &buf = %x / size = %d\n",
    248                n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 ) 
     252               n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 );
    249253
    250254        pc = idct_2_libu[n];
    251255        PRINTF(" - idct_2_libu[%d] = %x / &lock = %x / &buf = %x / size = %d\n",
    252                n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 ) 
     256               n, pc, (uint32_t)&pc->lock, (uint32_t)pc->data, pc->depth<<2 );
    253257    }
    254258
     
    407411#if DEBUG_MAIN
    408412PRINTF("\nMAIN send image %d to cluster %d at cycle %d : %d bytes\n",
    409        image , cluster , giet_proctime() , bytes_count )
     413       image , cluster , giet_proctime() , bytes_count );
    410414#endif
    411415        // increment image index
     
    429433
    430434            if ( giet_pthread_join( trdid_demux[index] , NULL ) )
    431             { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for demux[%d]\n", index ) }
     435            PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for demux[%d]\n", index );
    432436
    433437            if ( giet_pthread_join( trdid_vld[index] , NULL ) )
    434             { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for vld[%d]\n", index ) }
     438            PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for vld[%d]\n", index );
    435439
    436440            if ( giet_pthread_join( trdid_iqzz[index] , NULL ) )
    437             { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for iqzz[%d]\n", index ) }
     441            PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for iqzz[%d]\n", index );
    438442
    439443            if ( USE_DCT_COPROC == 0 )
    440444            {
    441445                if ( giet_pthread_join( trdid_idct[index] , NULL ) )
    442                 { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for idct[%d]\n", index ) }
     446                PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for idct[%d]\n", index );
    443447            }
    444448
    445449            if ( giet_pthread_join( trdid_libu[index] , NULL ) )
    446             { PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for libu[%d]\n", index ) }
     450            PRINTF("\n[MJPEG ERROR] calling giet_pthread_join() for libu[%d]\n", index );
    447451
    448452            if ( USE_DCT_COPROC )
     
    459463    /////////////////////////////////////////////////////////////////////////////////////
    460464
    461     PRINTF("\n[MJPEG] Instumentation Results\n" )
     465    // display on TTY
     466    PRINTF("\n[MJPEG] Instumentation Results\n" );
    462467    for ( image = 0 ; image < MAX_IMAGES ; image++ )
    463     { PRINTF(" - Image %d : completed at cycle %d\n", image , date[image]) }
    464 
     468    PRINTF(" - Image %d : completed at cycle %d\n", image , date[image]);
     469
     470    // save on disk
     471    unsigned int fdout = giet_fat_open( "/home/mjpeg_instrumentation" , O_CREATE );
     472    if ( fdout < 0 )
     473    PRINTF("\n[MJPEG ERROR] cannot open file /home/mjpeg_instrumentation\n");
     474
     475    int ret = giet_fat_lseek( fdout, 0 , SEEK_END );
     476    if( ret < 0 )
     477    PRINTF("\n[MJPEG ERROR] cannot seek file /home/mjpeg_instrumentation\n");
     478
     479    if( USE_DCT_COPROC )
     480    {
     481        giet_fat_fprintf( fdout, "\n*** stream %s / %d clusters / %d cores / DCT COPROC\n",
     482                          file_pathname , x_size*y_size , nprocs );
     483    }
     484    else
     485    {
     486        giet_fat_fprintf( fdout, "stream %s / %d clusters / %d cores / NO DCT COPROC\n\n",
     487                          file_pathname , x_size*y_size , nprocs );
     488    }
     489    for ( image = 0 ; image < MAX_IMAGES ; image++ )
     490    {
     491        giet_fat_fprintf( fdout, " - Image %d : completed at cycle %d\n",
     492                          image , date[image]);
     493    }
     494
     495    // completed
    465496    giet_pthread_exit( "main completed" );
    466497   
Note: See TracChangeset for help on using the changeset viewer.