Using simpleperf -- any way to profile app startup?

319 views
Skip to first unread message

Theo Yaung

unread,
Dec 23, 2016, 11:03:51 PM12/23/16
to android-ndk
Hi,

I have a relatively noob-ish question about simpleperf. I see options to profile a specific already existing process -- is there an option to ask it to start up an app/activity and profile the startup of the created process?

I think the use case would be nice for Simpleperf to handle, or in some coordinated way with the OS. I don't really want to start the app via adb, because there's the race between adb returning and the actual process being created, or the possibility that starting simpleperf afterwards might miss some portions of process startup (and have an incomplete picture).

Cheers,
--Theo

Dan Albert

unread,
Dec 28, 2016, 2:39:38 PM12/28/16
to android-ndk, Yabin Cui
+yabinc

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/f0588d9b-e0de-4d71-941b-8bc62331a456%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yabin Cui

unread,
Dec 28, 2016, 3:53:06 PM12/28/16
to android-ndk, yab...@google.com
Hi Theo,

The normal way of starting an app/activity on android is by forking from a process zygote. This is to get rid of the cost of loading shared libraries and initialize jvm. Even if we have an option to start jvm from simpleperf, it doesn't work well, because it is different from the normal way and involves unnecessary initializations. Instead, we have two ways to solve this:
1. we can profile zygote/zygote64 process, then use `am start` to fork app process from zygote, then we can automatically profile the child process. And we can use --pids to only report samples in app process. I haven't tried this, but it should work, and I will verify it soon.
2. After starting app process, we can find its pid as soon as possible, and profile that process (like https://android-review.googlesource.com/#/c/309882/2/simpleperf/scripts/app_profiler.py). It might miss some parts of the startup, but if we can reduce the delay to < 10ms. I think it will be fine.
I will experiment these two methods once I am in office.

Best,
Yabin



On Wednesday, December 28, 2016 at 11:39:38 AM UTC-8, Dan Albert wrote:
+yabinc

On Thu, Dec 22, 2016 at 8:35 AM, Theo Yaung <th...@outlook.com> wrote:
Hi,

I have a relatively noob-ish question about simpleperf. I see options to profile a specific already existing process -- is there an option to ask it to start up an app/activity and profile the startup of the created process?

I think the use case would be nice for Simpleperf to handle, or in some coordinated way with the OS. I don't really want to start the app via adb, because there's the race between adb returning and the actual process being created, or the possibility that starting simpleperf afterwards might miss some portions of process startup (and have an incomplete picture).

Cheers,
--Theo

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages