DiagnosticMonitorConfiguration.PerformanceCounters Property
Gets or sets the buffer configuration for performance counter data.
Namespace: Microsoft.WindowsAzure.Diagnostics
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)
/** @property */ /** @attribute CompilerGeneratedAttribute() */ public PerformanceCountersBufferConfiguration get_PerformanceCounters () /** @property */ /** @attribute CompilerGeneratedAttribute() */ public void set_PerformanceCounters (PerformanceCountersBufferConfiguration value)
CompilerGeneratedAttribute public function get PerformanceCounters () : PerformanceCountersBufferConfiguration CompilerGeneratedAttribute public function set PerformanceCounters (value : PerformanceCountersBufferConfiguration)
Property Value
Type: Microsoft.WindowsAzure.Diagnostics.PerformanceCountersBufferConfigurationReturns PerformanceCountersBufferConfiguration.The PerformanceCounters property is used to specify the PerformanceCountersBufferConfiguration data buffer that is used for capturing performance metrics. This property enables you to add performance counters to the DataSources collection. You can also use it to specify the default data buffer properties: BufferQuotaInMB and ScheduledTransferPeriod.
Example
The following code snippet creates a new diagnostic monitor configuration, specifies the configuration for performance counters, then starts the diagnostic monitor using the new configuration.
public override bool OnStart()
{
// Get the default initial configuration for DiagnosticMonitor.
DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();
// Use 30 seconds for the performance counter sample rate.
TimeSpan perfSampleRate = TimeSpan.FromSeconds(30.0);
// Add a performance counter for requests per second.
diagnosticConfiguration.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
{
CounterSpecifier = @"\ASP.NET\Requests/Sec",
SampleRate = perfSampleRate
});
// Transfer the counters every 30 minutes.
diagnosticConfiguration.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);
// Start the DiagnosticMonitor using the diagnosticConfig and our connection string.
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfiguration);
return base.OnStart();
}
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Development Platforms
Windows Vista, Windows 7 and Windows Server 2008Target Platforms