FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


SHOW METRICS and SHOW COMPLEXITIES

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

Code and Comments

Program units

Program flow and cyclomatic complexity

Usage of Names for Objects Other than Local Variables

Cyclomatic complexities of sub-programs

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.