From f24354157f49da25d587712434067754488bce62 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 12 Mar 2026 10:09:35 +0100 Subject: [PATCH 1/4] Re-enable System.Net.Http.Functional.Tests on Android and increase timeout - Remove ActiveIssue disable for #124526 on Android CoreCLR - Increase Android Helix work item timeout from 30min to 60min to accommodate the ~1.5-1.6x slowdown from emulator 36.4.9 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs | 2 +- src/libraries/sendtohelixhelp.proj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs index f648bf1a0ac67e..bf269b513f000a 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/AssemblyInfo.cs @@ -6,4 +6,4 @@ [assembly: SkipOnCoreClr("System.Net.Tests are flaky and/or long running: https://github.com/dotnet/runtime/issues/131", ~RuntimeConfiguration.Release)] [assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/131", ~(TestPlatforms.Android | TestPlatforms.Browser | TestPlatforms.Wasi), TargetFrameworkMonikers.Any, TestRuntimes.Mono)] // System.Net.Tests are flaky and/or long running -[assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/124526", TestPlatforms.Android, TargetFrameworkMonikers.Any, TestRuntimes.CoreCLR)] + diff --git a/src/libraries/sendtohelixhelp.proj b/src/libraries/sendtohelixhelp.proj index 227089afe3c784..70830609254032 100644 --- a/src/libraries/sendtohelixhelp.proj +++ b/src/libraries/sendtohelixhelp.proj @@ -38,7 +38,7 @@ '$(Scenario)' == 'gcstress0xc_jitstress2' or '$(Scenario)' == 'gcstress0xc_jitminopts_heapverify1'">06:00:00 <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetsAppleMobile)' == 'true'">01:15:00 - <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'android'">00:30:00 + <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'android'">02:00:00 <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'browser'">00:30:00 <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'wasi'">00:30:00 <_workItemTimeout Condition="'$(Scenario)' == '' and '$(_workItemTimeout)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">00:45:00 From c1e79da17deacb0ce9f9a19abbf102b13e0f8fbe Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Thu, 12 Mar 2026 16:36:01 +0100 Subject: [PATCH 2/4] Revert Android Helix timeout to 30min to verify tests pass without increase The 2h timeout was set to diagnose #124526, but CI shows work items complete in ~11 min. Reverting to the original 30min to confirm the original timeout issue is no longer reproducible. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/libraries/sendtohelixhelp.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/sendtohelixhelp.proj b/src/libraries/sendtohelixhelp.proj index 70830609254032..227089afe3c784 100644 --- a/src/libraries/sendtohelixhelp.proj +++ b/src/libraries/sendtohelixhelp.proj @@ -38,7 +38,7 @@ '$(Scenario)' == 'gcstress0xc_jitstress2' or '$(Scenario)' == 'gcstress0xc_jitminopts_heapverify1'">06:00:00 <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetsAppleMobile)' == 'true'">01:15:00 - <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'android'">02:00:00 + <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'android'">00:30:00 <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'browser'">00:30:00 <_workItemTimeout Condition="'$(_workItemTimeout)' == '' and '$(TargetOS)' == 'wasi'">00:30:00 <_workItemTimeout Condition="'$(Scenario)' == '' and '$(_workItemTimeout)' == '' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">00:45:00 From 2232807d77da0ef2c633f749e5dad1086fc33274 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 16 Mar 2026 13:07:36 +0100 Subject: [PATCH 3/4] Add diagnostic timing and system info logging to Android test runner Instrument AndroidTestRunner.cs and MonoRunner.java with timing markers ([TIMING]) and system diagnostics ([DIAG]) to help investigate Android emulator slowness on Helix CI. Timing markers cover: - Main() entry with monotonic stopwatch - TestsStarted event (pre-discovery) - Assembly loading duration - First test execution (TestStarted event) - TestsCompleted with pass/fail counts System diagnostics include: - /proc/meminfo (RAM available to emulator) - /proc/cpuinfo (CPU count and model) - GC memory, working set, processor count - Android Build.HARDWARE/MODEL/PRODUCT/SDK_INT - ActivityManager.MemoryInfo (total/available system memory) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../AndroidTestRunner/AndroidTestRunner.cs | 80 ++++++++++++++++++- .../Templates/MonoRunner.java | 55 +++++++++++++ 2 files changed, 133 insertions(+), 2 deletions(-) diff --git a/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs b/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs index e181c37290adcd..22f26d6f88c1e9 100644 --- a/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs +++ b/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics; using System.Linq; using System.Text; using System.IO; @@ -18,31 +19,101 @@ public class SimpleAndroidTestRunner : AndroidApplicationEntryPoint, IDevice { private static List s_testLibs = new List(); private static string? s_MainTestName; + private static readonly Stopwatch s_mainStopwatch = new Stopwatch(); public static async Task Main(string[] args) { + s_mainStopwatch.Start(); + Console.WriteLine($"[TIMING] Main() entered at {DateTime.UtcNow:HH:mm:ss.fff}"); + LogSystemInfo(); + s_testLibs = Directory.GetFiles(Environment.CurrentDirectory, "*.Tests.dll").ToList(); if (s_testLibs.Count < 1) { Console.WriteLine($"Test libs were not found (*.Tests.dll was not found in {Environment.CurrentDirectory})"); return -1; } + + Console.WriteLine($"[TIMING] Found {s_testLibs.Count} test assemblies at +{s_mainStopwatch.ElapsedMilliseconds}ms"); + foreach (string lib in s_testLibs) + { + Console.WriteLine($"[TIMING] - {Path.GetFileName(lib)} ({new FileInfo(lib).Length / 1024}KB)"); + } + int exitCode = 0; s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]); string? verbose = Environment.GetEnvironmentVariable("XUNIT_VERBOSE")?.ToLower(); bool enableMaxThreads = (Environment.GetEnvironmentVariable("XUNIT_SINGLE_THREADED") != "1"); var simpleTestRunner = new SimpleAndroidTestRunner(verbose == "true" || verbose == "1", enableMaxThreads); - simpleTestRunner.TestsCompleted += (e, result) => + + bool firstTestLogged = false; + simpleTestRunner.TestsStarted += (sender, _) => + { + Console.WriteLine($"[TIMING] TestsStarted (discovery beginning) at +{s_mainStopwatch.ElapsedMilliseconds}ms"); + }; + simpleTestRunner.TestStarted += (sender, testName) => + { + if (!firstTestLogged) + { + firstTestLogged = true; + Console.WriteLine($"[TIMING] First test starting at +{s_mainStopwatch.ElapsedMilliseconds}ms: {testName}"); + } + }; + simpleTestRunner.TestsCompleted += (sender, result) => { + Console.WriteLine($"[TIMING] TestsCompleted at +{s_mainStopwatch.ElapsedMilliseconds}ms — passed:{result.PassedTests} failed:{result.FailedTests} skipped:{result.SkippedTests}"); if (result.FailedTests > 0) exitCode = 1; }; + Console.WriteLine($"[TIMING] Starting RunAsync() at +{s_mainStopwatch.ElapsedMilliseconds}ms"); await simpleTestRunner.RunAsync(); + Console.WriteLine($"[TIMING] RunAsync() returned at +{s_mainStopwatch.ElapsedMilliseconds}ms"); Console.WriteLine("----- Done -----"); return exitCode; } + private static void LogSystemInfo() + { + Console.WriteLine($"[DIAG] ProcessorCount={Environment.ProcessorCount}"); + Console.WriteLine($"[DIAG] GC.GetTotalMemory={GC.GetTotalMemory(forceFullCollection: false) / 1024}KB"); + Console.WriteLine($"[DIAG] WorkingSet64={Environment.WorkingSet / (1024 * 1024)}MB"); + + // Read /proc/meminfo for total/available RAM (works on Android/Linux) + try + { + if (File.Exists("/proc/meminfo")) + { + foreach (string line in File.ReadLines("/proc/meminfo").Take(5)) + { + Console.WriteLine($"[DIAG] {line.Trim()}"); + } + } + } + catch { } + + // Read /proc/cpuinfo summary + try + { + if (File.Exists("/proc/cpuinfo")) + { + int cpuCount = 0; + string? modelName = null; + foreach (string line in File.ReadLines("/proc/cpuinfo")) + { + if (line.StartsWith("processor")) + cpuCount++; + if (modelName is null && line.StartsWith("model name")) + modelName = line; + if (modelName is null && line.StartsWith("Hardware")) + modelName = line; + } + Console.WriteLine($"[DIAG] CPUs={cpuCount} {modelName?.Trim()}"); + } + } + catch { } + } + public SimpleAndroidTestRunner(bool verbose, bool enableMaxThreads) { MinimumLogLevel = (verbose) ? MinimumLogLevel.Verbose : MinimumLogLevel.Info; @@ -58,7 +129,12 @@ protected override IEnumerable GetTestAssemblies() { foreach (string file in s_testLibs) { - yield return new TestAssemblyInfo(Assembly.LoadFrom(file), file); + Console.WriteLine($"[TIMING] Loading assembly {Path.GetFileName(file)} at +{s_mainStopwatch.ElapsedMilliseconds}ms"); + var sw = Stopwatch.StartNew(); + var assembly = Assembly.LoadFrom(file); + sw.Stop(); + Console.WriteLine($"[TIMING] Loaded {Path.GetFileName(file)} in {sw.ElapsedMilliseconds}ms ({assembly.GetTypes().Length} types)"); + yield return new TestAssemblyInfo(assembly, file); } } diff --git a/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java b/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java index c384a85066804b..1b37bedab67265 100644 --- a/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java +++ b/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java @@ -16,9 +16,11 @@ import android.os.Environment; import android.net.Uri; +import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -30,6 +32,8 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; +import android.app.ActivityManager; + public class MonoRunner extends Instrumentation { static { @@ -87,7 +91,10 @@ public static void initializeRuntime(String entryPointLibName, Context context) } // unzip libs and test files to filesDir + long beforeUnzip = System.currentTimeMillis(); unzipAssets(context, filesDir, "assets.zip"); + long afterUnzip = System.currentTimeMillis(); + Log.i("DOTNET", "MonoRunner.initializeRuntime() - asset unzip took " + (afterUnzip - beforeUnzip) + "ms"); // set environment variables setEnv("HOME", filesDir); @@ -96,7 +103,10 @@ public static void initializeRuntime(String entryPointLibName, Context context) Log.i("DOTNET", "MonoRunner initializeRuntime, entryPointLibName=" + entryPointLibName); int localDateTimeOffset = getLocalDateTimeOffset(); + long beforeInit = System.currentTimeMillis(); int rv = initRuntime(filesDir, entryPointLibName, localDateTimeOffset); + long afterInit = System.currentTimeMillis(); + Log.i("DOTNET", "MonoRunner.initializeRuntime() - native initRuntime() took " + (afterInit - beforeInit) + "ms"); if (rv != 0) { Log.e("DOTNET", "Failed to initialize runtime, return-code=" + rv); freeNativeResources(); @@ -119,8 +129,15 @@ public void onStart() { return; } + long startTime = System.currentTimeMillis(); + Log.i("DOTNET", "MonoRunner.onStart() - initializing runtime..."); + logSystemInfo(getContext()); initializeRuntime(entryPointLibName, getContext()); + long afterInit = System.currentTimeMillis(); + Log.i("DOTNET", "MonoRunner.onStart() - runtime initialized in " + (afterInit - startTime) + "ms, executing entry point..."); int retcode = executeEntryPoint(entryPointLibName, argsToForward); + long afterExec = System.currentTimeMillis(); + Log.i("DOTNET", "MonoRunner.onStart() - entry point executed in " + (afterExec - afterInit) + "ms (total: " + (afterExec - startTime) + "ms)"); Log.i("DOTNET", "MonoRunner finished, return-code=" + retcode); result.putInt("return-code", retcode); @@ -187,6 +204,44 @@ static int getLocalDateTimeOffset() { } } + static void logSystemInfo(Context context) { + Log.i("DOTNET", "[DIAG] Build.HARDWARE=" + android.os.Build.HARDWARE); + Log.i("DOTNET", "[DIAG] Build.MODEL=" + android.os.Build.MODEL); + Log.i("DOTNET", "[DIAG] Build.PRODUCT=" + android.os.Build.PRODUCT); + Log.i("DOTNET", "[DIAG] Build.VERSION.SDK_INT=" + android.os.Build.VERSION.SDK_INT); + Log.i("DOTNET", "[DIAG] Runtime.availableProcessors=" + Runtime.getRuntime().availableProcessors()); + Log.i("DOTNET", "[DIAG] Runtime.maxMemory=" + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + "MB"); + Log.i("DOTNET", "[DIAG] Runtime.totalMemory=" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + "MB"); + + try { + ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); + if (am != null) { + ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); + am.getMemoryInfo(memInfo); + Log.i("DOTNET", "[DIAG] System.totalMem=" + (memInfo.totalMem / (1024 * 1024)) + "MB"); + Log.i("DOTNET", "[DIAG] System.availMem=" + (memInfo.availMem / (1024 * 1024)) + "MB"); + Log.i("DOTNET", "[DIAG] System.lowMemory=" + memInfo.lowMemory); + Log.i("DOTNET", "[DIAG] System.threshold=" + (memInfo.threshold / (1024 * 1024)) + "MB"); + } + } catch (Exception e) { + Log.w("DOTNET", "Failed to get ActivityManager memory info: " + e); + } + + // Read /proc/meminfo for host-visible RAM + try { + BufferedReader br = new BufferedReader(new FileReader("/proc/meminfo")); + for (int i = 0; i < 5; i++) { + String line = br.readLine(); + if (line != null) { + Log.i("DOTNET", "[DIAG] " + line.trim()); + } + } + br.close(); + } catch (Exception e) { + Log.w("DOTNET", "Failed to read /proc/meminfo: " + e); + } + } + static native int setEnv(String key, String value); static native int initRuntime(String libsDir, String entryPointLibName, int local_date_time_offset); From f9a5997e1bf0a3d592b1257a2acffe679c73847c Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Mon, 16 Mar 2026 16:31:13 +0100 Subject: [PATCH 4/4] Revert "Add diagnostic timing and system info logging to Android test runner" This reverts commit 2232807d77da0ef2c633f749e5dad1086fc33274. --- .../AndroidTestRunner/AndroidTestRunner.cs | 80 +------------------ .../Templates/MonoRunner.java | 55 ------------- 2 files changed, 2 insertions(+), 133 deletions(-) diff --git a/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs b/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs index 22f26d6f88c1e9..e181c37290adcd 100644 --- a/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs +++ b/src/libraries/Common/tests/AndroidTestRunner/AndroidTestRunner.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics; using System.Linq; using System.Text; using System.IO; @@ -19,101 +18,31 @@ public class SimpleAndroidTestRunner : AndroidApplicationEntryPoint, IDevice { private static List s_testLibs = new List(); private static string? s_MainTestName; - private static readonly Stopwatch s_mainStopwatch = new Stopwatch(); public static async Task Main(string[] args) { - s_mainStopwatch.Start(); - Console.WriteLine($"[TIMING] Main() entered at {DateTime.UtcNow:HH:mm:ss.fff}"); - LogSystemInfo(); - s_testLibs = Directory.GetFiles(Environment.CurrentDirectory, "*.Tests.dll").ToList(); if (s_testLibs.Count < 1) { Console.WriteLine($"Test libs were not found (*.Tests.dll was not found in {Environment.CurrentDirectory})"); return -1; } - - Console.WriteLine($"[TIMING] Found {s_testLibs.Count} test assemblies at +{s_mainStopwatch.ElapsedMilliseconds}ms"); - foreach (string lib in s_testLibs) - { - Console.WriteLine($"[TIMING] - {Path.GetFileName(lib)} ({new FileInfo(lib).Length / 1024}KB)"); - } - int exitCode = 0; s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]); string? verbose = Environment.GetEnvironmentVariable("XUNIT_VERBOSE")?.ToLower(); bool enableMaxThreads = (Environment.GetEnvironmentVariable("XUNIT_SINGLE_THREADED") != "1"); var simpleTestRunner = new SimpleAndroidTestRunner(verbose == "true" || verbose == "1", enableMaxThreads); - - bool firstTestLogged = false; - simpleTestRunner.TestsStarted += (sender, _) => - { - Console.WriteLine($"[TIMING] TestsStarted (discovery beginning) at +{s_mainStopwatch.ElapsedMilliseconds}ms"); - }; - simpleTestRunner.TestStarted += (sender, testName) => - { - if (!firstTestLogged) - { - firstTestLogged = true; - Console.WriteLine($"[TIMING] First test starting at +{s_mainStopwatch.ElapsedMilliseconds}ms: {testName}"); - } - }; - simpleTestRunner.TestsCompleted += (sender, result) => + simpleTestRunner.TestsCompleted += (e, result) => { - Console.WriteLine($"[TIMING] TestsCompleted at +{s_mainStopwatch.ElapsedMilliseconds}ms — passed:{result.PassedTests} failed:{result.FailedTests} skipped:{result.SkippedTests}"); if (result.FailedTests > 0) exitCode = 1; }; - Console.WriteLine($"[TIMING] Starting RunAsync() at +{s_mainStopwatch.ElapsedMilliseconds}ms"); await simpleTestRunner.RunAsync(); - Console.WriteLine($"[TIMING] RunAsync() returned at +{s_mainStopwatch.ElapsedMilliseconds}ms"); Console.WriteLine("----- Done -----"); return exitCode; } - private static void LogSystemInfo() - { - Console.WriteLine($"[DIAG] ProcessorCount={Environment.ProcessorCount}"); - Console.WriteLine($"[DIAG] GC.GetTotalMemory={GC.GetTotalMemory(forceFullCollection: false) / 1024}KB"); - Console.WriteLine($"[DIAG] WorkingSet64={Environment.WorkingSet / (1024 * 1024)}MB"); - - // Read /proc/meminfo for total/available RAM (works on Android/Linux) - try - { - if (File.Exists("/proc/meminfo")) - { - foreach (string line in File.ReadLines("/proc/meminfo").Take(5)) - { - Console.WriteLine($"[DIAG] {line.Trim()}"); - } - } - } - catch { } - - // Read /proc/cpuinfo summary - try - { - if (File.Exists("/proc/cpuinfo")) - { - int cpuCount = 0; - string? modelName = null; - foreach (string line in File.ReadLines("/proc/cpuinfo")) - { - if (line.StartsWith("processor")) - cpuCount++; - if (modelName is null && line.StartsWith("model name")) - modelName = line; - if (modelName is null && line.StartsWith("Hardware")) - modelName = line; - } - Console.WriteLine($"[DIAG] CPUs={cpuCount} {modelName?.Trim()}"); - } - } - catch { } - } - public SimpleAndroidTestRunner(bool verbose, bool enableMaxThreads) { MinimumLogLevel = (verbose) ? MinimumLogLevel.Verbose : MinimumLogLevel.Info; @@ -129,12 +58,7 @@ protected override IEnumerable GetTestAssemblies() { foreach (string file in s_testLibs) { - Console.WriteLine($"[TIMING] Loading assembly {Path.GetFileName(file)} at +{s_mainStopwatch.ElapsedMilliseconds}ms"); - var sw = Stopwatch.StartNew(); - var assembly = Assembly.LoadFrom(file); - sw.Stop(); - Console.WriteLine($"[TIMING] Loaded {Path.GetFileName(file)} in {sw.ElapsedMilliseconds}ms ({assembly.GetTypes().Length} types)"); - yield return new TestAssemblyInfo(assembly, file); + yield return new TestAssemblyInfo(Assembly.LoadFrom(file), file); } } diff --git a/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java b/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java index 1b37bedab67265..c384a85066804b 100644 --- a/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java +++ b/src/tasks/AndroidAppBuilder/Templates/MonoRunner.java @@ -16,11 +16,9 @@ import android.os.Environment; import android.net.Uri; -import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -32,8 +30,6 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; -import android.app.ActivityManager; - public class MonoRunner extends Instrumentation { static { @@ -91,10 +87,7 @@ public static void initializeRuntime(String entryPointLibName, Context context) } // unzip libs and test files to filesDir - long beforeUnzip = System.currentTimeMillis(); unzipAssets(context, filesDir, "assets.zip"); - long afterUnzip = System.currentTimeMillis(); - Log.i("DOTNET", "MonoRunner.initializeRuntime() - asset unzip took " + (afterUnzip - beforeUnzip) + "ms"); // set environment variables setEnv("HOME", filesDir); @@ -103,10 +96,7 @@ public static void initializeRuntime(String entryPointLibName, Context context) Log.i("DOTNET", "MonoRunner initializeRuntime, entryPointLibName=" + entryPointLibName); int localDateTimeOffset = getLocalDateTimeOffset(); - long beforeInit = System.currentTimeMillis(); int rv = initRuntime(filesDir, entryPointLibName, localDateTimeOffset); - long afterInit = System.currentTimeMillis(); - Log.i("DOTNET", "MonoRunner.initializeRuntime() - native initRuntime() took " + (afterInit - beforeInit) + "ms"); if (rv != 0) { Log.e("DOTNET", "Failed to initialize runtime, return-code=" + rv); freeNativeResources(); @@ -129,15 +119,8 @@ public void onStart() { return; } - long startTime = System.currentTimeMillis(); - Log.i("DOTNET", "MonoRunner.onStart() - initializing runtime..."); - logSystemInfo(getContext()); initializeRuntime(entryPointLibName, getContext()); - long afterInit = System.currentTimeMillis(); - Log.i("DOTNET", "MonoRunner.onStart() - runtime initialized in " + (afterInit - startTime) + "ms, executing entry point..."); int retcode = executeEntryPoint(entryPointLibName, argsToForward); - long afterExec = System.currentTimeMillis(); - Log.i("DOTNET", "MonoRunner.onStart() - entry point executed in " + (afterExec - afterInit) + "ms (total: " + (afterExec - startTime) + "ms)"); Log.i("DOTNET", "MonoRunner finished, return-code=" + retcode); result.putInt("return-code", retcode); @@ -204,44 +187,6 @@ static int getLocalDateTimeOffset() { } } - static void logSystemInfo(Context context) { - Log.i("DOTNET", "[DIAG] Build.HARDWARE=" + android.os.Build.HARDWARE); - Log.i("DOTNET", "[DIAG] Build.MODEL=" + android.os.Build.MODEL); - Log.i("DOTNET", "[DIAG] Build.PRODUCT=" + android.os.Build.PRODUCT); - Log.i("DOTNET", "[DIAG] Build.VERSION.SDK_INT=" + android.os.Build.VERSION.SDK_INT); - Log.i("DOTNET", "[DIAG] Runtime.availableProcessors=" + Runtime.getRuntime().availableProcessors()); - Log.i("DOTNET", "[DIAG] Runtime.maxMemory=" + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + "MB"); - Log.i("DOTNET", "[DIAG] Runtime.totalMemory=" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + "MB"); - - try { - ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); - if (am != null) { - ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); - am.getMemoryInfo(memInfo); - Log.i("DOTNET", "[DIAG] System.totalMem=" + (memInfo.totalMem / (1024 * 1024)) + "MB"); - Log.i("DOTNET", "[DIAG] System.availMem=" + (memInfo.availMem / (1024 * 1024)) + "MB"); - Log.i("DOTNET", "[DIAG] System.lowMemory=" + memInfo.lowMemory); - Log.i("DOTNET", "[DIAG] System.threshold=" + (memInfo.threshold / (1024 * 1024)) + "MB"); - } - } catch (Exception e) { - Log.w("DOTNET", "Failed to get ActivityManager memory info: " + e); - } - - // Read /proc/meminfo for host-visible RAM - try { - BufferedReader br = new BufferedReader(new FileReader("/proc/meminfo")); - for (int i = 0; i < 5; i++) { - String line = br.readLine(); - if (line != null) { - Log.i("DOTNET", "[DIAG] " + line.trim()); - } - } - br.close(); - } catch (Exception e) { - Log.w("DOTNET", "Failed to read /proc/meminfo: " + e); - } - } - static native int setEnv(String key, String value); static native int initRuntime(String libsDir, String entryPointLibName, int local_date_time_offset);