Commit f2b86034 authored by Vidhya V P's avatar Vidhya V P
Browse files

Merge branch 'main' into 114-bitrate-switching-in-sba-PLC-fix

parents 88e7712e e4096752
Loading
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -1505,9 +1505,7 @@ static ivas_error decodeG192(
        }
#ifdef WMOPS
        update_wmops();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
        update_mem();
#endif
    }

@@ -1978,9 +1976,7 @@ static ivas_error decodeVoIP(

#ifdef WMOPS
        update_wmops();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
        update_mem();
#endif
    }

+1 −3
Original line number Diff line number Diff line
@@ -717,9 +717,7 @@ int main(

#ifdef WMOPS
        update_wmops();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
        update_mem();
#endif
    }

+1 −3
Original line number Diff line number Diff line
@@ -999,9 +999,7 @@ int main(

#ifdef WMOPS
        update_wmops();
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
        update_mem();
#endif
    }

+41 −45
Original line number Diff line number Diff line
@@ -341,12 +341,6 @@ void update_wmops( void )

    start_cnt = ops_cnt;

    if ( heap_allocation_call_tree_size > 0 )
    {
        /* update intra-frame heap memory and inter-frame heap memory*/
        update_mem();
    }

    /* increment frame counter */
    update_cnt++;

@@ -554,6 +548,11 @@ void print_wmops( void )
#define ROUND_BLOCK_SIZE( n ) ( ( ( n ) + BLOCK_ROUNDING - 1 ) & ~( BLOCK_ROUNDING - 1 ) )
#define IS_CALLOC( str )      ( str[0] == 'c' )

#ifdef MEM_COUNT_DETAILS
const char *csv_filename = "mem_analysis.csv";
static FILE *fid_csv_filename = NULL;
#endif

typedef struct
{
    char function_name[MAX_FUNCTION_NAME_LENGTH + 1];
@@ -688,6 +687,25 @@ void reset_mem( Counting_Size cnt_size )
    size_wc_inter_frame_heap = 0;
    location_wc_inter_frame_heap = -1;

#ifdef MEM_COUNT_DETAILS
    /* Check, if the .csv file has already been opened */
    if ( fid_csv_filename == NULL )
    {
        fid_csv_filename = fopen( csv_filename, "wb" );

        if ( fid_csv_filename == NULL )
        {
            fprintf( stderr, "\nCannot open %s!\n\n", csv_filename );
            exit( -1 );
        }
    }
    else
    {
        /* reset file */
        rewind( fid_csv_filename );
    }
#endif

    return;
}

@@ -960,6 +978,11 @@ void *mem_alloc(
    ptr_record->block_size = size;
    ptr_record->total_block_size += size;

#ifdef MEM_COUNT_DETAILS
    /* Export heap memory allocation record to the .csv file */
    fprintf( fid_csv_filename, "A,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
#endif

    if ( ptr_record->frame_allocated != -1 )
    {
        fprintf( stderr, "Fct=%s, Ln=%i: %s!\n", func_name, func_lineno, "Error: Attempt to Allocate the Same Memory Block with Freeing it First!" );
@@ -1295,6 +1318,11 @@ void mem_free( const char *func_name, int func_lineno, void *ptr )
    /* Check, if Out-Of-Bounds Access has been Detected */
    ptr_record->OOB_Flag = mem_check_OOB( ptr_record );

#ifdef MEM_COUNT_DETAILS
    /* Export heap memory de-allocation record to the .csv file */
    fprintf( fid_csv_filename, "D,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
#endif

    /* De-Allocate Memory Block */
    tmp_ptr = (char *) ptr;
    tmp_ptr -= BLOCK_ROUNDING;
@@ -1713,45 +1741,6 @@ static void mem_count_summary( void )
    return;
}

/*-------------------------------------------------------------------*
 * export_mem()
 *
 * Export detailed (per-item) information about heap memory usage to a .csv file
 *--------------------------------------------------------------------*/

void export_mem( const char *csv_filename )
{
    int i;
    static FILE *fid = NULL;
    allocator_record *record_ptr;

    if ( csv_filename == NULL || strcmp( csv_filename, "" ) == 0 )
    {
        return;
    }

    /* Check, if the .csv file has already been opened */
    if ( fid == NULL )
    {
        fid = fopen( csv_filename, "wb" );

        if ( fid == NULL )
        {
            fprintf( stderr, "\nCannot open %s!\n\n", csv_filename );
            exit( -1 );
        }
    }

    /* Export individual heap memory records to a .csv file */
    for ( i = 0; i < Num_Records; i++ )
    {
        record_ptr = &( allocation_list[i] );
        fprintf( fid, "%s:%d,%d;", record_ptr->name, record_ptr->lineno, record_ptr->block_size );
    }
    fprintf( fid, "\n" );

    return;
}
#endif

/*-------------------------------------------------------------------*
@@ -1902,6 +1891,13 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
        free( list_wc_inter_frame_heap );
    }

#ifdef MEM_COUNT_DETAILS
    if ( fid_csv_filename != NULL )
    {
        fclose( fid_csv_filename );
    }
#endif

    return;
}

+0 −4
Original line number Diff line number Diff line
@@ -1007,9 +1007,6 @@ void mem_free( const char *func_name, int func_lineno, void *ptr );

void reset_mem( Counting_Size cnt_size );
void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] );
#ifdef MEM_COUNT_DETAILS
void export_mem( const char *csv_filename );
#endif

int push_stack( const char *filename, const char *fctname );
int pop_stack( const char *filename, const char *fctname );
@@ -1031,7 +1028,6 @@ void reset_stack( void );
#define free_( ptr )      free( ptr )
#define reset_mem( cnt_size )
#define print_mem( Const_Data_PROM_Table )
#define export_mem( csv_filename )

#define push_stack( file, fct )
#define pop_stack( file, fct )
Loading