SPBucketHealthScoreCalculator.CalculateScore method

SharePoint 2013

Gets a health score, from 0 through 10, for the specified performance measurement value.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

```public override int CalculateScore(
double value
)
```

Parameters

value
Type: System.Double

A performance value.

Return value

Type: System.Int32
A health score from 0 through 10.

Remarks

The CalculateScore(Double) method is called by the performance monitoring infrastructure of Microsoft SharePoint Foundation. You do not ordinarily call it from your own code.

The generated scores are always from 0 through 10, with 0 being the healthiest score and 10 the least healthy.

The CalculateScore(Double) method translates any measured value into an integer from 0 through 10, depending on where the value falls in the ranges marked by elements of a private array. If buckets is the name of that array, any value that is less than buckets[0] (or greater than it, if buckets is descending) is scored as a 0, which is the healthiest possible score. Any value that is greater than buckets[buckets.Length-1] (or less than it, if buckets is descending) is scored as a 10, which is the least healthy score. Other measured values get scored from 1 through 9 depending on where they fall with respect to the values in buckets.

For example, if one way of measuring the performance of a Web application has values from 0 through 50 (with the low values indicating health), the numbers 10, 20, 30, and 40 can be the boundaries of ranges ("buckets"). This division creates five buckets, including the bucket of values below 10 and the bucket of values above 40. If an SPBucketHealthScoreCalculator object is constructed with the array [10, 20, 30, 40] (or it is set to that array by the SetScoreBuckets([]) method), the CalculateScore(Double) method of the object generates scores according to the following rules:

• 0 for performance values less than 10

• 3 for values between 10 and 20

• 5 for values between 20 and 30

• 8 for values between 30 and 40

• 10 for values above 40