The quick start guides cover the basics of setting up startup tracing, read them first if you haven't already:
This guide covers startup tracing in more detail.
Mobile app startups can be classified into 3 categories:
- Cold - The app is not running, so the app's process has to be created, code has to be loaded, and all of the app-specific startup logic needs to run. This is the most expensive type of startup.
- Hot - The app is already running, but in the background. The app may run some code in response to it being brought to the foreground. This is the least expensive type of startup.
- Warm - A less common scenario that is in between a cold start and a hot start. This type of startup only applies to Android, and is covered in detail in the Android App startup time documentation.
Specto currently only provides automatic instrumentation for cold starts, as this is the most important and most expensive of the startup types. We are investigating support for instrumenting other types of startup, and would appreciate any feedback you may have on the subject.
On iOS, we use the process start time as the start marker for instrumenting app startup.
On Android, the behavior is slightly different: we use your call to
Specto.init as the start marker. The reason we don't use process start time on Android is because some OEMs choose to enable a configuration option known as UnSpecialized App Process (USAP) where a pool of Zygote processes is created ahead of time to avoid process spawning overhead when starting an app. When this is enabled, the process start timestamp is not accurate since the process was created long before the app was started. Since measuring startup differently based on the OEM configuration would result in unreliable aggregate data, we opted to choose a measurement that would work the same way across devices.
On both platforms, the startup measurement ends when you call
Specto.markAppStartupComplete(). This function should be called when the initial data for your application has been loaded and rendered, and the app is ready for user interaction.
Specto.annotateStartupTrace API can be used to add key/value annotations to the startup trace, in case you want to associate additional metadata (e.g. a startup type that is specific to your app). The startup data can then be filtered in the dashboard based on these annotations. All of the other principles of regular trace annotations (as covered in the Traces and Spans documentation) still apply.
Specto.annotateStartupTrace(key: "startup_type", value: "from_notification")
[Specto annotateStartupTraceWithKey:@"startup_type" value:@"from_notification"];
Updated about 1 year ago