Skip to content

Commit 60ec822

Browse files
authored
Support additional perf counter providers (#1529)
* Extends infrastructure to allow specifying arbitrary number of perf counter providers. * Add support for Kestrel and Npgsql counters. Closes #1513
1 parent 67edab5 commit 60ec822

File tree

4 files changed

+72
-29
lines changed

4 files changed

+72
-29
lines changed

src/Benchmarks.ServerJob/ServerJob.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ public ServerJob ClearServerCounters()
143143
// Other collection options
144144
public bool CollectStartup { get; set; }
145145
public bool CollectCounters { get; set; }
146+
147+
/// <summary>
148+
/// The list of performance counter providers to be collected. Defaults to <c>System.Runtime</c>.
149+
/// </summary>
150+
public List<string> CounterProviders { get; set; } = new List<string>();
151+
146152
public string BasePath { get; set; }
147153
public int ProcessId { get; set; }
148154
public Dictionary<string, string> EnvironmentVariables { get; set; } = new Dictionary<string, string>();

src/BenchmarksDriver2/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Options:
7070
--[JOB].dotnetTraceProviders <profile|flags> An optional profile name or list of dotnet-trace providers can be passed. Default is 'cpu-sampling'. See https://github.com/dotnet/diagnostics/blob/master/documentation/dotnet-trace-instructions.md for details. e.g., Microsoft-DotNETCore-SampleProfiler, Microsoft-Windows-DotNETRuntime, gc-verbose. Can be used multiple times to set multiple providers.
7171
--[JOB].options.traceOutput <filename> The name of the trace file. Can be a file prefix (app will add *.DATE*.zip) , or a specific name and no DATE* will be added e.g., c:\traces\mytrace
7272
--[JOB].collectCounters <true|false> Whether to collect dotnet counters.
73+
--[JOB].counterProviders <provider> The name of a performance counter provider from which to collect.
7374
--[JOB].collectStartup <true|false> Whether to includes the startup phase in the traces, i.e after the application is launched and before it is marked as ready. For a web application it means before it is ready to accept requests.
7475
7576
## Environment

src/BenchmarksServer/Microsoft.Diagnostics.Tools.RuntimeClient/Eventing/SessionConfiguration.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public SessionConfiguration(uint circularBufferSizeMB, EventPipeSerializationFor
2525
throw new ArgumentException("Unrecognized format");
2626
if (providers == null)
2727
throw new ArgumentNullException(nameof(providers));
28-
if (providers.Count() <= 0)
28+
if (providers.Count <= 0)
2929
throw new ArgumentException($"Specified providers collection is empty.");
3030

3131
CircularBufferSizeInMB = circularBufferSizeMB;
@@ -37,7 +37,6 @@ public SessionConfiguration(uint circularBufferSizeMB, EventPipeSerializationFor
3737
public uint CircularBufferSizeInMB { get; }
3838
public EventPipeSerializationFormat Format { get; }
3939

40-
4140
public IReadOnlyCollection<Provider> Providers => _providers.AsReadOnly();
4241

4342
private readonly List<Provider> _providers;

0 commit comments

Comments
 (0)