You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* simplify GetRuntimeVersion logic, introduce IsOldMono and IsNewMono helper methods
* add a failing test
* fix MemoryDiagnoser for MonoVM on .NET 6+
keep it a nop for WASM (I have no ability to test it quickly)
if(RuntimeInformation.IsMono)// Monitoring is not available in Mono, see http://stackoverflow.com/questions/40234948/how-to-get-the-number-of-allocated-bytes-in-mono
270
+
if(RuntimeInformation.IsOldMono)// Monitoring is not available in Mono, see http://stackoverflow.com/questions/40234948/how-to-get-the-number-of-allocated-bytes-in-mono
Copy file name to clipboardExpand all lines: src/BenchmarkDotNet/Engines/GcStats.cs
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,11 @@ public static GcStats FromForced(int forcedFullGarbageCollections)
132
132
133
133
privatestaticlongGetAllocatedBytes()
134
134
{
135
-
if(RuntimeInformation.IsMono)// Monitoring is not available in Mono, see http://stackoverflow.com/questions/40234948/how-to-get-the-number-of-allocated-bytes-
135
+
if(RuntimeInformation.IsOldMono)// Monitoring is not available in Mono, see http://stackoverflow.com/questions/40234948/how-to-get-the-number-of-allocated-bytes-
136
+
return0;
137
+
138
+
// we have no tests for WASM and don't want to risk introducing a new bug (https://github.com/dotnet/BenchmarkDotNet/issues/2226)
139
+
if(RuntimeInformation.IsWasm)
136
140
return0;
137
141
138
142
// "This instance Int64 property returns the number of bytes that have been allocated by a specific
/// returns true for both the old (implementation of .NET Framework) and new Mono (.NET 6+ flavour)
30
+
/// </summary>
28
31
publicstaticboolIsMono{get;}=Type.GetType("Mono.RuntimeStructs")!=null;// it allocates a lot of memory, we need to check it once in order to keep Engine non-allocating!
// code copied from https://github.com/dotnet/runtime/blob/2c573b59aaaf3fd17e2ecab95ad3769f195d2dbc/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs#L20-L30
// code copied from https://github.com/dotnet/runtime/blob/2c573b59aaaf3fd17e2ecab95ad3769f195d2dbc/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs#L20-L30
0 commit comments