How does Firebase app start time profiling work on Android?

孤人 提交于 2019-12-11 07:28:59

问题


I noticed that Firebase Performance Monitoring does provide some automatic traces out of the box. In particular I was looking at the cold app start time trace which is exactly what I need to do right now. Unfortunately I need to do have more granular data, so I was thinking I could do it on my own, but so far I failed to come up with a reasonable how to measure a true cold start time of an Android app (think time between tapping an icon in launcher and seeing the UI of given Activity).

The docs says, that Firebase starts the trace when FirebasePerfProvider.onCreate callback gets called. As far as I know this should happen very soon after the application process starts, so that's good, but it also means that it gets called even when the app just receives a notification (or some broadcast in general) and at that point the process might not be terminated by the time the user actually opens the app. That means it'd measure the duration wrong.

Given the SDK is not (yet?) open sourced, I could not find a better description of how this works.

Does anybody know more?


回答1:


If the Android process is launched via a Service or BroadcastReceiver, no trace is started. So, if and when an Activity is actually started in that process, there will be no problems with an app start trace that could appear to be very long. The app start trace only happens if the process is invoked by an Activity.

I've updated the documentation to include this fact, and that change should be published soon.



来源:https://stackoverflow.com/questions/47261735/how-does-firebase-app-start-time-profiling-work-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!