@@ -125,18 +125,18 @@ public static bool TrySetAffinity(
125
125
internal static void SetEnvironmentVariables ( this ProcessStartInfo start , BenchmarkCase benchmarkCase , IResolver resolver )
126
126
{
127
127
if ( benchmarkCase . Job . Environment . Runtime is ClrRuntime clrRuntime && ! string . IsNullOrEmpty ( clrRuntime . Version ) )
128
- start . EnvironmentVariables [ "COMPLUS_Version" ] = clrRuntime . Version ;
128
+ SetClrEnvironmentVariables ( start , "Version" , clrRuntime . Version ) ;
129
129
130
130
if ( benchmarkCase . Job . Environment . Runtime is MonoRuntime monoRuntime && ! string . IsNullOrEmpty ( monoRuntime . MonoBclPath ) )
131
131
start . EnvironmentVariables [ "MONO_PATH" ] = monoRuntime . MonoBclPath ;
132
132
133
133
if ( benchmarkCase . Config . HasPerfCollectProfiler ( ) )
134
134
{
135
135
// enable tracing configuration inside of CoreCLR (https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/linux-performance-tracing.md#collecting-a-trace)
136
- start . EnvironmentVariables [ "COMPlus_PerfMapEnabled" ] = "1" ;
137
- start . EnvironmentVariables [ "COMPlus_EnableEventLog" ] = "1" ;
136
+ SetClrEnvironmentVariables ( start , "PerfMapEnabled" , "1" ) ;
137
+ SetClrEnvironmentVariables ( start , "EnableEventLog" , "1" ) ;
138
138
// enable BDN Event Source (https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/linux-performance-tracing.md#filtering)
139
- start . EnvironmentVariables [ "COMPlus_EventSourceFilter" ] = EngineEventSource . SourceName ;
139
+ SetClrEnvironmentVariables ( start , "EventSourceFilter" , EngineEventSource . SourceName ) ;
140
140
// workaround for https://github.com/dotnet/runtime/issues/71786, will be solved by next perf version
141
141
start . EnvironmentVariables [ "DOTNET_EnableWriteXorExecute" ] = "0" ;
142
142
}
@@ -258,21 +258,27 @@ private static void SetCoreRunEnvironmentVariables(this ProcessStartInfo start,
258
258
{
259
259
var gcMode = benchmarkCase . Job . Environment . Gc ;
260
260
261
- start . EnvironmentVariables [ "COMPlus_gcServer" ] = gcMode . ResolveValue ( GcMode . ServerCharacteristic , resolver ) ? "1" : "0" ;
262
- start . EnvironmentVariables [ "COMPlus_gcConcurrent" ] = gcMode . ResolveValue ( GcMode . ConcurrentCharacteristic , resolver ) ? "1" : "0" ;
261
+ SetClrEnvironmentVariables ( start , "gcServer" , gcMode . ResolveValue ( GcMode . ServerCharacteristic , resolver ) ? "1" : "0" ) ;
262
+ SetClrEnvironmentVariables ( start , "gcConcurrent" , gcMode . ResolveValue ( GcMode . ConcurrentCharacteristic , resolver ) ? "1" : "0" ) ;
263
263
264
264
if ( gcMode . HasValue ( GcMode . CpuGroupsCharacteristic ) )
265
- start . EnvironmentVariables [ "COMPlus_GCCpuGroup" ] = gcMode . ResolveValue ( GcMode . CpuGroupsCharacteristic , resolver ) ? "1" : "0" ;
265
+ SetClrEnvironmentVariables ( start , "GCCpuGroup" , gcMode . ResolveValue ( GcMode . CpuGroupsCharacteristic , resolver ) ? "1" : "0" ) ;
266
266
if ( gcMode . HasValue ( GcMode . AllowVeryLargeObjectsCharacteristic ) )
267
- start . EnvironmentVariables [ "COMPlus_gcAllowVeryLargeObjects" ] = gcMode . ResolveValue ( GcMode . AllowVeryLargeObjectsCharacteristic , resolver ) ? "1" : "0" ;
267
+ SetClrEnvironmentVariables ( start , "gcAllowVeryLargeObjects" , gcMode . ResolveValue ( GcMode . AllowVeryLargeObjectsCharacteristic , resolver ) ? "1" : "0" ) ;
268
268
if ( gcMode . HasValue ( GcMode . RetainVmCharacteristic ) )
269
- start . EnvironmentVariables [ "COMPlus_GCRetainVM" ] = gcMode . ResolveValue ( GcMode . RetainVmCharacteristic , resolver ) ? "1" : "0" ;
269
+ SetClrEnvironmentVariables ( start , "GCRetainVM" , gcMode . ResolveValue ( GcMode . RetainVmCharacteristic , resolver ) ? "1" : "0" ) ;
270
270
if ( gcMode . HasValue ( GcMode . NoAffinitizeCharacteristic ) )
271
- start . EnvironmentVariables [ "COMPlus_GCNoAffinitize" ] = gcMode . ResolveValue ( GcMode . NoAffinitizeCharacteristic , resolver ) ? "1" : "0" ;
271
+ SetClrEnvironmentVariables ( start , "GCNoAffinitize" , gcMode . ResolveValue ( GcMode . NoAffinitizeCharacteristic , resolver ) ? "1" : "0" ) ;
272
272
if ( gcMode . HasValue ( GcMode . HeapAffinitizeMaskCharacteristic ) )
273
- start . EnvironmentVariables [ "COMPlus_GCHeapAffinitizeMask" ] = gcMode . HeapAffinitizeMask . ToString ( "X" ) ;
273
+ SetClrEnvironmentVariables ( start , "GCHeapAffinitizeMask" , gcMode . HeapAffinitizeMask . ToString ( "X" ) ) ;
274
274
if ( gcMode . HasValue ( GcMode . HeapCountCharacteristic ) )
275
- start . EnvironmentVariables [ "COMPlus_GCHeapCount" ] = gcMode . HeapCount . ToString ( "X" ) ;
275
+ SetClrEnvironmentVariables ( start , "GCHeapCount" , gcMode . HeapCount . ToString ( "X" ) ) ;
276
+ }
277
+
278
+ private static void SetClrEnvironmentVariables ( ProcessStartInfo start , string suffix , string value )
279
+ {
280
+ start . EnvironmentVariables [ $ "DOTNET_{ suffix } "] = value ;
281
+ start . EnvironmentVariables [ $ "COMPlus_{ suffix } "] = value ;
276
282
}
277
283
}
278
284
}
0 commit comments