Loading lib_debug/wmc_auto.c +12 −19 Original line number Diff line number Diff line Loading @@ -29,13 +29,13 @@ #include "wmc_auto.h" /*-------------------------------------------------------------------* * WMOPS counting tool *--------------------------------------------------------------------*/ #define WMC_TOOL_SKIP /* Skip the instrumentation of this file, if invoked by accident */ #ifdef WMOPS #define WMC_TOOL_SKIP /* Skip the instrumentation of this file, if invoked by accident */ /*-------------------------------------------------------------------* * Complexity counting tool *--------------------------------------------------------------------*/ #define MAX_RECORDS 1024 #define MAX_CHAR 64 Loading Loading @@ -353,7 +353,7 @@ void print_wmops(void) fprintf(stdout, sfmtt, "---------------", "---", "--------------"); fprintf(stdout, "\n\n"); fprintf(stdout, "\nInstruction Type Analysis (for worst case frame #%ld):\n\n", fnum_cnt_wc); /* added -- JPA */ fprintf(stdout, "\nInstruction Type Analysis (for the worst-case frame %ld):\n\n", fnum_cnt_wc); /* added -- JPA */ for (i = 0; i < NUM_INST; i++) { switch ((enum instructions)i) Loading Loading @@ -450,7 +450,7 @@ void print_wmops(void) * #define WMC_TOOL_SKIP ... #undef WMC_TOOL_SKIP macro pair around the malloc(), calloc() and free(). *--------------------------------------------------------------------*/ #define MAX_RECORDABLE_CALLS 40 #define MAX_RECORDABLE_CALLS 100 #define MAX_FUNCTION_NAME_LENGTH 35 /* Maximum length that the function string will be truncated to */ #define MAX_PARAMS_LENGTH 50 /* Maximum length that the parameter string will be truncated to */ #define MAX_NUM_RECORDS 300 /* Initial maximum number of memory records -> mightb be increased during runtime, if needed */ Loading Loading @@ -716,16 +716,15 @@ static void print_stack_call_tree(void) strncpy(fctname, caller_info_ptr->function_name, MAX_FUNCTION_NAME_LENGTH); strcat(fctname, "()"); fprintf(stdout, "%-42s", fctname); fprintf(stdout, "%-42s", caller_info_ptr->function_name); /* Print Stack Usage (Based on Difference) */ if (call_level != 0) { fprintf(stdout, "%lu\n", ((caller_info_ptr - 1)->stack_ptr - caller_info_ptr->stack_ptr) * sizeof(int16_t) / sizeof(float)); fprintf(stdout, "%lu %s\n", (((caller_info_ptr - 1)->stack_ptr - caller_info_ptr->stack_ptr) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size]); } else { fprintf(stdout, "\n"); fprintf(stdout, "%lu %s\n", ((ptr_base_stack - caller_info_ptr->stack_ptr) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size]); } /* Advance */ Loading Loading @@ -806,7 +805,7 @@ void* mem_alloc( exit(-1); } /* Save all zuxiliary information about the memory block */ /* Save all auxiliary information about the memory block */ strncpy(ptr_record->name, func_name, MAX_FUNCTION_NAME_LENGTH); ptr_record->name[MAX_FUNCTION_NAME_LENGTH] = '\0'; strncpy(ptr_record->params, size_str, MAX_PARAMS_LENGTH); /* Note: The size string starts with either 'm' or 'c' to indicate 'm'alloc or 'c'alloc */ Loading Loading @@ -1367,7 +1366,7 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) for (i = 0; i < nElem; i++) { fprintf(stdout, "Program ROM size (%s): %d words (instructions)\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size); fprintf(stdout, "Program ROM size (%s): %d instruction words\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size); } fprintf(stdout, "\n\n --- Table ROM (const data) usage --- \n\n"); Loading @@ -1379,7 +1378,7 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) fprintf(stdout, "Error: Cannot retrieve or calculate Table ROM size of (%s)!\n", Const_Data_PROM_Table[i].file_spec); } fprintf(stdout, "Table ROM size (%s): %d words\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].Get_Const_Data_Size_Func()); fprintf(stdout, "Table ROM size (%s): %d %s\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].Get_Const_Data_Size_Func() >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size]); } } Loading @@ -1392,7 +1391,7 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) if (ptr_base_stack - ptr_max_stack > 0) { fprintf(stdout, "\n\n --- Stack usage --- \n\n"); fprintf(stdout, "Maximum stack size: %lu %s in frame #%d\n", ((ptr_base_stack - ptr_max_stack) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], fprintf(stdout, "Maximum stack size: %lu %s in frame %d\n", ((ptr_base_stack - ptr_max_stack) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], wc_frame); #ifdef MEM_COUNT_DETAILS print_stack_call_tree(); Loading Loading @@ -1451,11 +1450,5 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) int cntr_push_pop = 0; /* global counter for checking balanced push_wmops()/pop_wmops() pairs when WMOPS is not activated */ #endif #undef WMC_TOOL_SKIP scripts/tools/Linux/wmc_tool (199 KiB) File changed.No diff preview for this file type. View original file View changed file scripts/tools/Win32/wmc_tool.exe LFS (131 B) File changed.No diff preview for this file type. View original file View changed file Loading
lib_debug/wmc_auto.c +12 −19 Original line number Diff line number Diff line Loading @@ -29,13 +29,13 @@ #include "wmc_auto.h" /*-------------------------------------------------------------------* * WMOPS counting tool *--------------------------------------------------------------------*/ #define WMC_TOOL_SKIP /* Skip the instrumentation of this file, if invoked by accident */ #ifdef WMOPS #define WMC_TOOL_SKIP /* Skip the instrumentation of this file, if invoked by accident */ /*-------------------------------------------------------------------* * Complexity counting tool *--------------------------------------------------------------------*/ #define MAX_RECORDS 1024 #define MAX_CHAR 64 Loading Loading @@ -353,7 +353,7 @@ void print_wmops(void) fprintf(stdout, sfmtt, "---------------", "---", "--------------"); fprintf(stdout, "\n\n"); fprintf(stdout, "\nInstruction Type Analysis (for worst case frame #%ld):\n\n", fnum_cnt_wc); /* added -- JPA */ fprintf(stdout, "\nInstruction Type Analysis (for the worst-case frame %ld):\n\n", fnum_cnt_wc); /* added -- JPA */ for (i = 0; i < NUM_INST; i++) { switch ((enum instructions)i) Loading Loading @@ -450,7 +450,7 @@ void print_wmops(void) * #define WMC_TOOL_SKIP ... #undef WMC_TOOL_SKIP macro pair around the malloc(), calloc() and free(). *--------------------------------------------------------------------*/ #define MAX_RECORDABLE_CALLS 40 #define MAX_RECORDABLE_CALLS 100 #define MAX_FUNCTION_NAME_LENGTH 35 /* Maximum length that the function string will be truncated to */ #define MAX_PARAMS_LENGTH 50 /* Maximum length that the parameter string will be truncated to */ #define MAX_NUM_RECORDS 300 /* Initial maximum number of memory records -> mightb be increased during runtime, if needed */ Loading Loading @@ -716,16 +716,15 @@ static void print_stack_call_tree(void) strncpy(fctname, caller_info_ptr->function_name, MAX_FUNCTION_NAME_LENGTH); strcat(fctname, "()"); fprintf(stdout, "%-42s", fctname); fprintf(stdout, "%-42s", caller_info_ptr->function_name); /* Print Stack Usage (Based on Difference) */ if (call_level != 0) { fprintf(stdout, "%lu\n", ((caller_info_ptr - 1)->stack_ptr - caller_info_ptr->stack_ptr) * sizeof(int16_t) / sizeof(float)); fprintf(stdout, "%lu %s\n", (((caller_info_ptr - 1)->stack_ptr - caller_info_ptr->stack_ptr) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size]); } else { fprintf(stdout, "\n"); fprintf(stdout, "%lu %s\n", ((ptr_base_stack - caller_info_ptr->stack_ptr) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size]); } /* Advance */ Loading Loading @@ -806,7 +805,7 @@ void* mem_alloc( exit(-1); } /* Save all zuxiliary information about the memory block */ /* Save all auxiliary information about the memory block */ strncpy(ptr_record->name, func_name, MAX_FUNCTION_NAME_LENGTH); ptr_record->name[MAX_FUNCTION_NAME_LENGTH] = '\0'; strncpy(ptr_record->params, size_str, MAX_PARAMS_LENGTH); /* Note: The size string starts with either 'm' or 'c' to indicate 'm'alloc or 'c'alloc */ Loading Loading @@ -1367,7 +1366,7 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) for (i = 0; i < nElem; i++) { fprintf(stdout, "Program ROM size (%s): %d words (instructions)\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size); fprintf(stdout, "Program ROM size (%s): %d instruction words\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].PROM_size); } fprintf(stdout, "\n\n --- Table ROM (const data) usage --- \n\n"); Loading @@ -1379,7 +1378,7 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) fprintf(stdout, "Error: Cannot retrieve or calculate Table ROM size of (%s)!\n", Const_Data_PROM_Table[i].file_spec); } fprintf(stdout, "Table ROM size (%s): %d words\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].Get_Const_Data_Size_Func()); fprintf(stdout, "Table ROM size (%s): %d %s\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].Get_Const_Data_Size_Func() >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size]); } } Loading @@ -1392,7 +1391,7 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) if (ptr_base_stack - ptr_max_stack > 0) { fprintf(stdout, "\n\n --- Stack usage --- \n\n"); fprintf(stdout, "Maximum stack size: %lu %s in frame #%d\n", ((ptr_base_stack - ptr_max_stack) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], fprintf(stdout, "Maximum stack size: %lu %s in frame %d\n", ((ptr_base_stack - ptr_max_stack) * sizeof(int16_t)) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size], wc_frame); #ifdef MEM_COUNT_DETAILS print_stack_call_tree(); Loading Loading @@ -1451,11 +1450,5 @@ void print_mem(ROM_Size_Lookup_Table Const_Data_PROM_Table[]) int cntr_push_pop = 0; /* global counter for checking balanced push_wmops()/pop_wmops() pairs when WMOPS is not activated */ #endif #undef WMC_TOOL_SKIP
scripts/tools/Linux/wmc_tool (199 KiB) File changed.No diff preview for this file type. View original file View changed file
scripts/tools/Win32/wmc_tool.exe LFS (131 B) File changed.No diff preview for this file type. View original file View changed file