This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Fix format in c-call-graph


On Fri, Nov 29, 2002 at 09:45:34AM +0100, Andreas Jaeger wrote:
> 
>  	  /* Statements based statistics.  */
>  	  INDENT (spc+1);
> -	  output_printf (buffer, "<stats calls=\"%d\" decisions=\"%d\" stmts=\"%d\" Gilb=\"%d\"", 
> +	  output_printf (buffer, "<stats calls=\"%d\" decisions=\"%d\" stmts=\"%d\" Gilb=\"%f\"", 
>  			 nb_calls, decision_points, nb_statements, 
> -			 ((nb_statements == 0) ? 0 : 
> +			 ((nb_statements == 0) ? 0.0 : 
>  			  ((float)decision_points / (float)nb_statements)));
>  	  

This patch is fine: it's a relative number.
Quoting from my software engineering course (Woodward, M.R.), 

"Gilb (1977) defines logical complexity as a measure of how much 
decision-making logic there is in a program.  He proposed counting 
the number of IF statements as a rough measure of logical complexity 
and then introduced two more refined definitions:

Absolute logical complexity = the number of decision points
Relative logical complexity = (the number of decision points) / (the total number of statements)

As supporting evidence, Gilb quotes a study by Farr and Zagorski who 
found that absolute logical complexity was a significant factor in 
predicting software costs."


I've ran this code on the linux kernel and I've found the biggest Absolute 
logical complexity in the cdrom device driver automata: it was something 
as 800 in a single function :-)

Sebastian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]