This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Fix format in c-call-graph
- From: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 Nov 2002 16:24:20 +0100
- Subject: Re: [tree-ssa] Fix format in c-call-graph
- References: <u8u1i0ix1t.fsf@gromit.moeb>
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