File: complexity.texi

package info (click to toggle)
complexity 1.10%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,700 kB
  • sloc: sh: 5,111; ansic: 1,936; makefile: 97
file content (161 lines) | stat: -rw-r--r-- 5,086 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
\input texinfo
@ignore
\internalpagesizes{46\baselineskip}{6in}{-.25in}{-.25in}{\bindingoffset}{36pt}%
@end ignore
@c %**start of header
@setfilename complexity.info
@settitle GNU Complexity - Measure complexity of C source
@setchapternewpage off
@syncodeindex pg cp
@c %**end of header
@copying
This manual is for Complexity version 1.10, updated March 2016.

Copyright @copyright{} 2011-2016 by Bruce Korb.

@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@end quotation
@end copying

@ignore
EDIT THIS FILE WITH CAUTION  (complexity.texi)

It has been AutoGen-ed
From the definitions    ../src/opts.def
and the template file   complexity-tpl.texi
@end ignore

@dircategory Software development
@direntry
* Complexity: (complexity).         Measure complexity of C source.
@end direntry

@finalout
@titlepage
@title Complexity - Measure complexity of C source
@subtitle For version 1.10, updated March 2016
@author Bruce Korb
@author @email{bkorb@@gnu.org}

@page
@vskip 0pt plus 1filll
Complexity copyright @copyright{} 2011-2016 Bruce Korb

@insertcopying
@end titlepage

@contents

@ifnottex

@node Top, Introduction, , (dir)
@top Measure complexity of C source
@comment  node-name,  next,  previous,  up

This file documents Complexity version 1.10.  It is a tool designed
for analyzing the complexity of ``C'' program functions.  It is very similar
to the McCabe scoring, but addresses several issues not considered in that
scoring scheme.

This edition documents version 1.10, updated March 2016

@menu
* Introduction::            Introduction
* Complexity Computation::  Complexity Computation
* Example Output::          Example Output
* complexity Invocation::   Invoking complexity
* Copying This Manual::     Copying This Manual
* Concept Index::           General index
@end menu

@end ifnottex

@include intro.texi
@include compute.texi

@page
@node    Example Output
@chapter Example Output
@cindex  Example Output

This is a self-referential example. This output was obtained by
going into the complexity source directory and running the command:
@example
complexity --histogram --score --thresh=3 *.c
@end example

The @code{--threshold} is set to three because all of the functions
score below the default threshold of 30.  It is not zero because
there are too many trivial (0, 1 or 2) functions for a short example.

@noindent
This results in:

@example
Complexity Scores
Score | ln-ct | nc-lns| file-name(line): proc-name
    3      19      16   tokenize.c(553): skip_params
    3      22      17   tokenize.c(79): check_quote
    3      28      21   score.c(105): handle_stmt_block
    3      33      21   opts.c(924): translate_option_strings
    3      27      22   tokenize.c(158): hash_check
    3      28      23   tokenize.c(121): comment_check
    3      37      27   complexity.c(47): initialize
    3      43      35   score.c(546): handle_TKN_KW_DO
    4      20      16   tokenize.c(439): next_nonblank
    4      25      19   tokenize.c(24): skip_comment
    4      25      20   tokenize.c(580): skip_to_semi
    4      37      32   tokenize.c(365): keyword_check
    4      54      42   complexity.c(330): load_file
    5      33      28   score.c(499): handle_TKN_KW_CASE
    5      40      32   score.c(326): handle_parms
    5      55      39   complexity.c(270): popen_unifdef
    5      65      42   opts.c(687): main
    5      61      47   complexity.c(470): do_proc
    5      66      47   score.c(782): score_proc
    5      63      51   score.c(152): fiddle_subexpr_score
    5      77      57   score.c(594): handle_TKN_KW_IF
    7      53      42   score.c(676): handle_TKN_KW_FOR
    8      73      57   complexity.c(114): print_histogram
   10      57      50   tokenize.c(610): find_proc_start
   10     236     181   opts.c(961): bogus_function
   13     103      73   score.c(377): handle_expression
   14      90      65   score.c(226): handle_subexpr
   25      84      68   tokenize.c(464): next_token

Complexity Histogram
Score-Range  Lin-Ct
    0-9         753 **********************************************
   10-19        369 *****************************
   20-29         68 *****

Scored procedure ct:       28
Non-comment line ct:     1190
Average line score:         8
25%-ile score:              4 (75% in higher score procs)
50%-ile score:              5 (half in higher score procs)
75%-ile score:             10 (25% in higher score procs)
Highest score:             25 (next_token() in tokenize.c)
@end example
@page
@include invoke-complexity.texi
@page
@node Copying This Manual
@appendix Copying This Manual

You may copy this manual under the terms of the FDL
(@url{http://gnu.org/licenses/fdl.texi,the GNU Free Documentation License}).

@cindex FDL, GNU Free Documentation License
@include fdl.texi

@page
@node Concept Index
@unnumbered Concept Index

@printindex cp
@bye