Trigger Snapshot in Xamarin profiling using Commandline

时间:2018-07-25 05:02:17

标签: xamarin.android adb

I use below technique to take heap snapshot from android device for my App.

  1. Enable heapshot logging:

    adb shell setprop debug.mono.profile log:heapshot

  2. Start your app. (If your app was already running before (1), kill and restart it.)

  3. Use your app.

  4. Grab the profile data for your app:

    adb pull /data/data/@PACKAGE_NAME@/files/.override/profile.mlpd @PACKAGE_NAME@ is the package name of your application, e.g. if your package is FooBar.FooBar-Signed.apk, then @PACKAGE_NAME@ will be FooBar.FooBar.

When I open generated mlpd file in Xamarin profiler, it shows over all allocations, but does not show any Snapshots / Live objects.

How to trigger a snapshot through command line? Is there any adb command or any possibility to usage for particular snapshot? since i am automating over all scenario.

1 个答案:

答案 0 :(得分:0)

非常老的帖子,但仍在发布答案,因为它可以帮助需要帮助的其他人: 使用以下命令:

  1. 首先设置属性

    adb shell setprop debug.mono.profile日志:alloc,maxframes = 2,heapshot = 10000ms

  2. 重新启动应用程序,并在操作/测试用例后使用以下命令提取文件

    adb shell pull / data / data / @ PACKAGE_NAME @ / files /。覆盖 /profile.mlpd profile1.mlpd

  3. 分析完成后,强制停止应用以停止分析

    adb shell强制停止@PACKAGE_NAME @

有关更多信息,请参阅链接: https://www.mono-project.com/docs/debug+profile/profile/profiler/