Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Halstead metrics allow you to evaluate the testing time of any C/C++ source code. These only
make sense at the source file level and vary with the following parameters:
Parameter Meaning
n1 Number of distinct operators
n2 Number of distinct operands
N1 Number of operator instances
N2 Number of operand instances
When a source file node is selected in the Metrics Viewer, the following results are displayed in
the Metrics report:
Program vocabulary n n= n1 + n2
Volume V V= N * (LOG2 n)
Effort E E= D * V
Example – List out the operators and operands and also calculate the values of software science
measures like
{
int i, j, save, im1;
/*This function sorts array x in ascending order */
If (n< 2) return 1;
for (i=2; i< =n; i++)
{
im1=i-1;
for (j=1; j< =im1; j++)
if (x[i] < x[j])
{
Save = x[i];
x[i] = x[j];
x[j] = save;
}
}
return 0;
}
Explanation –