Commit 094a06f8 authored by malenov's avatar malenov
Browse files

revised memory printout

parent b9da8349
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -50,15 +50,14 @@
#ifndef RELEASE
#define DEBUGGING                              /* Activate debugging part of the code */
#endif
#define WMOPS                               /* Activate complexity and memory counters (! the codec must be already instrumented with the WMC Tool (use /ic and /op options) !) */
#define WMOPS                                   /* Activate complexity and memory counters */
/*#define WMOPS_PER_FRAME*/                     /* Output complexity in WMOPS per frame to the file "res/wmops" (one float value per frame) */
/*#define WMOPS_DETAIL*/                        /* Activate complexity detail printout for every function. Increases runtime overhead */
/*#define WMOPS_WC_FRAME_ANALYSIS*/             /* Output WMOPS analysis for worst case frame */
/*#define WMOPS_WC_FRAME_ANALYSIS*/             /* Output WMOPS analysis for the worst-case frame */
/*#define MEM_COUNT_DETAILS*/                   /* Output detailed memory consumption report for the worst-case frame */

#ifdef DEBUGGING

#define MEM_COUNT_DETAILS                   /* RAM counting tool: print per sub-structure details */

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#ifdef DEBUG_MODE_INFO
/*#define DEBUG_MODE_ACELP*/                    /* output most important ACELP core parameters to the subdirectory "res/" */
+46 −38
Original line number Diff line number Diff line
@@ -701,16 +701,19 @@ static void print_stack_call_tree(void)
    caller_info* caller_info_ptr;
    int call_level;

    fprintf(stdout, "Stack Call Tree (frame #%d):\n", wc_frame);
    fprintf(stdout, "\nList of functions when maximum stack size is reached:\n\n");

    caller_info_ptr = &stack_callers[1][0];
    for (call_level = 0; call_level < MAX_RECORDABLE_CALLS; call_level++)
    {
        /* Done? */
        if ( caller_info_ptr->function_name[0] == 0 )
        {
            break;
        }

        /* Print Name */
        fprintf(stdout, "%-42s", caller_info_ptr->function_name);
        fprintf(stdout, "%-42s()", caller_info_ptr->function_name);

        /* Print Stack Usage (Based on Difference) */
        if (call_level != 0)
@@ -1267,26 +1270,32 @@ static void mem_count_summary(void)
        }
    }

    for (j = 0; j < 3; j++)
    for (j = 0; j < 2; j++)
    {
        if (j == 0 && wc_heap_size[1] > 0)
        if ( !flag_intra_frame_memory )
        {
            if ( j == 0 )
            {
                /* Total Heap Size */
            printf("\nList of memory blocks when maximum heap size is reached:\n\n");
                printf( "\nList of memory blocks when maximum inter-frame heap size is reached:\n\n" );
            }
        else if (j == 1 && flag_intra_frame_memory && wc_heap_size_intra_frame[1] > 0)
            else
            {
            /* Intra-Frame Heap Size */
            printf("\nList of memory blocks when maximum Intra-Frame Heap Size is reached:\n\n");
                continue;
            }
        }
        else if (j == 2 && flag_intra_frame_memory && wc_heap_size_inter_frame[1] > 0)
        else 
        {
            /* Inter-Frame Heap Size */
            printf("\nList of memory blocks when maximum Inter-Frame Heap Size is reached:\n\n");
            if ( j == 0 )
            {
                /* Intra-Frame Heap Size */
                printf( "\nList of memory blocks when maximum intra-frame heap size is reached:\n\n" );
            }
            else
            {
            continue;
                /* Inter-Frame Heap Size */
                printf( "\nList of memory blocks when maximum inter-frame heap size is reached:\n\n" );
            }
        }

        /* Print Header */
@@ -1302,9 +1311,9 @@ static void mem_count_summary(void)
        {
            record_ptr = &(allocation_list[i]);

            if ((j == 0 && record_ptr->wc_heap_size[1] > 0) ||
                (j == 1 && record_ptr->wc_heap_size_intra_frame[1] > 0) ||
                (j == 2 && record_ptr->wc_heap_size_inter_frame[1] > 0)
            if ( ( !flag_intra_frame_memory && j == 0 && record_ptr->wc_heap_size[1] > 0 ) ||
                 ( flag_intra_frame_memory && j == 0 && record_ptr->wc_heap_size_intra_frame[1] > 0 ) ||
                 ( flag_intra_frame_memory && j == 1 && record_ptr->wc_heap_size_inter_frame[1] > 0 )
                )
            {
                strncpy(name_str, record_ptr->name, MAX_FUNCTION_NAME_LENGTH);
@@ -1388,7 +1397,6 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[])
#endif
    }


    /* check, if all memory blocks have been deallocated (freed) */
    for (i = 0; i < Num_Records; i++)
    {
@@ -1402,23 +1410,23 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[])
    if ( wc_heap_size[1] > 0 )
    {
        fprintf( stdout, "\n\n --- Heap usage (malloc/calloc) ---  \n\n" );
        printf("Maximum heap size: %d %s in frame %d\n", wc_heap_size[1] >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], wc_heap_size[0]);
    }

        if ( wc_heap_size_intra_frame[1] > 0 )
        {
            printf( "Maximum intra-frame heap size: %d %s in frame %d\n", wc_heap_size_intra_frame[1] >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], wc_heap_size_intra_frame[0] );
            printf( "Maximum inter-frame heap size: %d %s in frame %d\n", wc_heap_size_inter_frame[1] >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], wc_heap_size_inter_frame[0] );
        }

    if (wc_heap_size_inter_frame[1] > 0 && wc_heap_size_inter_frame[1] != wc_heap_size[1])
        else
        {
        printf("Maximum inter-frame heap size: %d %s in frame %d\n", wc_heap_size_inter_frame[1] >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], wc_heap_size_inter_frame[1]);
            printf( "Maximum inter-frame heap size: %d %s in frame %d\n", wc_heap_size[1] >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], wc_heap_size[0] );
        }

#ifdef MEM_COUNT_DETAILS
        /* Print detailed information abour heap memory usage */
        mem_count_summary();
#endif
    }


    if (Stat_Cnt_Size > 0)
    {