Function Stress Complexity
Complexity of internal structure and external connections of a function
Description
The metric Function Stress Complexity (FSC) is a measure of the complexity of the internal structure and external connections of a function. If the internal structure of a function is complex, its FSC is high. If a function calls many other function or is called by many other function, its FSC is high. A function with a high FSC indicates a possible bottleneck in your code base.
Computation Details
For a function foo()
, Polyspace® computes FSC using this formula:
FSC = C ⋅ (Ncalling ⋅ Ncalls)2
In this formula:
C is the metric
Cyclomatic Complexity
of thefoo()
.Ncalling is the metric
Number of Calling Functions
, the number of functions that callfoo()
.Ncalls is the metric
Number of Called Functions
, the number of function called byfoo()
.
The terms Ncalling and
Ncalls represent the complexity of the
external connections of foo()
, while C
represents the complexity of the internal structure of the function. The minimum values
of Ncalling and
Ncalls are 1. That is, if
foo()
does not call any other function,
Ncalls is 1. If foo()
is not called by any other function,
Ncalling is 1.
This metric is equivalent to the MISRA software metric Component Stress Complexity.
Examples
Metric Information
Group: Function |
Acronym: FSC
|
HIS Metric: No |