# Static metrics overview

Statistical measurement of source code properties is an extremely important matter when you are planning your test work for a software project. HCL OneTest™ Embedded provides a static metrics report, which displays complexity data and statistics for your source code.

## Halstead metrics

Halstead complexity measurement was developed to measure a program module's complexity directly from source code, with emphasis on computational complexity. The measures were developed by the late Maurice Halstead as a means of determining a quantitative measure of complexity directly from the operators and operands in the module.

Halstead provides various indicators of the module's complexity

Parameter | Meaning |
---|---|

n_{1} |
Number of distinct operators |

n_{2} |
Number of distinct operands |

N_{1} |
Number of operator instances |

N_{2} |
Number of operand instances |

Metric | Meaning | Formula |
---|---|---|

n | Vocabulary | n_{1} + n_{2} |

N | Size | N_{1} + N_{2} |

V | Volume | N * log2 n |

D | Difficulty | n_{1}/2 * N_{2}/n_{2} |

E | Effort | V * D |

B | Errors | V / 3000 |

T | Testing time | E / k |

When the project is selected, the metrics viewer displays the total testing time for the entire project.

## V(g) or cyclomatic number

The V(g) or cyclomatic number is a measure of the complexity of a source code function that is correlated with difficulty in testing. The standard value is between 1 and 10. A value of 1 means the code has no branching. A function's cyclomatic complexity should not exceed 10.

The static metrics report displays the V(g) of a function in the Metrics tab when a source file or function is selected. When the type of the selected node is a source file, the sum of the V(g) of the contained function, the mean, the maximum and the standard deviation are calculated.

At the project level, the same statistical treatment is provided for every function in any source file.