Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@
<_BundlerEnvironmentVariables Include="DOTNET_ReadyToRun" Value="0" />
</ItemGroup>

<ItemGroup Condition="'$(DebugLaunchTime)' == 'true'">
<_BundlerEnvironmentVariables Include="DEBUG_LAUNCH_TIME" Value="1" />
</ItemGroup>

<!-- Compute _SdkIsSimulator from the RuntimeIdentifier -->
<PropertyGroup>
<_SdkIsSimulator Condition="'$(RuntimeIdentifier)' != '' And '$(_SdkIsSimulator)' == ''">$(RuntimeIdentifier.Contains('simulator'))</_SdkIsSimulator>
Expand Down
48 changes: 26 additions & 22 deletions runtime/monotouch-main.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,31 +151,35 @@
}
#endif // !defined (CORECLR_RUNTIME)

#ifdef DEBUG_LAUNCH_TIME
uint64_t startDate = 0;
uint64_t date = 0;
void debug_launch_time_print (const char *msg)
static uint64_t xamarin_launch_startDate = 0;
static uint64_t xamarin_launch_date = 0;
static int xamarin_launch_time_enabled = -1;

void xamarin_launch_time_print (const char *msg)
{
if (xamarin_launch_time_enabled == -1) {
const char *env = getenv ("DEBUG_LAUNCH_TIME");
xamarin_launch_time_enabled = (env != NULL && env[0] == '1') ? 1 : 0;
}

if (!xamarin_launch_time_enabled)
return;

uint64_t unow;
struct timeval now;

gettimeofday (&now, NULL);
unow = now.tv_sec * 1000000ULL + now.tv_usec;
unow = (uint64_t) now.tv_sec * 1000000ULL + (uint64_t) now.tv_usec;

if (startDate == 0) {
startDate = unow;
date = startDate;
if (xamarin_launch_startDate == 0) {
xamarin_launch_startDate = unow;
xamarin_launch_date = xamarin_launch_startDate;
}

PRINT ("%s: %llu us Total: %llu us", msg, unow - date, unow - startDate);
PRINT ("%s: %llu us Total: %llu us", msg, unow - xamarin_launch_date, unow - xamarin_launch_startDate);

date = unow;
xamarin_launch_date = unow;
}
#else
inline void debug_launch_time_print (const char *msg)
{
}
#endif

/*
* This class will listen for memory warnings and when received, force
Expand Down Expand Up @@ -256,10 +260,10 @@ - (void) memoryWarning: (NSNotification *) sender
managed_argv [managed_argc++] = "monotouch";
#endif

DEBUG_LAUNCH_TIME_PRINT ("Main entered");
XAMARIN_LAUNCH_TIME_PRINT ("Main entered");

xamarin_setup ();
DEBUG_LAUNCH_TIME_PRINT ("MonoTouch setup time");
XAMARIN_LAUNCH_TIME_PRINT ("MonoTouch setup time");

MonoAssembly *assembly;
GCHandle exception_gchandle = NULL;
Expand All @@ -278,7 +282,7 @@ - (void) memoryWarning: (NSNotification *) sender

xamarin_bridge_setup ();

DEBUG_LAUNCH_TIME_PRINT ("Spin-up time");
XAMARIN_LAUNCH_TIME_PRINT ("Spin-up time");

{
/*
Expand Down Expand Up @@ -408,7 +412,7 @@ - (void) memoryWarning: (NSNotification *) sender
xamarin_bridge_initialize ();

xamarin_initialize ();
DEBUG_LAUNCH_TIME_PRINT ("\tmonotouch init time");
XAMARIN_LAUNCH_TIME_PRINT ("\tmonotouch init time");

if (xamarin_register_assemblies != NULL)
xamarin_register_assemblies ();
Expand Down Expand Up @@ -438,13 +442,13 @@ - (void) memoryWarning: (NSNotification *) sender
(void)exception_gchandle;
#endif // !defined (NATIVEAOT)

DEBUG_LAUNCH_TIME_PRINT ("\tAssembly register time");
XAMARIN_LAUNCH_TIME_PRINT ("\tAssembly register time");

[[[XamarinGCSupport alloc] init] autorelease];

DEBUG_LAUNCH_TIME_PRINT ("\tGC defer time");
XAMARIN_LAUNCH_TIME_PRINT ("\tGC defer time");

DEBUG_LAUNCH_TIME_PRINT ("Total initialization time");
XAMARIN_LAUNCH_TIME_PRINT ("Total initialization time");

int rv = 0;
switch (launch_mode) {
Expand Down
8 changes: 4 additions & 4 deletions runtime/monovm-bridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
{
if (xamarin_register_modules != NULL)
xamarin_register_modules ();
DEBUG_LAUNCH_TIME_PRINT ("\tAOT register time");
XAMARIN_LAUNCH_TIME_PRINT ("\tAOT register time");

#ifdef DEBUG
monotouch_start_debugging ();
DEBUG_LAUNCH_TIME_PRINT ("\tDebug init time");
XAMARIN_LAUNCH_TIME_PRINT ("\tDebug init time");
#endif

if (xamarin_init_mono_debug)
Expand All @@ -68,7 +68,7 @@

#ifdef DEBUG
monotouch_start_profiling ();
DEBUG_LAUNCH_TIME_PRINT ("\tProfiler config time");
XAMARIN_LAUNCH_TIME_PRINT ("\tProfiler config time");
#endif

mono_set_signal_chaining (TRUE);
Expand All @@ -82,7 +82,7 @@
This is wasteful, but there's no way to manipulate the preload hook list except by adding to it.
*/
mono_install_assembly_preload_hook (xamarin_assembly_preload_hook, NULL);
DEBUG_LAUNCH_TIME_PRINT ("\tJIT init time");
XAMARIN_LAUNCH_TIME_PRINT ("\tJIT init time");
}

