Commit daff34a2 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

update wmc_auto.[h|c] to that of the IVAS float repo

parent c7fdb211
Loading
Loading
Loading
Loading
+85 −28
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdarg.h>
#include <sys/stat.h>

#ifndef _MSC_VER
@@ -36,12 +37,14 @@
 * Complexity counting tool
 *--------------------------------------------------------------------*/

#define MAX_FUNCTION_NAME_LENGTH     50  /* Maximum length of the function name */
#define MAX_PARAMS_LENGTH            50  /* Maximum length of the function parameter string */
#define MAX_NUM_RECORDS              300 /* Initial maximum number of records -> mightb be increased during runtime, if needed */
#define MAX_FUNCTION_NAME_LENGTH     200  /* Maximum length of the function name */
#define MAX_PARAMS_LENGTH            200  /* Maximum length of the function parameter string */
#define MAX_NUM_RECORDS              300 /* Initial maximum number of records -> might be increased during runtime, if needed */
#define MAX_NUM_RECORDS_REALLOC_STEP 50  /* When re-allocating the list of records, increase the number of records by this number */
#define MAX_CALL_TREE_DEPTH          100 /* maximum depth of the function call tree */
#define DOUBLE_MAX                   0x80000000
#define FAC                          ( FRAMES_PER_SECOND / 1e6 )


typedef struct 
{
@@ -123,7 +126,7 @@ void reset_wmops( void )
        exit( -1 );
    }

    /* initilize the list of wmops records */
    /* initilize the list of WMOPS records */
    /* initilize the BASOP WMOPS counters */
    for ( i = 0; i < max_num_wmops_records; i++ )
    {
@@ -186,35 +189,84 @@ void reset_wmops( void )
    return;
}


void push_wmops( const char *label )
void push_wmops_fct( const char *label, ... )
{
    int new_flag;
    int i, j;
    int i, j, index_record;
    unsigned int *ptr;
    va_list arg;
    char func_name[MAX_FUNCTION_NAME_LENGTH] = "";

    /* concatenate all function name labels into a single string */
    va_start( arg, label );
    while ( label )
    {
        strcat( func_name, label );
        label = va_arg( arg, const char * );
    }
    va_end( arg );

    /* Check, if this is a new function label */
    new_flag = 1;
    for ( i = 0; i < num_wmops_records; i++ )
    {
        if ( strcmp( wmops[i].label, label ) == 0 )
        if ( strcmp( wmops[i].label, func_name ) == 0 )
        {
            new_flag = 0;
            break;
        }
    }
    index_record = i;

    /* Create a new record in the list */
    if ( new_flag )
    {
        if ( num_wmops_records >= max_num_wmops_records )
        {
            /* There is no room for a new wmops record -> reallocate the list */
            /* There is no room for a new WMOPS record -> reallocate the list */
            max_num_wmops_records += MAX_NUM_RECORDS_REALLOC_STEP;
            wmops = realloc( wmops, max_num_wmops_records * sizeof( wmops_record ) );
            multiCounter = realloc( multiCounter, max_num_wmops_records * sizeof( BASIC_OP ) );

            /* initilize newly created WMOPS records */
            for ( i = num_wmops_records; i < max_num_wmops_records; i++ )
            {
                strcpy( &wmops[i].label[0], "\0" );
                wmops[i].call_number = 0;
                wmops[i].update_cnt = 0;
                for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ )
                {
                    wmops[i].call_tree[j] = -1;
                }
                wmops[i].start_selfcnt = 0.0;
                wmops[i].current_selfcnt = 0.0;
                wmops[i].max_selfcnt = 0.0;
                wmops[i].min_selfcnt = DOUBLE_MAX;
                wmops[i].tot_selfcnt = 0.0;
                wmops[i].start_cnt = 0.0;
                wmops[i].current_cnt = 0.0;
                wmops[i].max_cnt = 0.0;
                wmops[i].min_cnt = DOUBLE_MAX;
                wmops[i].tot_cnt = 0.0;
#ifdef WMOPS_WC_FRAME_ANALYSIS
                wmops[i].wc_cnt = 0.0;
                wmops[i].wc_selfcnt = 0.0;
                wmops[i].current_call_number = 0;
                wmops[i].wc_call_number = -1;
#endif

                /* initialize BASOP WMOPS counters */
                ptr = (unsigned int *) &multiCounter[i];
                for ( j = 0; j < (int) ( sizeof( BASIC_OP ) / sizeof( unsigned int ) ); j++ )
                {
                    *ptr++ = 0;
                }
                wmops[i].LastWOper = 0;
            }

        }

        strcpy( wmops[i].label, label );
        strcpy( wmops[index_record].label, func_name );

        num_wmops_records++;
    }
