Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio CPU Profiler - start recording an app launch [duplicate]

Attaching Android Studio 3.0 Android Profiler to debug app from cold start is almost impossible, because I'd have to select process from dropdown (and start record) in very short timespan.

For profiling app cold start, is there a more convenient way?

Selecting "debug app" in android Developer Settings does not help unfortunately.

like image 716
poss Avatar asked Oct 04 '17 12:10

poss


3 Answers

With Android Studio 3.2 Canary 11, you can profile your app from startup.

Just go to Run -> Edit Configurations -> Profiling Tab and check "Start recording a method trace on startup".

Here's a link to download it. https://developer.android.com/studio/archive.html

like image 142
shaishgandhi Avatar answered Nov 10 '22 09:11

shaishgandhi


Well, makeshift solution because I didn't find anything better :

I set breakpoint in Application onCreate to make sure cold boot stops on it. This gives me enough time to set up Android Profiler and select my process. However by starting app with debugger attached, the results might be bit skewed, because debugger slows down app a little.

Seems to be the best option I have for now, but since nobody posted anything I missed, I'll try to do feature request on android tracker.

like image 25
poss Avatar answered Nov 10 '22 08:11

poss


Run -> Edit Configurations ->

enter image description here

like image 1
Leonid Ivankin Avatar answered Nov 10 '22 08:11

Leonid Ivankin