void
Expand Down
11 changes: 3 additions & 8 deletions runtime/runtime-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@
#define PRINT(...) do { xamarin_printf (__VA_ARGS__); } while (0);
#define LOG(...) do { if (xamarin_log_level > 0) xamarin_printf (__VA_ARGS__); } while (0);

// #define DEBUG_LAUNCH_TIME

#ifdef DEBUG_LAUNCH_TIME
#define DEBUG_LAUNCH_TIME_PRINT(msg) \
debug_launch_time_print (msg);
#else
#define DEBUG_LAUNCH_TIME_PRINT(...)
#endif
void xamarin_launch_time_print (const char *msg);
#define XAMARIN_LAUNCH_TIME_PRINT(msg) \
xamarin_launch_time_print (msg);

// Uncomment the TRACK_MONOOBJECTS define to show a summary at process exit of
// the MonoObjects that were created, and if any were not freed. If there are
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
AppBundleSize: 3,611,961 bytes (3,527.3 KB = 3.4 MB)
AppBundleSize: 3,631,541 bytes (3,546.4 KB = 3.5 MB)
# The following list of files and their sizes is just informational / for review, and isn't used in the test:
_CodeSignature/CodeResources: 3,997 bytes (3.9 KB = 0.0 MB)
archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB)
Info.plist: 1,167 bytes (1.1 KB = 0.0 MB)
Microsoft.iOS.dll: 150,528 bytes (147.0 KB = 0.1 MB)
Info.plist: 1,147 bytes (1.1 KB = 0.0 MB)
Microsoft.iOS.dll: 153,088 bytes (149.5 KB = 0.1 MB)
PkgInfo: 8 bytes (0.0 KB = 0.0 MB)
runtimeconfig.bin: 1,405 bytes (1.4 KB = 0.0 MB)
SizeTestApp: 2,388,080 bytes (2,332.1 KB = 2.3 MB)
SizeTestApp: 2,405,120 bytes (2,348.8 KB = 2.3 MB)
SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB)
System.Private.CoreLib.aotdata.arm64: 41,368 bytes (40.4 KB = 0.0 MB)
System.Private.CoreLib.dll: 1,004,032 bytes (980.5 KB = 1.0 MB)
Expand Down