Skip to content

Commit 67edab5

Browse files
authored
Add UseMonoRuntime_LlvmJit option (#1533)
1 parent 35691d5 commit 67edab5

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

src/Benchmarks.ServerJob/ServerJob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class ServerJob : IIdentifiable
5959
public string AspNetCoreVersion { get; set; } = "";
6060
public string RuntimeVersion { get; set; } = "";
6161
public string SdkVersion { get; set; } = "";
62-
public bool UseMonoRuntime { get; set; } = false;
62+
public string UseMonoRuntime { get; set; } = "";
6363
public bool NoGlobalJson { get; set; }
6464
public Database Database { get; set; } = Database.None;
6565

src/BenchmarksDriver/Program.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ public static int Main(string[] args)
211211
CommandOptionType.SingleValue);
212212
var monoOption = app.Option("--mono-runtime",
213213
"Use the mono runtime.", CommandOptionType.NoValue);
214+
var monoOption_LlvmJit = app.Option("--mono-runtime-llvmjit",
215+
"Use the mono runtime with LLVM JIT.", CommandOptionType.NoValue);
214216
var aspnetCoreVersionOption = app.Option("-aspnet|--aspnetCoreVersion",
215217
"ASP.NET Core packages version (Current, Latest, or custom value). Current is the latest public version (2.0.*), Latest is the currently developed one. Default is Latest (2.2-*).", CommandOptionType.SingleValue);
216218
var runtimeVersionOption = app.Option("-dotnet|--runtimeVersion",
@@ -739,7 +741,7 @@ public static int Main(string[] args)
739741
}
740742
else
741743
{
742-
if (monoOption.HasValue())
744+
if (monoOption.HasValue() || monoOption_LlvmJit.HasValue())
743745
{
744746
serverJob.SelfContained = true;
745747

@@ -767,7 +769,11 @@ public static int Main(string[] args)
767769
}
768770
if (monoOption.HasValue())
769771
{
770-
serverJob.UseMonoRuntime = true;
772+
serverJob.UseMonoRuntime = "jit";
773+
}
774+
if (monoOption_LlvmJit.HasValue())
775+
{
776+
serverJob.UseMonoRuntime = "llvm-jit";
771777
}
772778
if (kestrelThreadCountOption.HasValue())
773779
{

src/BenchmarksDriver2/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Options:
5252
--[JOB].buildArguments <argument> An argument to pass to msbuild. Can be used multiple times to define multiple values.
5353
--[JOB].selfContained <true|false> Whether to deploy the app as stand-alone. Default is false. Is is forced to 'true' if either runtimeVersion or aspnetVersion is defined as the SDK versions would be used otherwise.
5454
--[JOB].useMonoRuntime <true|false> Whether to use the Mono runtime.
55+
--[JOB].useMonoRuntime_LlvmJit <true|false> Whether to use the Mono runtime with LLVM JIT.
5556
5657
## Docker options
5758

src/BenchmarksServer/Startup.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ Based on the target framework
7878

7979
private static readonly string _latestSdkVersionUrl = "https://aka.ms/dotnet/net5/dev/Sdk/productCommit-win-x64.txt";
8080
private static readonly string _aspnetSdkVersionUrl = "https://raw.githubusercontent.com/dotnet/aspnetcore/master/global.json";
81-
private static readonly string _runtimeMonoPackageUrl = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/flat2/Microsoft.NETCore.App.Runtime.Mono.linux-x64/{0}/Microsoft.NETCore.App.Runtime.Mono.linux-x64.{0}.nupkg";
8281
private static readonly string[] _runtimeFeedUrls = new string[] {
8382
"https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/flat2",
8483
"https://dotnetfeed.blob.core.windows.net/dotnet-core/flatcontainer",
@@ -2514,14 +2513,14 @@ private static async Task<string> CloneRestoreAndBuild(string path, ServerJob jo
25142513
}
25152514

25162515
// Download mono runtime
2517-
if (job.UseMonoRuntime)
2516+
if (!string.IsNullOrEmpty(job.UseMonoRuntime))
25182517
{
25192518
if (!job.SelfContained)
25202519
{
25212520
throw new Exception("The job is trying to use the mono runtime but was not configured as self-contained.");
25222521
}
2523-
2524-
await UseMonoRuntimeAsync(runtimeVersion, outputFolder);
2522+
2523+
await UseMonoRuntimeAsync(runtimeVersion, outputFolder, job.UseMonoRuntime);
25252524
}
25262525

25272526
// Copy all output attachments
@@ -3858,14 +3857,19 @@ private static void StartDotNetTrace(int processId, ServerJob job)
38583857
}
38593858
}
38603859

3861-
private static async Task UseMonoRuntimeAsync(string runtimeVersion, string outputFolder)
3860+
private static async Task UseMonoRuntimeAsync(string runtimeVersion, string outputFolder, string mode)
38623861
{
3863-
var monoRuntimeUrl = String.Format(_runtimeMonoPackageUrl, runtimeVersion);
3864-
38653862
try
38663863
{
3867-
3868-
var packageName = "Microsoft.NETCore.App.Runtime.Mono.linux-x64".ToLowerInvariant();
3864+
var packageName = "";
3865+
switch (mode) {
3866+
case "jit":
3867+
packageName = "Microsoft.NETCore.App.Runtime.Mono.linux-x64".ToLowerInvariant();
3868+
break;
3869+
case "llvm-jit":
3870+
packageName = "Microsoft.NETCore.App.Runtime.Mono.LLVM.AOT.linux-x64".ToLowerInvariant();
3871+
break;
3872+
}
38693873
var runtimePath = Path.Combine(_rootTempDir, "RuntimePackages", $"{packageName}.{runtimeVersion}.nupkg");
38703874

38713875
// Ensure the folder already exists

0 commit comments

Comments
 (0)