# Function Metrics

The following metrics are generated for functions (methods) in the project source code. For library functions (those functions in the source code for which there is no definition), only the fan-in metrics apply.

### Size Metrics

 Lines in Function Number of lines in the function. Lines of Source Code Number of lines of statements in the function. Variables in Function Number of parameters and locals variables in the function. To be accurate (non-zero), data must be collected with the -locals option enabled.

### McCabe Complexity Metrics

 McCabe Cyclomatic Cmplx Cyclomatic complexity of the function (McCabe v(G)). This represents the number of decision points in the function. It also represents the number of linearly independent test paths through the function. Users may also select alternative calculations of cyclomatic complexity, either Myers' 1979 Extension counting predicates within decisions, or the Modified definition counting parallel cases as a single decision. McCabe Decision Density Decision density (cyclomatic density) of a function. Calculated as the ratio of the cyclomatic complexity to the lines of statements for the function. McCabe Essential Cmplx Essential complexity of the function (McCabe ev(G)). This represents the number of decision points in the function which contain unstructured constructs. McCabe Essential Density Essential density, or degree of unstructuredness, of a function. Calculated as the ratio of the essential complexity to the cyclomatic complexity.

### Other Complexity Metrics

 Decision Depth in Function Number of nested levels of decisions or control statements within the function. Halstead Intelligent Content Language-independent measure of the amount of content (complexity) of the function (Halstead I). Halstead Mental Effort Measure of the number of elemental mental discriminations necessary to create, or understand, the function (Halstead E). Halstead Program Volume Measure of the information content of the function (Halstead V). Halstead Program Difficulty Measure of how compactly the function implements its algorithms (Halstead D). This is the inverse of the Halstead Program Level (of abstraction). Knots Measure of the complexity and unstructuredness of the function (Woodward, Hennell and Hedley knot).

### Control Flow Metrics

 Fan In of Function Calls Number of functions in the source files loaded into the project which call or read the function, either directly or through function pointers. Fan Out of Function Calls Number of functions which are called or read by the function, either directly or through function pointers. Global Variables Used Number of global variables set and/or read by the function. Static Variables Used Number of static variables set and/or read by the function. Transitive Fan In of Funcs Number of functions in the source files loaded into the project which transitively call or read the function, including calls through function pointers. Transitive Fan Out of Funcs Number of functions which are transitively called or read by the function, including calls through function pointers.

### Profile Metrics

 All profile metrics require that appropriate profile data be loaded. Coverage Percentage of blocks of code that were executed. Frequency Number of times the function was called during execution. Time Time spent executing the function.