diff --git a/README.md b/README.md index 5e1279021f..2fddae7bf8 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ The measured data can be exported to different formats (md, html, csv, xml, json *Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Mono, NativeAOT *Supported languages:* C#, F#, Visual Basic *Supported OS:* Windows, Linux, macOS -*Supported architectures:* x86, x64, ARM, ARM64 and Wasm +*Supported architectures:* x86, x64, ARM, ARM64, Wasm and LoongArch64 ## Features diff --git a/docs/articles/guides/console-args.md b/docs/articles/guides/console-args.md index 4e4d534123..eb179bb636 100644 --- a/docs/articles/guides/console-args.md +++ b/docs/articles/guides/console-args.md @@ -218,7 +218,7 @@ dotnet run -c Release -- --filter * --runtimes netcoreapp2.0 netcoreapp2.1 --sta * `--maxWidth` max parameter column width, the default is 20. * `--envVars` colon separated environment variables (key:value). * `--strategy` the RunStrategy that should be used. Throughput/ColdStart/Monitoring. -* `--platform` the Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64. +* `--platform` the Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64/LoongArch64. * `--runOncePerIteration` run the benchmark exactly once per iteration. * `--buildTimeout` build timeout in seconds. * `--wasmEngine` full path to a java script engine used to run the benchmarks, used by Wasm toolchain. diff --git a/docs/index.md b/docs/index.md index 4bc22f04b5..fe0d725e2d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -111,7 +111,7 @@ The measured data can be exported to different formats (md, html, csv, xml, json *Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Mono, NativeAOT *Supported languages:* C#, F#, Visual Basic *Supported OS:* Windows, Linux, macOS -*Supported architectures:* x86, x64, ARM, ARM64 and Wasm +*Supported architectures:* x86, x64, ARM, ARM64, Wasm and LoongArch64 ## Features diff --git a/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs b/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs index 7619245a49..2e8058b208 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs @@ -133,7 +133,7 @@ public class CommandLineOptions [Option("strategy", Required = false, HelpText = "The RunStrategy that should be used. Throughput/ColdStart/Monitoring.")] public RunStrategy? RunStrategy { get; set; } - [Option("platform", Required = false, HelpText = "The Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64.")] + [Option("platform", Required = false, HelpText = "The Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64/LoongArch64.")] public Platform? Platform { get; set; } [Option("runOncePerIteration", Required = false, Default = false, HelpText = "Run the benchmark exactly once per iteration.")] diff --git a/src/BenchmarkDotNet/Environments/Platform.cs b/src/BenchmarkDotNet/Environments/Platform.cs index d67e22d398..a1be71e376 100644 --- a/src/BenchmarkDotNet/Environments/Platform.cs +++ b/src/BenchmarkDotNet/Environments/Platform.cs @@ -35,6 +35,11 @@ public enum Platform /// /// S390x /// - S390x + S390x, + + /// + /// LOONGARCH64 + /// + LoongArch64 } -} \ No newline at end of file +} diff --git a/src/BenchmarkDotNet/Extensions/ConfigurationExtensions.cs b/src/BenchmarkDotNet/Extensions/ConfigurationExtensions.cs index 3cfe73d56b..ba550a37b8 100644 --- a/src/BenchmarkDotNet/Extensions/ConfigurationExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/ConfigurationExtensions.cs @@ -29,4 +29,4 @@ public static string ToConfig(this Platform platform) public static string ToConfig(this Jit jit) => jit == Jit.LegacyJit ? "1" : "0"; } -} \ No newline at end of file +} diff --git a/src/BenchmarkDotNet/Portability/RuntimeInformation.cs b/src/BenchmarkDotNet/Portability/RuntimeInformation.cs index 55cde0d70b..07fa2a6fb4 100644 --- a/src/BenchmarkDotNet/Portability/RuntimeInformation.cs +++ b/src/BenchmarkDotNet/Portability/RuntimeInformation.cs @@ -234,6 +234,7 @@ public static Platform GetCurrentPlatform() // https://github.com/dotnet/runtime/blob/d81ad044fa6830f5f31f6b6e8224ebf66a3c298c/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/Architecture.cs#L12-L13 const Architecture Wasm = (Architecture)4; const Architecture S390x = (Architecture)5; + const Architecture LoongArch64 = (Architecture)6; switch (ProcessArchitecture) { @@ -249,6 +250,8 @@ public static Platform GetCurrentPlatform() return Platform.Wasm; case S390x: return Platform.S390x; + case LoongArch64: + return Platform.LoongArch64; default: throw new ArgumentOutOfRangeException(); } diff --git a/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs b/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs index 9a583ce020..4f905669bc 100644 --- a/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs +++ b/tests/BenchmarkDotNet.Tests/ConfigParserTests.cs @@ -476,6 +476,7 @@ public void UserCanSpecifyEnvironmentVariables() [InlineData(Platform.X64)] [InlineData(Platform.Arm)] [InlineData(Platform.Arm64)] + [InlineData(Platform.LoongArch64)] public void UserCanSpecifyProcessPlatform(Platform platform) { var parsedConfig = ConfigParser.Parse(new[] { "--platform", platform.ToString() }, new OutputLogger(Output)).config;