Skip to content

Commit 8eb9f39

Browse files
committed
feat: add IsServerGC for RuntimeInfo
1 parent e626a28 commit 8eb9f39

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/WeihanLi.Common/Helpers/ApplicationHelper.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache license.
33

44
using System.Reflection;
5+
using System.Runtime;
56
using System.Runtime.InteropServices;
67
using WeihanLi.Extensions;
78

@@ -158,6 +159,8 @@ private static RuntimeInfo GetRuntimeInfo()
158159
MachineName = Environment.MachineName,
159160
UserName = Environment.UserName,
160161

162+
IsServerGC = GCSettings.IsServerGC,
163+
161164
IsInContainer = IsInContainer(),
162165
IsInKubernetes = IsInKubernetesCluster(),
163166
KubernetesNamespace = GetKubernetesNamespace(),
@@ -250,6 +253,12 @@ public class RuntimeInfo : LibraryInfo
250253
public required string RuntimeIdentifier { get; init; }
251254
#endif
252255

256+
// GC
257+
/// <summary>Gets a value that indicates whether server garbage collection is enabled.</summary>
258+
/// <returns>
259+
/// <see langword="true" /> if server garbage collection is enabled; otherwise, <see langword="false" />.</returns>
260+
public required bool IsServerGC { get; init; }
261+
253262
public required string WorkingDirectory { get; init; }
254263
public required int ProcessId { get; init; }
255264
public required string ProcessPath { get; init; }

0 commit comments

Comments
 (0)