Changeset 769 for soft


Ignore:
Timestamp:
Jan 20, 2016, 10:17:45 AM (8 years ago)
Author:
alain
Message:

Use the giet_fat_fprintf() system call to save instrumentation results on disk.

File:
1 edited

Legend:

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

    r764 r769  
    1 ///////////////////////////////////////////////////////////////////////////////////////
     1//////////////////////////////////////////////////////////////////////////////////////////
    22// File   : transpose.c   
    33// Date   : september 2015
    44// author : Alain Greiner
    5 ///////////////////////////////////////////////////////////////////////////////////////
     5//////////////////////////////////////////////////////////////////////////////////////////
    66// This multi-threaded aplication read a raw image (one byte per pixel)
    77// stored on disk, transpose it, display the result on the frame buffer,
     
    2727// a part of the transposed image to the frame buffer.
    2828//
    29 // - The image size must fit the frame buffer size.
    30 // - The block size in block device must be 512 bytes.
     29// - The image size must fit the frame buffer width and height, that must be power of 2.
    3130// - The number of clusters  must be a power of 2 no larger than 256.
    3231// - The number of processors per cluster must be a power of 2 no larger than 4.
     
    3635// The transpose_rw.c file contains a variant that use the giet_fat_read()
    3736// and giet_fat_write() system calls, to access the files.
    38 ///////////////////////////////////////////////////////////////////////////////////////
     37//////////////////////////////////////////////////////////////////////////////////////////
    3938
    4039#include "stdio.h"
     
    5251#define OUTPUT_FILE_PATH      "/home/lena_transposed.raw"  // default output file pathname
    5352#define INTERACTIVE           0                            // interactive capture of filenames
    54 #define VERBOSE               0                            // print comments on TTY
     53#define VERBOSE               1                            // print comments on TTY
    5554
    5655
     
    144143        }
    145144                 
    146         if TRANSPOSE_DEBUG
    147         printf("\n@@@ Thread[%d,%d,%d] call mmap : length = %x / offset = %x / buf_in = %x\n",
     145        if ( VERBOSE )
     146        printf("\n@@@ Thread[%d,%d,%d] call mmap for input file\n"
     147               " length = %x / offset = %x / buf_in = %x\n",
    148148               x_id , y_id , p_id , length , offset , buf_in[cluster_id] );
    149149           
     
    161161        }
    162162                   
    163         if TRANSPOSE_DEBUG
    164         printf("\n@@@ Thread[%d,%d,%d] call mmap : length = %x / offset = %x / buf_out = %x\n",
     163        if ( VERBOSE )
     164        printf("\n@@@ Thread[%d,%d,%d] call mmap for output file\n"
     165               " length = %x / offset = %x / buf_out = %x\n",
    165166               x_id , y_id , p_id , length , offset , buf_out[cluster_id] );
    166167       
     
    273274    unsigned int min_disp_ended = 0xFFFFFFFF;
    274275    unsigned int max_disp_ended = 0;
     276 
     277    // open instrumentation file
     278    unsigned int fd = giet_fat_open( "/home/transpose.inst" , O_CREATE );
     279    if ( fd < 0 )
     280    {
     281        printf("\n[TRANSPOSE ERROR] main cannot open file transpose.inst\n");
     282        giet_pthread_exit( NULL );
     283    }
    275284
    276285    for (x = 0; x < x_size; x++)
     
    301310           min_load_start, max_load_start, (min_load_start+max_load_start)/2,
    302311           max_load_start-min_load_start);
     312    giet_fat_fprintf( fd , " - MMAP_START : min = %d / max = %d / med = %d / delta = %d\n",
     313           min_load_start, max_load_start, (min_load_start+max_load_start)/2,
     314           max_load_start-min_load_start);
    303315
    304316    printf(" - MMAP_END   : min = %d / max = %d / med = %d / delta = %d\n",
    305317           min_load_ended, max_load_ended, (min_load_ended+max_load_ended)/2,
    306318           max_load_ended-min_load_ended);
     319    giet_fat_fprintf( fd , " - MMAP_END   : min = %d / max = %d / med = %d / delta = %d\n",
     320           min_load_ended, max_load_ended, (min_load_ended+max_load_ended)/2,
     321           max_load_ended-min_load_ended);
    307322
    308323    printf(" - TRSP_START : min = %d / max = %d / med = %d / delta = %d\n",
    309324           min_trsp_start, max_trsp_start, (min_trsp_start+max_trsp_start)/2,
    310325           max_trsp_start-min_trsp_start);
     326    giet_fat_fprintf( fd , " - TRSP_START : min = %d / max = %d / med = %d / delta = %d\n",
     327           min_trsp_start, max_trsp_start, (min_trsp_start+max_trsp_start)/2,
     328           max_trsp_start-min_trsp_start);
    311329
    312330    printf(" - TRSP_END   : min = %d / max = %d / med = %d / delta = %d\n",
    313331           min_trsp_ended, max_trsp_ended, (min_trsp_ended+max_trsp_ended)/2,
    314332           max_trsp_ended-min_trsp_ended);
     333    giet_fat_fprintf( fd , " - TRSP_END   : min = %d / max = %d / med = %d / delta = %d\n",
     334           min_trsp_ended, max_trsp_ended, (min_trsp_ended+max_trsp_ended)/2,
     335           max_trsp_ended-min_trsp_ended);
    315336
    316337    printf(" - DISP_START : min = %d / max = %d / med = %d / delta = %d\n",
    317338           min_disp_start, max_disp_start, (min_disp_start+max_disp_start)/2,
    318339           max_disp_start-min_disp_start);
     340    giet_fat_fprintf( fd , " - DISP_START : min = %d / max = %d / med = %d / delta = %d\n",
     341           min_disp_start, max_disp_start, (min_disp_start+max_disp_start)/2,
     342           max_disp_start-min_disp_start);
    319343
    320344    printf(" - DISP_END   : min = %d / max = %d / med = %d / delta = %d\n",
    321345           min_disp_ended, max_disp_ended, (min_disp_ended+max_disp_ended)/2,
    322346           max_disp_ended-min_disp_ended);
     347    giet_fat_fprintf( fd , " - DISP_END   : min = %d / max = %d / med = %d / delta = %d\n",
     348           min_disp_ended, max_disp_ended, (min_disp_ended+max_disp_ended)/2,
     349           max_disp_ended-min_disp_ended);
     350
     351    giet_fat_close( fd );
    323352
    324353}  // end instrument()
Note: See TracChangeset for help on using the changeset viewer.