Loading lib_debug/wmc_auto.c +0 −41 Original line number Diff line number Diff line Loading @@ -155,12 +155,7 @@ static BASIC_OP op_weight = { BASIC_OP *multiCounter = NULL; unsigned int currCounter = 0; long funcid_total_wmops_at_last_call_to_else; #ifdef FIX_1054_IF_ELSE_CMPLX char func_name_where_last_call_to_else_occurred[MAX_FUNCTION_NAME_LENGTH + 1]; #else int funcId_where_last_call_to_else_occurred; int call_occurred = 1; #endif void reset_wmops( void ) { Loading Loading @@ -251,12 +246,6 @@ void reset_wmops( void ) wmops_caller_stack[i] = -1; } #ifndef FIX_1054_IF_ELSE_CMPLX /* initialize auxiliary BASOP WMOPS variables */ //call_occurred = 1; //funcId_where_last_call_to_else_occurred = INT_MAX; #endif return; } Loading Loading @@ -382,9 +371,6 @@ void push_wmops_fct( const char *label, ... ) /* set the ID of the current BASOP operations counter */ currCounter = index_record; #ifndef FIX_1054_IF_ELSE_CMPLX call_occurred = 1; #endif return; } Loading Loading @@ -428,9 +414,6 @@ void pop_wmops( void ) { currCounter = current_record; } #ifndef FIX_1054_IF_ELSE_CMPLX call_occurred = 1; #endif return; } Loading Loading @@ -524,9 +507,6 @@ void update_wmops( void ) #endif /* reset the BASOP operations counter */ #ifndef FIX_1054_IF_ELSE_CMPLX call_occurred = 1; #endif Reset_BASOP_WMOPS_counter( i ); } Loading Loading @@ -2458,7 +2438,6 @@ void incrIf( const char *func_name ) { /* Technical note: If the "IF" operator comes just after an "ELSE", its counter must not be incremented */ /* The following auxiliary variables are used to check if the "IF" operator doesn't immediately follow an "ELSE" operator */ #ifdef FIX_1054_IF_ELSE_CMPLX if ( ( strncmp( func_name, func_name_where_last_call_to_else_occurred, MAX_FUNCTION_NAME_LENGTH ) != 0 ) || ( TotalWeightedOperation( currCounter ) != funcid_total_wmops_at_last_call_to_else ) ) { Loading @@ -2466,38 +2445,18 @@ void incrIf( const char *func_name ) } func_name_where_last_call_to_else_occurred[0] = '\0'; #else if ( ( currCounter != funcId_where_last_call_to_else_occurred ) || ( TotalWeightedOperation() != funcid_total_wmops_at_last_call_to_else ) || ( call_occurred == 1 ) ) multiCounter[currCounter].If++; call_occurred = 0; funcId_where_last_call_to_else_occurred = MAXCOUNTERS; #endif } void incrElse( const char *func_name ) { multiCounter[currCounter].If++; #ifndef FIX_1054_IF_ELSE_CMPLX /* Save the BASOP counter Id in the last function in which ELSE() has been called */ funcId_where_last_call_to_else_occurred = currCounter; #endif /* Save the BASOP comeplxity in the last call of the ELSE() statement */ funcid_total_wmops_at_last_call_to_else = TotalWeightedOperation( currCounter ); #ifdef FIX_1054_IF_ELSE_CMPLX /* We keep track of the name of the last calling function when the ELSE macro was called */ strncpy( func_name_where_last_call_to_else_occurred, func_name, MAX_FUNCTION_NAME_LENGTH ); func_name_where_last_call_to_else_occurred[MAX_FUNCTION_NAME_LENGTH] = '\0'; #else /* We keep track of the funcId of the last function which used ELSE {...} structure. */ funcId_where_last_call_to_else_occurred = currCounter; /* call_occurred is set to 0, in order to count the next IF (if necessary) */ call_occurred = 0; #endif } long TotalWeightedOperation( unsigned int CounterId ) Loading lib_debug/wmc_auto.h +0 −6 Original line number Diff line number Diff line Loading @@ -966,14 +966,8 @@ typedef struct #ifdef WMOPS extern BASIC_OP *multiCounter; extern unsigned int currCounter; #ifndef FIX_1054_IF_ELSE_CMPLX extern int funcId_where_last_call_to_else_occurred; extern int call_occurred; #endif extern long funcid_total_wmops_at_last_call_to_else; #ifdef FIX_1054_IF_ELSE_CMPLX extern char func_name_where_last_call_to_else_occurred[]; #endif long TotalWeightedOperation( unsigned int counterId ); long DeltaWeightedOperation( unsigned int counterId ); Loading Loading
lib_debug/wmc_auto.c +0 −41 Original line number Diff line number Diff line Loading @@ -155,12 +155,7 @@ static BASIC_OP op_weight = { BASIC_OP *multiCounter = NULL; unsigned int currCounter = 0; long funcid_total_wmops_at_last_call_to_else; #ifdef FIX_1054_IF_ELSE_CMPLX char func_name_where_last_call_to_else_occurred[MAX_FUNCTION_NAME_LENGTH + 1]; #else int funcId_where_last_call_to_else_occurred; int call_occurred = 1; #endif void reset_wmops( void ) { Loading Loading @@ -251,12 +246,6 @@ void reset_wmops( void ) wmops_caller_stack[i] = -1; } #ifndef FIX_1054_IF_ELSE_CMPLX /* initialize auxiliary BASOP WMOPS variables */ //call_occurred = 1; //funcId_where_last_call_to_else_occurred = INT_MAX; #endif return; } Loading Loading @@ -382,9 +371,6 @@ void push_wmops_fct( const char *label, ... ) /* set the ID of the current BASOP operations counter */ currCounter = index_record; #ifndef FIX_1054_IF_ELSE_CMPLX call_occurred = 1; #endif return; } Loading Loading @@ -428,9 +414,6 @@ void pop_wmops( void ) { currCounter = current_record; } #ifndef FIX_1054_IF_ELSE_CMPLX call_occurred = 1; #endif return; } Loading Loading @@ -524,9 +507,6 @@ void update_wmops( void ) #endif /* reset the BASOP operations counter */ #ifndef FIX_1054_IF_ELSE_CMPLX call_occurred = 1; #endif Reset_BASOP_WMOPS_counter( i ); } Loading Loading @@ -2458,7 +2438,6 @@ void incrIf( const char *func_name ) { /* Technical note: If the "IF" operator comes just after an "ELSE", its counter must not be incremented */ /* The following auxiliary variables are used to check if the "IF" operator doesn't immediately follow an "ELSE" operator */ #ifdef FIX_1054_IF_ELSE_CMPLX if ( ( strncmp( func_name, func_name_where_last_call_to_else_occurred, MAX_FUNCTION_NAME_LENGTH ) != 0 ) || ( TotalWeightedOperation( currCounter ) != funcid_total_wmops_at_last_call_to_else ) ) { Loading @@ -2466,38 +2445,18 @@ void incrIf( const char *func_name ) } func_name_where_last_call_to_else_occurred[0] = '\0'; #else if ( ( currCounter != funcId_where_last_call_to_else_occurred ) || ( TotalWeightedOperation() != funcid_total_wmops_at_last_call_to_else ) || ( call_occurred == 1 ) ) multiCounter[currCounter].If++; call_occurred = 0; funcId_where_last_call_to_else_occurred = MAXCOUNTERS; #endif } void incrElse( const char *func_name ) { multiCounter[currCounter].If++; #ifndef FIX_1054_IF_ELSE_CMPLX /* Save the BASOP counter Id in the last function in which ELSE() has been called */ funcId_where_last_call_to_else_occurred = currCounter; #endif /* Save the BASOP comeplxity in the last call of the ELSE() statement */ funcid_total_wmops_at_last_call_to_else = TotalWeightedOperation( currCounter ); #ifdef FIX_1054_IF_ELSE_CMPLX /* We keep track of the name of the last calling function when the ELSE macro was called */ strncpy( func_name_where_last_call_to_else_occurred, func_name, MAX_FUNCTION_NAME_LENGTH ); func_name_where_last_call_to_else_occurred[MAX_FUNCTION_NAME_LENGTH] = '\0'; #else /* We keep track of the funcId of the last function which used ELSE {...} structure. */ funcId_where_last_call_to_else_occurred = currCounter; /* call_occurred is set to 0, in order to count the next IF (if necessary) */ call_occurred = 0; #endif } long TotalWeightedOperation( unsigned int CounterId ) Loading
lib_debug/wmc_auto.h +0 −6 Original line number Diff line number Diff line Loading @@ -966,14 +966,8 @@ typedef struct #ifdef WMOPS extern BASIC_OP *multiCounter; extern unsigned int currCounter; #ifndef FIX_1054_IF_ELSE_CMPLX extern int funcId_where_last_call_to_else_occurred; extern int call_occurred; #endif extern long funcid_total_wmops_at_last_call_to_else; #ifdef FIX_1054_IF_ELSE_CMPLX extern char func_name_where_last_call_to_else_occurred[]; #endif long TotalWeightedOperation( unsigned int counterId ); long DeltaWeightedOperation( unsigned int counterId ); Loading