Commit 7b797379 authored by malenov's avatar malenov
Browse files

define TotalWeightedOperation_wmc() and Set_ Reset_ BASOP counters within WMC

parent 09823077
Loading
Loading
Loading
Loading
+0 −59
Original line number Diff line number Diff line
@@ -167,65 +167,6 @@ char *BasicOperationList[] = {

};


const BASIC_OP op_weight = {
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 2, 2, 1,
    1, 1, 1, 2, 1,

    1, 1, 1, 2, 1,
    1, 1, 18, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    2, 2, 2, 2, 1,

    1, 1, 1, 1, 1,
    1, 1, 1, 2,
    1, 2, 2, 2, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,

    1, 1, 1, 1, 3,
    3, 3, 3, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 3, 2,
    2, 6, 3, 3, 2,

    1, 32, 1

/* New complex basops */
#ifdef COMPLEX_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1

    ,
    1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1

#endif /* #ifdef COMPLEX_OPERATOR */

#ifdef ENH_64_BIT_OPERATOR
    /* Weights of new 64 bit basops */
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_64_BIT_OPERATOR */

#ifdef ENH_32_BIT_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_32_BIT_OPERATOR */

#ifdef ENH_U_32_BIT_OPERATOR
    ,
    1, 1, 1, 2, 2, 1, 1
#endif /* #ifdef ENH_U_32_BIT_OPERATOR */

#ifdef CONTROL_CODE_OPS
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef CONTROL_CODE_OPS */
};
#endif /* ifdef WMOPS */


+0 −2
Original line number Diff line number Diff line
@@ -198,8 +198,6 @@ void setFrameRate( int samplingFreq, int frameLength );
 */




Word32 TotalWeightedOperation( void );
Word32 DeltaWeightedOperation( void );

+116 −3
Original line number Diff line number Diff line
@@ -89,6 +89,8 @@ static long fnum_cnt_wc;
static int *wmops_caller_stack = NULL, wmops_caller_stack_index, max_wmops_caller_stack_index = 0;
static int *heap_allocation_call_tree = NULL, heap_allocation_call_tree_size = 0, heap_allocation_call_tree_max_size = 0;

static long TotalWeightedOperation_wmc( void );
static long DeltaWeightedOperation_wmc( void );

void reset_wmops( void )
{
@@ -324,7 +326,7 @@ void push_wmops_fct( const char *label, ... )

void pop_wmops( void )
{
    //long tot;
    long tot;

    /* Check for underflow */
    if ( current_record < 0 )
@@ -334,8 +336,8 @@ void pop_wmops( void )
    }

    /* add the BASOP complexity to the counter */
    //tot = DeltaWeightedOperation();
    //ops_cnt_wmc += tot;
    tot = DeltaWeightedOperation_wmc();
    ops_cnt_wmc += tot;

    /* update count of current record */
    wmops[current_record].current_selfcnt += ops_cnt_wmc - wmops[current_record].start_selfcnt;
@@ -2138,4 +2140,115 @@ int currCounter = 0;
int funcId_where_last_call_to_else_occurred;
long funcid_total_wmops_at_last_call_to_else;
int call_occurred = 1;

const BASIC_OP op_weight = {
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 2, 2, 1,
    1, 1, 1, 2, 1,

    1, 1, 1, 2, 1,
    1, 1, 18, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    2, 2, 2, 2, 1,

    1, 1, 1, 1, 1,
    1, 1, 1, 2,
    1, 2, 2, 2, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,

    1, 1, 1, 1, 3,
    3, 3, 3, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 3, 2,
    2, 6, 3, 3, 2,

    1, 32, 1

/* New complex basops */
#ifdef COMPLEX_OPERATOR
    ,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1
    ,1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1
#endif /* #ifdef COMPLEX_OPERATOR */

#ifdef ENH_64_BIT_OPERATOR
    /* Weights of new 64 bit basops */
    ,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_64_BIT_OPERATOR */

#ifdef ENH_32_BIT_OPERATOR
    ,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_32_BIT_OPERATOR */

#ifdef ENH_U_32_BIT_OPERATOR
    ,1, 1, 1, 2, 2, 1, 1
#endif /* #ifdef ENH_U_32_BIT_OPERATOR */

#ifdef CONTROL_CODE_OPS
    ,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef CONTROL_CODE_OPS */
};

/* Set the counter group to use, default is zero */
void Set_BASOP_WMOPS_counter( int counterId )
{
    if ( ( counterId > num_wmops_records ) || ( counterId < 0 ) )
    {
        currCounter = 0;
        return;
    }
    currCounter = counterId;
    call_occurred = 1;
}

/* Resets the current BASOP WMOPS counter */
void Reset_BASOP_WMOPS_counter( void )
{
    int i;
    long *ptr;

    /* clear the current BASOP operation counter before new frame begins */
    ptr = (long *) &multiCounter[currCounter];
    for ( i = 0; i < (int) ( sizeof( multiCounter[currCounter] ) / sizeof( long ) ); i++ )
    {
        *ptr++ = 0;
    }

    wmops[currCounter].LastWOper = 0;

    return;
}

static long TotalWeightedOperation_wmc()
{
    int i;
    unsigned int *ptr, *ptr2;
    long tot;

    tot = 0;
    ptr = (unsigned int *) &multiCounter[currCounter];
    ptr2 = (unsigned int *) &op_weight;

    for ( i = 0; i < (int) ( sizeof( multiCounter[currCounter] ) / sizeof( unsigned int ) ); i++ )
    {
        tot += ( ( *ptr++ ) * ( *ptr2++ ) );
    }

    return ( tot );
}

static long DeltaWeightedOperation_wmc( void )
{
    long NewWOper, delta;

    NewWOper = TotalWeightedOperation_wmc();

    delta = NewWOper - wmops[currCounter].LastWOper;
    wmops[currCounter].LastWOper = NewWOper;

    return ( delta );
}
#endif
+7 −0
Original line number Diff line number Diff line
@@ -1333,6 +1333,13 @@ extern int currCounter;
extern int funcId_where_last_call_to_else_occurred;
extern long funcid_total_wmops_at_last_call_to_else;
extern int call_occurred;

extern const BASIC_OP op_weight;

void Set_BASOP_WMOPS_counter( int counterId );
void Reset_BASOP_WMOPS_counter( void );


#endif

#endif /* WMOPS_H */