See the Unity Documentation for details Unity - Manual: Profiling your application (unity3d.com).
Recommended setup:
- Connect the Android device to a computer via cable.
- Activate adb WiFi and make sure that both devices are connected via the same wireless network, then disconnect the Android device from the cable. Optionally adb via cable can be used as well.
- In the build settings select the options and build the app:
- Development Build
- Autoconnect Profiler (recommended)
- Deep Profiling Support (optional, can slow down the app)
- Press Ctrl + 7 or go to Window > Panels > 9 Profiler to open the Profiler window.
- If Autoconnect Profiler was ticked for this build, upon starting a Unity application on a device, the profiler should automatically react and connect to your Android device. In case Autoconnect Profiler was not active, choose the device running the application in the Play Mode tab.
- The profiler can now record data coming from the mobile app.