Commit 56bd6d87 authored by norvell's avatar norvell
Browse files

Added code for analyzing allocated memory in MATLAB

parent 34c6b03f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1480,6 +1480,9 @@ static ivas_error decodeG192(
        }
#ifdef WMOPS
        update_wmops();
#endif
#ifdef RAM_ANALYSIS
        mem_analyze();
#endif
    }

@@ -1836,6 +1839,9 @@ static ivas_error decodeVoIP(

#ifdef WMOPS
        update_wmops();
#endif
#ifdef RAM_ANALYSIS
        mem_analyze();
#endif
    }

+3 −0
Original line number Diff line number Diff line
@@ -742,6 +742,9 @@ int main(

#ifdef WMOPS
        update_wmops();
#endif
#ifdef RAM_ANALYSIS
        mem_analyze();
#endif
    }

+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@

#define SUPPORT_JBM_TRACEFILE                   /* support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
#define RAM_COUNTING_TOOL                       /* tool to automatically count the dynamically alocated static memory consumption */
#define RAM_ANALYSIS

/* #################### End compiler switches ######################### */

+24 −0
Original line number Diff line number Diff line
@@ -178,6 +178,10 @@ static allocation_list Missing_Allocations;
static unsigned int Num_Records_Missing_Alloc_Warnings = 0;
#endif

#ifdef RAM_ANALYSIS
static FILE *mem_analysis_file = NULL;
#endif

/*-------------------------------------------------------------------*
 * LOCAL CONST DATA
 *-------------------------------------------------------------------*/
@@ -903,4 +907,24 @@ size_t mem_count_summary( Counting_Size cnt_size )
    return size;
}

#ifdef RAM_ANALYSIS
void mem_analyze()
{
    unsigned int i;

    if ( mem_analysis_file == NULL )
    {
        mem_analysis_file = fopen( "mem_analysis.csv", "w" );
    }
    for ( i = 0; i < Num_Records_Cur_RAM; i++ )
    {
        fprintf( mem_analysis_file, "%s:%d,%d;", Current_Allocations[i].name, Current_Allocations[i].lineno, Current_Allocations[i].block_size );
    }
    fprintf( mem_analysis_file, "\n" );

    return;
}
#endif


#endif
+4 −0
Original line number Diff line number Diff line
@@ -95,6 +95,10 @@ extern "C"
    extern void *mem_alloc( const char *func_name, int func_lineno, size_t size, char *alloc_str );
    extern void mem_free( const char *func_name, int func_lineno, void *ptr );

#ifdef RAM_ANALYSIS
    extern void mem_analyze();
#endif

#ifdef __cplusplus
}
#endif
Loading