@@ -236,29 +288,29 @@ void push_wmops( const char *label )
        /* update call tree */
        for ( j = 0; j < MAX_CALL_TREE_DEPTH; j++ )
        {
            if ( wmops[i].call_tree[j] == current_record )
            if ( wmops[index_record].call_tree[j] == current_record )
            {
                break;
            }
            else if ( wmops[i].call_tree[j] == -1 )
            else if ( wmops[index_record].call_tree[j] == -1 )
            {
                wmops[i].call_tree[j] = current_record;
                wmops[index_record].call_tree[j] = current_record;
                break;
            }
        }
    }

    /* update the current context info */
    current_record = i;
    wmops[current_record].start_selfcnt = ops_cnt;
    wmops[current_record].start_cnt = ops_cnt;
    wmops[current_record].call_number++;
    current_record = index_record;
    wmops[index_record].start_selfcnt = ops_cnt;
    wmops[index_record].start_cnt = ops_cnt;
    wmops[index_record].call_number++;
#ifdef WMOPS_WC_FRAME_ANALYSIS
    wmops[current_record].current_call_number++;
    wmops[index_record].current_call_number++;
#endif

    /* set the ID of BASOP functions counters */
    Set_BASOP_WMOPS_counter( current_record );
    Set_BASOP_WMOPS_counter( index_record );

    return;
}
@@ -1095,7 +1147,7 @@ void *mem_alloc(

#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 );
    fprintf( fid_csv_filename, "A,%ld,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
#endif

    if ( ptr_record->frame_allocated != -1 )
@@ -1393,8 +1445,8 @@ allocator_record *get_mem_record( unsigned long *hash, const char *func_name, in
/*-------------------------------------------------------------------*
 * mem_free()
 *
 * This function de-allocatesd the memory block and frees the mphysical memory with free().
 * It also updates actual and average usage of the memory block.
 * This function de-allocates memory blocks and frees physical memory with free().
 * It also updates the actual and average usage of memory blocks.
 *
 * Note: The record is not removed from the list and may be reused later on in mem_alloc()!
 *--------------------------------------------------------------------*/
@@ -1435,7 +1487,7 @@ void mem_free( const char *func_name, int func_lineno, void *ptr )

#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 );
    fprintf( fid_csv_filename, "D,%ld,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size );
#endif

    /* De-Allocate Memory Block */
@@ -1695,7 +1747,7 @@ static void mem_count_summary( void )
    allocator_record *ptr_record, *ptr;

    /* Prepare format string */
    sprintf( format_str, "%%-%ds %%5s %%6s %%-%ds %%20s %%6s ", MAX_FUNCTION_NAME_LENGTH, MAX_PARAMS_LENGTH );
    sprintf( format_str, "%%-%d.%ds %%5.5s %%6.6s %%-%d.%ds %%20.20s %%6.6s ", 50, 50, 50, 50 );

    if ( n_items_wc_intra_frame_heap > 0 )
    {
@@ -1903,8 +1955,8 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
            }
            else
            {
                /* bytes */
                fprintf( stdout, "Program ROM size (%s): %d bytes\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size << Stat_Cnt_Size );
                /* bytes (here, we assume that each instruction takes PROM_INST_SIZE bits of the PROM memory) */
                fprintf( stdout, "Program ROM size (%s): %d bytes\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size * ( PROM_INST_SIZE / 8 ) );
            }
        }

@@ -1994,10 +2046,15 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
    mem_count_summary();
#endif

    if ( Stat_Cnt_Size == 0 )
    if ( Stat_Cnt_Size > 0 )
    {
        /* words */
        fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bits\n", 8 << Stat_Cnt_Size );
    }
    else
    {
        /* bytes */
        fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bytes (%d bits)\n", 1 << Stat_Cnt_Size, 8 << Stat_Cnt_Size );
        fprintf( stdout, "\nNote: The Program ROM size is calculated under the assumption that 1 instruction word is stored with %d bits\n", PROM_INST_SIZE );
    }
    fprintf( stdout, "Note: The Data ROM size is calculated using the sizeof(type) built-in function\n" );

+90 −84
Original line number Diff line number Diff line
@@ -33,10 +33,8 @@
#define INT_MAX 32767
#endif

/* Real-time relationships */
#define FRAMES_PER_SECOND 50.0    
#define WMOPS_BOOST_FAC   ( 1.0f ) /* scaling factor for equalizing the difference between automatic and manual instrumentation */
#define FAC               ( FRAMES_PER_SECOND / 1e6 * WMOPS_BOOST_FAC )
#define PROM_INST_SIZE    32     /* number of bits of each program instruction when stored in the PROM memory (applied only when the user selects reporting in bytes) */

#ifdef WMOPS
enum instructions
@@ -565,7 +563,8 @@ extern double prom_cnt;
extern double inst_cnt[NUM_INST];

void reset_wmops( void );
void push_wmops( const char *label );
#define push_wmops( ... ) push_wmops_fct( __VA_ARGS__, NULL )
void push_wmops_fct( const char *label, ... );
void pop_wmops( void );
void update_wmops( void );
void update_mem( void );
@@ -615,14 +614,6 @@ extern int cntr_push_pop;

#endif

/* mac & msu (Non Instrumented Versions) */
#ifndef mac
#define mac( a, b, c ) ( ( a ) + ( b ) * ( c ) )
#endif
#ifndef mac
#define msu( a, b, c ) ( ( a ) - ( b ) * ( c ) )
#endif

#ifndef WMOPS
/* DESACTIVATE the Counting Mechanism */
#define OP_COUNT_( op, n )
@@ -670,84 +661,99 @@ static int wmc_flag_ = 0;
#endif

/* Define all Macros without '{' & '}' (None of these should be called externally!) */
#define ABS_( x )      OP_COUNT_( _ABS, ( x ) / WMOPS_BOOST_FAC )
#define ADD_( x )      OP_COUNT_( _ADD, ( x ) / WMOPS_BOOST_FAC )
#define MULT_( x )     OP_COUNT_( _MULT, ( x ) / WMOPS_BOOST_FAC )
#define MAC_( x )      OP_COUNT_( _MAC, ( x ) / WMOPS_BOOST_FAC )
#define MOVE_( x )     OP_COUNT_( _MOVE, ( x ) / WMOPS_BOOST_FAC )
#define STORE_( x )    OP_COUNT_( _STORE, ( x ) / WMOPS_BOOST_FAC )
#define LOGIC_( x )    OP_COUNT_( _LOGIC, ( x ) / WMOPS_BOOST_FAC )
#define SHIFT_( x )    OP_COUNT_( _SHIFT, ( x ) / WMOPS_BOOST_FAC )
#define BRANCH_( x )   OP_COUNT_( _BRANCH, ( x ) / WMOPS_BOOST_FAC )
#define DIV_( x )      OP_COUNT_( _DIV, ( x ) / WMOPS_BOOST_FAC )
#define SQRT_( x )     OP_COUNT_( _SQRT, ( x ) / WMOPS_BOOST_FAC )
#define TRANS_( x )    OP_COUNT_( _TRANS, ( x ) / WMOPS_BOOST_FAC )
#define ABS_( x )      OP_COUNT_( _ABS, ( x ) )
#define ADD_( x )      OP_COUNT_( _ADD, ( x ) )
#define MULT_( x )     OP_COUNT_( _MULT, ( x ) )
#define MAC_( x )      OP_COUNT_( _MAC, ( x ) )
#define MOVE_( x )     OP_COUNT_( _MOVE, ( x ) )
#define STORE_( x )    OP_COUNT_( _STORE, ( x ) )
#define LOGIC_( x )    OP_COUNT_( _LOGIC, ( x ) )
#define SHIFT_( x )    OP_COUNT_( _SHIFT, ( x ) )
#define BRANCH_( x )   OP_COUNT_( _BRANCH, ( x ) )
#define DIV_( x )      OP_COUNT_( _DIV, ( x ) )
#define SQRT_( x )     OP_COUNT_( _SQRT, ( x ) )
#define TRANS_( x )    OP_COUNT_( _TRANS, ( x ) )
#define POWER_( x )    TRANS_( x )
#define LOG_( x )      TRANS_( x )
#define LOOP_( x )     OP_COUNT_( _LOOP, ( x ) / WMOPS_BOOST_FAC )
#define INDIRECT_( x ) OP_COUNT_( _INDIRECT, ( x ) / WMOPS_BOOST_FAC )
#define PTR_INIT_( x ) OP_COUNT_( _PTR_INIT, ( x ) / WMOPS_BOOST_FAC )
#define FUNC_( x )     ( OP_COUNT_( _MOVE, ( x ) / WMOPS_BOOST_FAC ), OP_COUNT_( _FUNC, 1 ) )
#define LOOP_( x )     OP_COUNT_( _LOOP, ( x ) )
#define INDIRECT_( x ) OP_COUNT_( _INDIRECT, ( x ) )
#define PTR_INIT_( x ) OP_COUNT_( _PTR_INIT, ( x ) )
#define FUNC_( x )     ( OP_COUNT_( _MOVE, ( x ) ), OP_COUNT_( _FUNC, 1 ) )
#define MISC_( x )     ABS_( x )

/* Math Operations */
#define abs_    OP_COUNT_WRAPPER1_( ABS_( 1 ), abs )
#define fabs_   OP_COUNT_WRAPPER1_( ABS_( 1 ), fabs )
#define fabsf_  OP_COUNT_WRAPPER1_( ABS_( 1 ), fabsf )
#define labs_   OP_COUNT_WRAPPER1_( ABS_( 1 ), labs )
#define floor_  OP_COUNT_WRAPPER1_( MISC_( 1 ), floor )
#define floorf_ OP_COUNT_WRAPPER1_( MISC_( 1 ), floorf )
#define sqrt_   OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrt )
#define sqrtf_  OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrtf )
#define pow_    OP_COUNT_WRAPPER1_( POWER_( 1 ), pow )
#define powf_   OP_COUNT_WRAPPER1_( POWER_( 1 ), powf )
#define exp_    OP_COUNT_WRAPPER1_( POWER_( 1 ), exp )
#define expf_   OP_COUNT_WRAPPER1_( POWER_( 1 ), expf )
#define log_    OP_COUNT_WRAPPER1_( LOG_( 1 ), log )
#define logf_   OP_COUNT_WRAPPER1_( LOG_( 1 ), logf )
#define log10_  OP_COUNT_WRAPPER1_( LOG_( 1 ), log10 )
#define log10f_ OP_COUNT_WRAPPER1_( LOG_( 1 ), log10f )
#define cos_    OP_COUNT_WRAPPER1_( TRANS_( 1 ), cos )
#define cosf_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosf )
#define sin_    OP_COUNT_WRAPPER1_( TRANS_( 1 ), sin )
#define sinf_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinf )
#define tan_    OP_COUNT_WRAPPER1_( TRANS_( 1 ), tan )
#define tanf_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanf )
#define acos_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), acos )
#define acosf_  OP_COUNT_WRAPPER1_( TRANS_( 1 ), acosf )
#define asin_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), asin )
#define asinf_  OP_COUNT_WRAPPER1_( TRANS_( 1 ), asinf )
#define atan_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan )
#define atanf_  OP_COUNT_WRAPPER1_( TRANS_( 1 ), atanf )
#define atan2_  OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2 )
#define atan2f_ OP_COUNT_WRAPPER1_( TRANS_( 1 ), atan2f )
#define cosh_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), cosh )
#define coshf_  OP_COUNT_WRAPPER1_( TRANS_( 1 ), coshf )
#define sinh_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinh )
#define sinhf_  OP_COUNT_WRAPPER1_( TRANS_( 1 ), sinhf )
#define tanh_   OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanh )
#define tanhf_  OP_COUNT_WRAPPER1_( TRANS_( 1 ), tanhf )
#define fmod_   OP_COUNT_WRAPPER1_( DIV_( 1 ), fmod )
/* these macros use any local macros already defined */
/* min/max and their Variants */
#define fmodf_  OP_COUNT_WRAPPER1_( DIV_( 1 ), fmodf )
#define frexp_  OP_COUNT_WRAPPER1_( MISC_( 2 ), frexp )
#define frexpf_ OP_COUNT_WRAPPER1_( MISC_( 2 ), frexpf )

/* the macros below are instrumented versions of user-defined macros that might be used in the source code 
/* representing some well-known and recognized mathematical operations (that are not defined in math.h) */
/* Note: the 'wmc_flag_=wmc_flag_' is used to avoid warning: left-hand operand of comma expression has no effect with gcc */

#define min_( a, b )     OP_COUNT_WRAPPER1_( MISC_( 1 ), min( ( a ), ( b ) ) )
#define max_( a, b )     OP_COUNT_WRAPPER1_( MISC_( 1 ), max( ( a ), ( b ) ) )
#define MIN_( a, b )     OP_COUNT_WRAPPER1_( MISC_( 1 ), MIN( ( a ), ( b ) ) )
#define MAX_( a, b )     OP_COUNT_WRAPPER1_( MISC_( 1 ), MAX( ( a ), ( b ) ) )
#define Min_( a, b )     OP_COUNT_WRAPPER1_( MISC_( 1 ), Min( ( a ), ( b ) ) )
#define Max_( a, b )     OP_COUNT_WRAPPER1_( MISC_( 1 ), Max( ( a ), ( b ) ) )
/* Square and its Variants */
#define sqr_( x )        OP_COUNT_WRAPPER1_( MULT_( 1 ), sqr( ( x ) ) )
#define Sqr_( x )        OP_COUNT_WRAPPER1_( MULT_( 1 ), Sqr( ( x ) ) )
#define SQR_( x )        OP_COUNT_WRAPPER1_( MULT_( 1 ), SQR( ( x ) ) )
#define square_( x )     OP_COUNT_WRAPPER1_( MULT_( 1 ), square( ( x ) ) )
#define Square_( x )     OP_COUNT_WRAPPER1_( MULT_( 1 ), Square( ( x ) ) )
#define SQUARE_( x )     OP_COUNT_WRAPPER1_( MULT_( 1 ), SQUARE( ( x ) ) )
/* Sign and its Variants */
#define sign_( x )       OP_COUNT_WRAPPER1_( MOVE_( 1 ), sign( ( x ) ) )
#define Sign_( x )       OP_COUNT_WRAPPER1_( MOVE_( 1 ), Sign( ( x ) ) )
#define SIGN_( x )       OP_COUNT_WRAPPER1_( MOVE_( 1 ), SIGN( ( x ) ) )
/* Square Root and its Variants */
#define sqrtf_( x ) OP_COUNT_WRAPPER1_( SQRT_( 1 ), sqrtf( ( x ) ) )
/* Invert Square Root and its Variants */
#define inv_sqrt_( x )   OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrt( ( x ) ) )
/* Others */
#define inv_sqrtf_( x )  OP_COUNT_WRAPPER1_( SQRT_( 1 ), inv_sqrtf( ( x ) ) )
#define log_base_2_( x ) OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log_base_2( ( x ) ) )
#define log2_( x )       OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2( ( x ) ) )
#define log2f_( x )      OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2f( ( x ) ) )
#define log2_f_( x )     OP_COUNT_WRAPPER1_( ( LOG_( 1 ), MULT_( 1 ) ), log2_f( ( x ) ) )
/* The 'wmc_flag_=wmc_flag_' is Used to Avoid: "warning: left-hand operand of comma expression has no effect"
   with Cygwin gcc Compiler */
#define _round_( x )     OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _round( ( x ) ) )
#define round_( x )      OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round( ( x ) ) )
#define round_f_( x )    OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, round_f( ( x ) ) )
#define _squant_( x ) OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, _squant( ( x ) ) )
/* Set Min/Max */
#define roundf_( x )     OP_COUNT_WRAPPER1_( wmc_flag_ = wmc_flag_, roundf( ( x ) ) )
#define set_min_( a, b ) OP_COUNT_WRAPPER3_( ( ADD_( 1 ), BRANCH_( 1 ), MOVE_( 1 ) ), set_min( ( a ), ( b ) ) )
#define set_max_( a, b ) OP_COUNT_WRAPPER3_( ( ADD_( 1 ), BRANCH_( 1 ), MOVE_( 1 ) ), set_max( ( a ), ( b ) ) )
/* mac & msu (Instrumented Versions) */
#define mac_( a, b, c ) OP_COUNT_WRAPPER1_( MAC_( 1 ), mac( a, b, c ) )
#define msu_( a, b, c ) OP_COUNT_WRAPPER1_( MAC_( 1 ), msu( a, b, c ) )

/* Functions */
#define func_( name, x ) OP_COUNT_WRAPPER1_( FUNC_( x ), name )
@@ -1014,11 +1020,11 @@ int push_stack( const char *filename, const char *fctname );
int pop_stack( const char *filename, const char *fctname );

#ifdef WMOPS_DETAIL
#define STACK_DEPTH_FCT_CALL   ( push_wmops( __FUNCTION__ " [WMC_AUTO]" ), push_stack( __FILE__, __FUNCTION__ ) ) /* add push_wmops() in all function calls */
#define STACK_DEPTH_FCT_RETURN ( pop_wmops(), pop_stack( __FILE__, __FUNCTION__ ) )                 /* add pop_wmops() in all function returns */
#define STACK_DEPTH_FCT_CALL   ( push_wmops( __func__, "[WMC_AUTO]" ), push_stack( __FILE__, __func__ ) )  /* add push_wmops() in all function calls */
#define STACK_DEPTH_FCT_RETURN ( pop_wmops(), pop_stack( __FILE__, __func__ ) )                            /* add pop_wmops() in all function returns */
#else
#define STACK_DEPTH_FCT_CALL   push_stack( __FILE__, __FUNCTION__ )
#define STACK_DEPTH_FCT_RETURN pop_stack( __FILE__, __FUNCTION__ )
#define STACK_DEPTH_FCT_RETURN pop_stack( __FILE__, __func__ )
#endif

void reset_stack( void );