Compartilhar via


SPHttpThrottleSettings.PerformanceMonitors Property

Gets persisted configuration information about the performance monitors of the parent Web application.

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

Syntax

'Declaration
Public ReadOnly Property PerformanceMonitors As SPHttpThrottlingMonitors
    Get
'Usage
Dim instance As SPHttpThrottleSettings
Dim value As SPHttpThrottlingMonitors

value = instance.PerformanceMonitors
public SPHttpThrottlingMonitors PerformanceMonitors { get; }

Property Value

Type: Microsoft.SharePoint.Utilities.SPHttpThrottlingMonitors
The configuration information of the performance monitors.

Remarks

Contrast this property with the object returned by the GenerateMonitors() method. The latter contains data that is currently being reported by the performance monitors. So to read the current values of the monitors, your code would need to call the GenerateMonitors() method . But to change the configuration of a monitor, your code would need to call the PerformanceMonitors property.

Examples

The following sample shows this property in 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

SPHttpThrottleSettings Class

SPHttpThrottleSettings Members

Microsoft.SharePoint.Utilities Namespace