Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.9
3.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"Counters10": "Memory=Faults/sec",
"Counters11": "Memory=(Page Reads/sec|Page Writes/sec|Pages/sec|Pages Input/sec|Pages Output/sec)",
"Counters12": "PhysicalDisk=\\(_Total\\)",
"Counters13": "Processor=\\(_Total\\)",
"Counters14": "Processor=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time",
"Counters13": "Processor Information=\\(_Total\\)",
"Counters14": "Processor Information=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time",
"Counters15": "System=.",
"Comments": "The counters defined are formatted as {category}={counter_match_expression}. The match expression is a regular expression to allow for handling variability of counters available on different systems. JSON content has eccentricities. Use 4-backslashes to represent a single backslash and 2-backslashes to represent a regular expression character escape."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@
"Counters10": "Memory=Faults/sec",
"Counters11": "Memory=(Page Reads/sec|Page Writes/sec|Pages/sec|Pages Input/sec|Pages Output/sec)",
"Counters12": "PhysicalDisk=\\(_Total\\)",
"Counters13": "Processor=\\(_Total\\)",
"Counters14": "Processor=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time",
"Counters13": "Processor Information=\\(_Total\\)",
"Counters14": "Processor Information=\\([0-9,]+\\)\\\\% (C[0-9]+|Idle|Interrupt|Privileged|Processor|User) Time",
"Counters15": "System=.",
"Comments": "The counters defined are formatted as {category}={counter_match_expression}. The match expression is a regular expression to allow for handling variability of counters available on different systems. JSON content has eccentricities. Use 4-backslashes to represent a single backslash and 2-backslashes to represent a regular expression character escape."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ public TimeSpan CounterDiscoveryInterval

/// <summary>
/// Defines the counter provider to use. Supported values: "Default" and "WMI".
/// When set to "Default", the monitor auto-selects WMI on systems with more than
/// 64 logical processors where the legacy .NET PerformanceCounter API fails.
/// When set to "WMI", the WMI provider is always used regardless of LP count.
/// When set to "Default" (or any value other than "WMI"), the .NET PerformanceCounter
/// API is used. When set to "WMI", the WMI provider is used. The provider is selected
/// strictly from this parameter; the monitor does not infer a provider from system
/// characteristics such as logical processor count.
/// </summary>
public string CounterProvider
{
Expand All @@ -91,21 +92,14 @@ public string CounterProvider
protected virtual string CounterProviderName => this.UseWmiProvider ? "WMI" : ".NET SDK";

/// <summary>
/// Returns true when the WMI provider should be used, based on the CounterProvider
/// parameter and the system's logical processor count.
/// Returns true only when the <see cref="CounterProvider"/> parameter is explicitly
/// set to "WMI". No implicit/automatic selection is performed.
/// </summary>
protected bool UseWmiProvider
{
get
{
if (string.Equals(this.CounterProvider, "WMI", StringComparison.OrdinalIgnoreCase))
{
return true;
}

// Auto-select WMI when the system has >64 logical processors.
// The legacy .NET PerformanceCounter API fails on these systems.
return Environment.ProcessorCount > 64;
return string.Equals(this.CounterProvider, "WMI", StringComparison.OrdinalIgnoreCase);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ namespace VirtualClient.Monitors

/// <summary>
/// Monitor captures performance counters from Windows systems using WMI
/// (CimSession querying Win32_PerfFormattedData_* classes). Required on
/// bare-metal systems with more than 64 logical processors where the legacy
/// .NET PerformanceCounter API fails.
/// (CimSession querying Win32_PerfFormattedData_* classes). Opt-in alternative
/// to the default .NET PerformanceCounter API path.
/// </summary>
/// <remarks>
/// This subclass always uses the WMI provider regardless of the CounterProvider
/// parameter or logical processor count. It can be referenced directly in profiles
/// as an alternative to setting CounterProvider=WMI on the base class.
/// parameter. It can be referenced directly in profiles as an alternative to
/// setting CounterProvider=WMI on the base class.
/// </remarks>
public class WindowsWmiPerformanceCounterMonitor : WindowsPerformanceCounterMonitor
{
Expand All @@ -37,7 +36,7 @@ public WindowsWmiPerformanceCounterMonitor(IServiceCollection dependencies, IDic
protected override string CounterProviderName => "WMI";

/// <summary>
/// Always uses WMI for counter discovery, bypassing the auto-detection logic.
/// Always uses WMI for counter discovery.
/// </summary>
protected override void LoadCounters(EventContext telemetryContext, CancellationToken cancellationToken)
{
Expand Down
Loading