Metrics - overview and description

Column abbreviation in Standard Metrics view

Description

Code size

Code size [number of bytes] ("code size")

Variables size

Variables size [number of bytes] ("variable size")

Stack size

Stack size [number of bytes] ("stack size")

Calls

Number of calls ("calls")

Tasks

Called in tasks ("tasks")

Globals

Used different global variables ("Globals")

IOs

Number of direct address accesses ("IOs")

Locals

Number of local variables ("local")

Inputs

Number of input variables ("inputs")

Outputs

Number of output variables ("outputs")

NOS

NOS - Number Of Statements ("NOS")

Comments

Percentage of comments ("comments")

McCabe

Complexity (McCabe) ("McCabe")

Prather

Complexity of nesting (Prather) ("Prather")

DIT

DIT - depth of inheritance tree ("DIT")

NOC

NOC - number of children ("NOC")

RFC

RFC - response for class ("RFC")

CBO

CBO - coupling between objects ("CBO")

Elshof

Complexity of reference (Elshof) ("Elshof")

LCOM

Lack of cohesion of methods (LCOM) ("LCOM")

n1 (Halstead)

Halstead – number of different used operators (n1)

N1 (Halstead)

Halstead – number of operators (N1)

n2 (Halstead)

Halstead – number of different used operands (n2)

N2 (Halstead)

Halstead – number of operands (N2)

HL (Halstead)

Halstead – length (HL)

HV (Halstead)

Halstead – volume (HV)

D (Halstead)

Halstead – difficulty (D)

SFC branches

Number of SFC branches

SFC steps

Number of SFC steps

 

Detailed description

Code size [number of bytes] ("code size")

Code size as number of bytes.

Variables size [number of bytes] ("variable size")

Variables size as number of bytes.

Stack size [number of bytes] ("stack size")

Stack size as number of bytes.

Number of calls ("calls")

Number of function block calls within the application.

Called in tasks ("tasks")

Number of tasks calling the function block.

Used different global variables ("Globals")

Number of different global variables used in the function block.

Number of direct address accesses ("IOs")

Number of IO access operations in the function block = number of all read and write access operations to a direct address.

Example:

The number of direct address access operations for the MAIN program is 2.

PROGRAM MAIN
VAR
    OnOutput AT%QB1 : INT;
    nVar            : INT;
END_VAR
OnOutput := 123;
nVar     := OnOutput;

Number of local variables ("local")

Number of local variables in the function block (VAR).

Number input variables ("inputs")

Number of input variables in the function block (VAR_INPUT).

Number output variables ("outputs")

Number of output variables in the function block (VAR_OUTPUT).

Number of statements ("NOS")

NOS: Number Of executable Statements

NOS = number of executable statements in the function block

Percentage of comments ("comments")

Comment proportion = number of comments / number of statements in a function block

For the purpose of this definition, statements also include declaration statements, for example.

Complexity (McCabe) ("McCabe")

Complexity = number of binary branches in the control flow graph for the function block (e.g. the number of branches in IF and CASE statements and loops)

Complexity of nesting (Prather) ("Prather")

Nesting weight = statements * nesting depth

Complexity of nesting = nesting weight / number statements

Nesting through IF/ELSEIF or CASE/ELSE statements, for example.

Depth of inheritance tree ("DIT")

DIT: Depth of Inheritance Tree

DIT = inheritance depth or maximum path length from the root to the class under consideration

Number of children ("NOC")

NOC: Number Of Children

NOC = number of child classes or number of direct class specializations

Response for class ("RFC")

RFC: Response For Class

RFC = number of methods that can potentially be executed, if an object of the class under consideration responds to a received message

The value is used for measuring the complexity (in terms of testability and maintainability). All possible direct and indirect method calls can be reached via associations are taken into account.

Coupling between objects ("CBO")

CBO: Coupling Between Objects

CBO = number of classes coupled with the class under consideration

The value is used to indicate the coupling between object classes. Coupling refers to a situation where a class uses instance variables (variables of an instantiated class) and the methods of another class.

Complexity of reference (Elshof) ("Elshof")

Complexity of reference = referenced data (number of variables) / number of data references

Lack of cohesion of methods (LCOM) ("LCOM")

Cohesion = pairs of methods without common instance variables minus pairs of methods with common instance variables

This cohesion value is a measure for the encapsulation of a class. The higher the value, the poorer the encapsulation. Reciprocal method and property calls (without init or exit) are also taken into account.

Halstead ("n1","N1","n2","N2", "HL", "HV", "D")

The following metrics are part of the "Halstead" range:

- Number of different used operators - Halstead (n1)

- Number of operators - Halstead (N1)

- Number of different used operands - Halstead (n2)

- Number of operands - Halstead (N2)

- Length - Halstead (HL)

- Volume - Halstead (HV)

- Difficulty - Halstead (D)

 

Background information:

 

For each program the following basic parameters are formed:

 

These parameters are used to calculate the Halstead length (HL) and Halstead volume (HV):

 

Various indicators are calculated from the basic parameters:

The indicators usually match the actual measured values very well. The disadvantage is that the method only applies to individual functions and only measures lexical/textual complexity.

Number of SFC branches

If the function block is implemented in the Sequential Function Chart language (SFC), this code metric indicates the number of branches in the function block.

Number of SFC steps

If the function block is implemented in the Sequential Function Chart language (SFC), this code metric indicates the number of steps in the function block.