From 8dfaf3c5763f6c446e563a0e673b039432e5e570 Mon Sep 17 00:00:00 2001 From: Mukund Raghav Sharma Date: Wed, 8 May 2024 08:17:02 -0700 Subject: [PATCH] Allowing CPU traces for Linux --- .../ASPNetBenchmarks.CommandBuilder.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/CommandBuilders/ASPNetBenchmarks.CommandBuilder.cs b/src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/CommandBuilders/ASPNetBenchmarks.CommandBuilder.cs index 5b0e14e902e..29a27cc0b0f 100644 --- a/src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/CommandBuilders/ASPNetBenchmarks.CommandBuilder.cs +++ b/src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure.Core/CommandBuilders/ASPNetBenchmarks.CommandBuilder.cs @@ -67,16 +67,25 @@ public static (string, string) Build(ASPNetBenchmarksConfiguration configuration else { - if (configuration.TraceConfigurations.Type != "gc") + if (configuration.TraceConfigurations.Type != "gc" || configuration.TraceConfigurations.Type != "cpu") { - throw new ArgumentException($"{nameof(ASPNetBenchmarksCommandBuilder)}: Currently only GCCollectOnly traces are allowed for Linux."); + throw new ArgumentException($"{nameof(ASPNetBenchmarksCommandBuilder)}: Currently only GCCollectOnly and CPU traces are allowed for Linux."); } else { - traceFileSuffix = ".nettrace"; - commandStringBuilder.Append(" --application.dotnetTrace true "); - commandStringBuilder.Append(" --application.dotnetTraceProviders gc-collect "); + if (configuration.TraceConfigurations.Type == "gc") + { + traceFileSuffix = ".nettrace"; + commandStringBuilder.Append(" --application.dotnetTrace true "); + commandStringBuilder.Append(" --application.dotnetTraceProviders gc-collect "); + } + + else + { + commandStringBuilder.Append(" --application.collect true "); + commandStringBuilder.Append(" --application.collectStartup true "); + } } }