Skip to content

Commit 2061030

Browse files
authored
[perf] Setup iOS performance measurements on CoreCLR (#120139)
* Add iOS CoreCLR performance benchmarks * Test build * Add runtimeType parameter * Test build * Test build * Test build * Remove branch * Update comment * Fix ident * Test perf run * Update iOS CoreCLR build configuration to use Checked * Remove reference to feature/clr-ios-performance-benchmarks * Use Debug configuration * Remove reference to feature/clr-ios-performance-benchmarks * Test Checked build * Remove reference to feature/clr-ios-performance-benchmarks * Add env variables * Remove reference to feature/clr-ios-performance-benchmarks * Add CORECLR_TEST for conditional compilation in iOS project * Add branch reference for performance repository in perf.yml * Move env variable to ItemGroup * Update performance repository reference * Add sleep in Main * Remove branch
1 parent a2dc727 commit 2061030

File tree

5 files changed

+65
-4
lines changed

5 files changed

+65
-4
lines changed

eng/pipelines/performance/templates/build-perf-sample-apps.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,31 @@ steps:
210210
archiveExtension: '.zip'
211211
archiveType: zip
212212

213+
- ${{ if and(eq(parameters.osGroup, 'ios'), eq(parameters.runtimeType, 'coreclr')) }}:
214+
# CoreCLR Interpreter Build
215+
- script: make build-appbundle TARGET_OS=ios TARGET_ARCH=arm64 BUILD_CONFIG=Checked DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=false USE_MONO_RUNTIME=false AOT=false
216+
env:
217+
DevTeamProvisioning: '-'
218+
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
219+
displayName: Build HelloiOS sample app
220+
- task: PublishBuildArtifacts@1
221+
condition: succeededOrFailed()
222+
displayName: 'Publish binlog'
223+
inputs:
224+
pathtoPublish: $(Build.SourcesDirectory)/src/mono/sample/iOS/msbuild.binlog
225+
artifactName: iOSCoreCLRArm64BuildLog
226+
- template: /eng/pipelines/common/upload-artifact-step.yml
227+
parameters:
228+
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/Bundle/HelloiOS/Debug-iphoneos/HelloiOS.app
229+
includeRootFolder: true
230+
displayName: iOS Sample App
231+
artifactName: iOSSampleApp
232+
archiveExtension: '.zip'
233+
archiveType: zip
234+
- script: rm -r -f $(Build.SourcesDirectory)/src/mono/sample/iOS/bin
235+
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
236+
displayName: Clean bindir
237+
213238
- ${{ if and(eq(parameters.osGroup, 'ios'), eq(parameters.nameSuffix, 'iOSNativeAOT')) }}:
214239
- script: make hello-app TARGET_OS=ios TARGET_ARCH=arm64 BUILD_CONFIG=Release DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=false
215240
env:

eng/pipelines/performance/templates/perf-ios-scenarios-build-jobs.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
parameters:
22
hybridGlobalization: true
33
mono: false
4+
coreclr: false
45
nativeAot: false
56

67
jobs:
@@ -22,6 +23,25 @@ jobs:
2223
parameters:
2324
hybridGlobalization: ${{ parameters.hybridGlobalization }}
2425

26+
- ${{ if eq(parameters.coreclr, true) }}:
27+
# build CoreCLR iOS scenarios
28+
- template: /eng/pipelines/common/platform-matrix.yml
29+
parameters:
30+
jobTemplate: /eng/pipelines/common/global-build-job.yml
31+
buildConfig: checked
32+
runtimeFlavor: coreclr
33+
platforms:
34+
- ios_arm64
35+
jobParameters:
36+
buildArgs: -s clr+clr.runtime+libs+packs -c $(_BuildConfig)
37+
nameSuffix: iOSCoreCLR
38+
isOfficialBuild: false
39+
postBuildSteps:
40+
- template: /eng/pipelines/performance/templates/build-perf-sample-apps.yml
41+
parameters:
42+
hybridGlobalization: ${{ parameters.hybridGlobalization }}
43+
runtimeType: coreclr
44+
2545
- ${{ if eq(parameters.nativeAot, true) }}:
2646
# build NativeAOT iOS scenarios HybridGlobalization
2747
- template: /eng/pipelines/common/platform-matrix.yml

src/mono/sample/iOS/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ DEPLOY_AND_RUN?=true
1010
APP_SANDBOX?=false
1111
STRIP_DEBUG_SYMBOLS?=false # only used when measuring SOD via build-appbundle make target
1212
HYBRID_GLOBALIZATION?=true
13+
USE_MONO_RUNTIME?=true
14+
AOT?=true
1315

1416
#If DIAGNOSTIC_PORTS is enabled, @(RuntimeComponents) must also include 'diagnostics_tracing'.
1517
#If @(RuntimeComponents) includes 'diagnostics_tracing', DIAGNOSTIC_PORTS is optional.
@@ -42,6 +44,8 @@ build-appbundle: clean appbuilder
4244
/p:StripDebugSymbols=$(STRIP_DEBUG_SYMBOLS) \
4345
/p:DeployAndRun=false \
4446
/p:HybridGlobalization=$(HYBRID_GLOBALIZATION) \
47+
/p:RunAOTCompilation=$(AOT) \
48+
/p:UseMonoRuntime=$(USE_MONO_RUNTIME) \
4549
/bl
4650

4751
run: clean appbuilder

src/mono/sample/iOS/Program.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public static class Program
2121
private static void SetText(string txt)
2222
{
2323
byte[] ascii = ASCIIEncoding.ASCII.GetBytes(txt);
24-
25-
unsafe
24+
25+
unsafe
2626
{
2727
fixed (byte* asciiPtr = ascii)
2828
{
@@ -37,7 +37,14 @@ private static void OnButtonClick()
3737
{
3838
SetText("OnButtonClick! #" + counter++);
3939
}
40-
40+
#if CORECLR_TEST
41+
public static int Main(string[] args)
42+
{
43+
Console.WriteLine("Done!");
44+
Thread.Sleep(Timeout.Infinite);
45+
return 42;
46+
}
47+
#else
4148
#if CI_TEST
4249
public static async Task<int> Main(string[] args)
4350
#else
@@ -63,6 +70,7 @@ public static async Task Main(string[] args)
6370
return 42;
6471
#else
6572
await Task.Delay(-1);
66-
#endif
73+
#endif
6774
}
75+
#endif
6876
}

src/mono/sample/iOS/Program.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<TargetOS Condition="'$(TargetOS)' == ''">iossimulator</TargetOS>
77
<RuntimeIdentifier>$(TargetOS)-$(TargetArchitecture)</RuntimeIdentifier>
88
<DefineConstants Condition="'$(ArchiveTests)' == 'true'">$(DefineConstants);CI_TEST</DefineConstants>
9+
<DefineConstants Condition="'$(UseMonoRuntime)' != 'true'">$(DefineConstants);CORECLR_TEST</DefineConstants>
910
<AppName>HelloiOS</AppName>
1011
<MainLibraryFileName>$(AssemblyName).dll</MainLibraryFileName>
1112
<SelfContained>true</SelfContained>
@@ -28,6 +29,9 @@
2829

2930
<ItemGroup>
3031
<RuntimeComponents Condition="'$(DiagnosticPorts)' != ''" Include="diagnostics_tracing" />
32+
<EnvironmentVariables Condition="'$(UseMonoRuntime)' != 'true'" Include="DOTNET_InterpMode=3" />
33+
<EnvironmentVariables Condition="'$(UseMonoRuntime)' != 'true'" Include="DOTNET_ReadyToRun=0" />
34+
<EnvironmentVariables Condition="'$(UseMonoRuntime)' != 'true'" Include="DOTNET_InterpDump=*!*" />
3135
</ItemGroup>
3236

3337
<Import Project="$(MonoProjectRoot)\msbuild\apple\build\AppleBuild.props" />

0 commit comments

Comments
 (0)