Hi Forum,
In streamline tool, I don't see any way to pass command line argument to the app when launching. Because of this I need to rebuild the apk and reinstall every time I need to change the command line argument.
Is there a work around to this problem?
Thank you,
rchakena
Hi rchakena,You can start the application how you'd like via the am command in adb shell. You would also have to manually copy the gator agent onto the device and run it as the same user as your app, instructing gator to profile using your app's package name. Streamline would connect to gator via adb's port forwarding.In your streamline directory we package builds of gator that can be copied to the device. For the rest of this example I'll use the one in streamline/bin/android/arm64/gatordsince I'm presuming a 64bit android target.1. Start streamline.2. Push gatord to the target: $ adb push streamline/bin/android/arm64/gatord /data/local/tmp3. adb shell onto the target. $ adb shell4. On some target devices perf hardening may be on, which blocks gatord from collecting data via perf. Gatord needs this, so to disable perf hardening: $ getprop | grep perf_harden # check what its current value is, so you can restore it back $ setprop security.perf_harden 0 After you have finished profiling you can restore the previous value with $ setprop security.perf_harden <the-previous-value>5. Switch to your program's user $ run-as <YourAppsPackage>6. You may not be able to execute gatord in the /data/local/tmp directory, so copy it into your app's directory (which should be the current dir). $ cp /data/local/tmp/gatord .7. Run gator as your program's user, specifying the package name $ ./gatord --wait-process <YourAppsPackage>8. In streamline switch to the TCP (Advanced) tab. There should be an entry in the table corresponding to your device. Select it.9. Start the capture by pressing 'Start Capture'10. Start your app how you like. You can use a separate adb shell to start it with am, supplying your arguments.Andrew
Hi Andrew,
I tried these steps and reached till step7. But when I run step 7. i.e ./gatord --wait-process <YourAppsPackage> I get the below error.
Streamline gatord version 800 (Streamline v8.0)Default perf mmap size set to 128 pages (512kb)Error creating server TCP socket (1 : Operation not permitted)
Any other settings that need to be changed. The security_perf_harden has been changed to 0.
1|t2s:/ $ getprop | grep perf_harden[security.perf_harden]: [0]
Looks like gator couldn't listen on TCP for incoming connections from streamline. You can instruct it to use unix domain sockets instead. Try
$ ./gatord --port uds --wait-process <YourAppsPackage>
Andrew
This worked! Thank you.