SPHttpThrottleSettings.PerformanceMonitors 属性
获取保存父 Web 应用程序的性能监视器的配置信息。
命名空间: Microsoft.SharePoint.Utilities
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public ReadOnly Property PerformanceMonitors As SPHttpThrottlingMonitors
Get
用法
Dim instance As SPHttpThrottleSettings
Dim value As SPHttpThrottlingMonitors
value = instance.PerformanceMonitors
public SPHttpThrottlingMonitors PerformanceMonitors { get; }
属性值
类型:Microsoft.SharePoint.Utilities.SPHttpThrottlingMonitors
性能监视器的配置信息。
备注
相比之下, GenerateMonitors()方法返回的对象的此属性。后者包含性能监视器所报告的数据。因此若要读取的监视器的当前值,您的代码需要调用GenerateMonitors()方法。但是,若要更改监视器的配置,您的代码需要调用PerformanceMonitors属性。
示例
下面的示例演示在使用此属性。有关完整的示例,请参见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