共用方式為


SPPerformanceMonitorCreationData.AssociatedHealthScoreCalculator Property

Gets or sets the object that the monitor that is created from the SPPerformanceMonitorCreationData object uses to assign health scores to performance measurements.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Property AssociatedHealthScoreCalculator As SPHealthScoreCalculator
    Get
    Set
'Usage
Dim instance As SPPerformanceMonitorCreationData
Dim value As SPHealthScoreCalculator

value = instance.AssociatedHealthScoreCalculator

instance.AssociatedHealthScoreCalculator = value
public SPHealthScoreCalculator AssociatedHealthScoreCalculator { get; set; }

Property Value

Type: Microsoft.SharePoint.Utilities.SPHealthScoreCalculator
An object for assigning health scores to performance values.

Examples

The following sample code shows this property is use. For the full example, see How to: Create, Modify, and Change a Bucket-Style Health-Score Calculator.

Uri webApplicationUri = new Uri("Http://localhost/");
SPWebApplication webApplication = SPWebApplication.Lookup(webApplicationUri);
SPHttpThrottleSettings throttleSettings = SPHttpThrottleSettings.GetHttpThrottleSettings(webApplication);

SPHttpThrottlingMonitors myMonitors = throttleSettings.PerformanceMonitors;

foreach (SPPerformanceMonitorCreationData creationData in myMonitors)
{
    if (creationData.Category == "Processor" & creationData.Counter == "% Processor Time" & creationData.Instance == "0")
    {
        SPBucketHealthScoreCalculator bucketScoreCalculator = (SPBucketHealthScoreCalculator)creationData.AssociatedHealthScoreCalculator;

    }
}
Dim webApplicationUri As New Uri("Http://localhost/")
Dim webApplication As SPWebApplication = SPWebApplication.Lookup(webApplicationUri)
Dim throttleSettings As SPHttpThrottleSettings = SPHttpThrottleSettings.GetHttpThrottleSettings(webApplication)

Dim myMonitors As SPHttpThrottlingMonitors = throttleSettings.PerformanceMonitors

For Each creationData As SPPerformanceMonitorCreationData In myMonitors
    If creationData.Category = "Processor" & creationData.Counter = "% Processor Time" & creationData.Instance = "0" Then
        Dim bucketScoreCalculator As SPBucketHealthScoreCalculator = CType(creationData. AssociatedHealthScoreCalculator, SPBucketHealthScoreCalculator)

    End If
Next creationData

See Also

Reference

SPPerformanceMonitorCreationData Class

SPPerformanceMonitorCreationData Members

Microsoft.SharePoint.Utilities Namespace