FPT and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Reference Manual Home |
Syntax:
[DO NOT] SHOW METRICS [DO NOT] SHOW [CYCLOMATIC] COMPLEXITY [DO NOT] SHOW [CYCLOMATIC] COMPLEXITIES |
Function:
FPT reports metrics for the code analysed. The metrics reported are:
Files
The number of primary files The number of include files
Code and Comments
The number of declaration lines. Note that lines in include files are couinted only once, no matter how many times the files are
referenced by INCLUDE or #include constructs. The number of executable lines. Again, if include files contain executable code, each line in an include file is counted only once. The total number of code lines (excluding comments and blank lines). The number of comment text lines. Comment text lines contain alphanumeric characters after the comment delimiter. The number of comment separator lines. These are comment lines which contain non-alphanumeric characters, for example, a line of
equals characters extending across a line to separate code sections. The number of blank lines. A blank line contains no characters other than white space and possibly a leading comment delimiter. The total number of comment lines, including the blank lines and separators. The total number of lines, code and comments. The number of trailing comments. Note that the number of comment text lines may not adequately represent the amount of commentary
in the code. Much of the commentary, particularly in declarations, may be in trailing comments. the number of words in comments. Words are considered to be sequences of one or more alphanumeric characters (Other than the
fixed format comment delimiters) separated by white space or non-alphanumeric characters. This is perhaps the best measure of the density
of commentary. A typical value for a well commented code would be about 2 words of commentary for each total line of code.
Program units
The numbers of:
Block data
Modules
Subroutines (Excluding module and internal subroutines)
Functions (Excluding module and internal functions)
Module subroutines
Module functions
Internal subroutines
Internal Functions
Additional entries (introduced by ENTRY statements)
Generic interfaces
Specific interfaces
The number of unresolved references to routines which are missing.
The maximum call depth. (This value is unrealistic if routines are called recursively).
Program flow and cyclomatic complexity
Normal path code nodes. These are nodes which may be reached without traversing an exception handler, for example
at the label 999 referenced
in READ(9,220,ERR=999)alpha. Exception code nodes Total nodes Normal path code edges Exception code edges Total code edges Executable sub-programs (Programs, subroutines, functions, module and internal subroutines and functions). Normal path code complexity Total code complexity. This may be considered as a measure of the cost of ownership of a code. Complexity per sub-program. This may be considered as a better measure of algorithmic complexity than the total complexity.
A value less than 10 is considered desirable
Usage of Names for Objects Other than Local Variables
Names used for non-locals. Non-local names are the names of globally visible sub-programs, of objects in COMMON blocks and
of objects which are public in modules. These are objects which may be visible in multiple sub-programs.
Mean length of non-local names. This is a measure of the extent to which the names are likely to be meaningful. Note that the meassure is applied only to non-local objects. Many routines have variables called "i" and "j", but these are usually local.
Cyclomatic complexities of sub-programs
FPT lists the cyclomatic complexities of all sub-programs.
The command SHOW COMPLEXITIES prints this table and does not show the code metrics described above.
Before the metrics report is made, FPT checks whether the code metrics have been disturbed by software engineering and formatting commands made earlier in processing. If this has occurred a note is issued, e.g.:
------------------------------------------------------------------------------
NOTE Number 3025 Severity 0 (Worst 2) Count 6205
Line counts have been changed by software engineering commands
------------------------------------------------------------------------------
FPT also carries out the program flow analysis, checking for unreachable code, if this analysis has not already been made. Warnings may be issued if unreachable code sections are detected.
Where to use these commands:
Operating system command line |
Yes |
|
Configuration file, config.fsp |
Yes |
|
Specification (FSP) files, *.fsp |
Yes |
|
Interactively, to FPT> prompt: |
Yes |
|
Interactive command files |
Yes |
|
Embedded in the Fortran code |
No |
|
Default:
The report is not made by default (Note that defaults may be changed in the configuration file).
Example:
The file metrics table for the major climate and weather modelling code, WRF V3.4.1 is shown below. Note that the call depth metric is spurious because routines are called recursively.
Program Metrics
===============
Main Code System Total
Files
Primary files 412 0 412
Include files 71 0 71
Code and comments
Declaration lines 142984 0 142984
Executable lines 344869 0 344869
Total code lines 487853 0 487853
Comment text lines 1199858 0 1199858
Comment separator lines 10034 0 10034
Blank lines 76293 0 76293
Total comment lines 1286185 0 1286185
Total lines 1774038 0 1774038
Trailing comments 33491 0 33491
Words in comments 3471026 0 3471026
Program units
Programs 3 0 3
Block Data 1 0 1
Modules 336 0 336
Subroutines 4380 0 4380
Functions 41 0 41
Module subroutines 2032 0 2032
Module Functions 304 0 304
Internal subroutines 31 0 31
Internal Functions 9 0 9
Additional entries 1 0 1
Generic interfaces 57 0 57
Specific interfaces 116 0 116
Unresolved references 184
Maximum call depth 7497
Program flow and cyclomatic complexity
Normal path code nodes 111101 0 111101
Exception code nodes 72 0 72
Total nodes 111173 0 111173
Normal path code edges 153054 0 153054
Exception code edges 137 0 137
Total code edges 153191 0 153191
Executable sub-programs 6800 0 6800
Normal path code complexity 41953 0 41953
Total code complexity 42018 0 42018
Complexity per sub-program 6.179 6.179
Usage of Names for Objects Other than Local Variables
Names used for non-locals 22383
% used inconsistently 37.850
Mean length (Characters) 11.118
Cyclomatic Complexities
=======================
Nodes Edges Complexity
acm 101 139 38
acm2d 72 100 28
acminit 17 25 8
acmpbl 12 15 3
activate 246 347 101
adapt_timestep 55 78 23
addfld 1 1 0
add_a2a 7 9 2
add_a2a_ph 7 9 2
add_a2c_u 7 9 2
:
:
The complexity table continues.
Copyright ©1995 to 2014 Software Validation Ltd. All rights reserved.