Share via


SPBucketHealthScoreCalculator constructor (Double[], Boolean)

Initializes a new instance of the SPBucketHealthScoreCalculator class by using parameters that define degrees of health.

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

Syntax

'Declaration
Public Sub New ( _
    buckets As Double(), _
    isASC As Boolean _
)
'Usage
Dim buckets As Double()
Dim isASC As Boolean

Dim instance As New SPBucketHealthScoreCalculator(buckets, _
    isASC)
public SPBucketHealthScoreCalculator(
    double[] buckets,
    bool isASC
)

Parameters

  • buckets
    Type: []

    An array of values representing the boundaries between ranges of values in some measure of performance.

  • isASC
    Type: System.Boolean

    true to indicate that the values in the buckets array get progressively larger from the first to the last element (that is, they are ascending), false to indicate that they get progressively smaller.

Exceptions

Exception Condition
ArgumentOutOfRange

buckets is a null reference (Nothing in Visual Basic) or empty.

ArgumentException

The value of isASC is inconsistent with the actual pattern of values in buckets.

Remarks

The two parameters must meet certain conditions:

  • The values of the elements in buckets must be well-ordered, either from smallest to largest or from largest to smallest.

  • isASC indicates the direction of the ordering in buckets.

  • The values in buckets must also be well-ordered from healthiest to least healthy. So buckets[0] is a healthier value than buckets[1] and the latter is a healthier value than buckets[2], and so on. Hence, buckets[buckets.Length-1] must always be the least healthy value in buckets.

The CalculateScore(Double) method translates any measured value into an integer from 0 to 10, depending on where the value falls in the ranges marked by elements of buckets. 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.

There is no point to having more than 10 elements in buckets because the ultimate health scores must range from 0 through 10.

Depending on the performance measure being monitored, it is often appropriate for the values in buckets to scale exponentially.

Examples

The following example is a declaration of an array used to specify ranges of available memory, measured in megabytes.

double[] availableMemoryBuckets = new double[10]
                                  {1000.0, 500.0, 400.0, 300.0, 200.0,
                                    100.0,  80.0,  60.0,  40.0,  20.0};
Dim availableMemoryBuckets() As Double = 
                                  {1000.0, 500.0, 400.0, 300.0, 200.0,
                                    100.0, 80.0, 60.0, 40.0, 20.0}

For an example of this constructor in use, see How to: Create, Modify, and Change a Bucket-Style Health-Score Calculator.

See also

Reference

SPBucketHealthScoreCalculator class

SPBucketHealthScoreCalculator members

SPBucketHealthScoreCalculator overload

Microsoft.SharePoint.Utilities namespace

Other resources

Request Throttling

How to: Create, Modify, and Change a Bucket-Style Health-Score Calculator