你好 Xamarin 团队,
我正在 Visual Studio 2017 社区中处理 Xamarin 表单,我想检查 Xamarin Profiler 中的应用程序性能。为此,我需要创建一个 .mlpd 来检查 Xamarin Profiler 中的应用程序性能。我怎样才能生成这个文件?
Use the debug.mono.profile
用于启用 Mono 分析器的环境变量。
debug.mono.profile 系统属性启用探查器。它与 mono --profile 选项等效并使用相同的值。 (有关详细信息,请参阅 mono(1) 手册页。)
- https://www.mono-project.com/docs/debug+profile/profile/profiler/#profiler-option-documentation https://www.mono-project.com/docs/debug+profile/profile/profiler/#profiler-option-documentation
Android 快速示例:
adb shell setprop debug.mono.profile "log:calls,alloc,output=/sdcard/Download/output.mlpd,maxframes=8,calldepth=100"
// Exercise your app...
adb pull /sdcard/Download/prof.mlpd ~/Desktop/
adb shell rm /sdcard/Download/prof.mlpd
adb shell setprop debug.mono.profile ""
// View the results:
`which mprof-report` ~/Desktop/prof.mlpd
Note: .mlpd
文件可以变成huge(不仅仅是兆字节,而是 10s/100s 的 GB 大小,具体取决于您在“日志”分析器中使用的选项,请确保您的设备上有可用的存储空间(Xamarin Profiler 通过 TCP 流式传输日志数据,因此不会没有这个问题)
!Note!:如果您尝试将 mlpd 文件存储在应用程序沙箱之外的位置,Mono 会将错误记录在mono-prof
标签。如果是这种情况,您需要从应用程序本身授予应用程序写入权限(即通过 Android 清单和运行时权限)。
[mono-prof] Could not create log profiler output file '/sdcard/Download/output.mlpd': Permission denied
安卓环境:
- https://learn.microsoft.com/en-us/xamarin/android/deploy-test/environment https://learn.microsoft.com/en-us/xamarin/android/deploy-test/environment
iOS环境:
- https://learn.microsoft.com/en-us/xamarin/ios/troubleshooting/questions/xs-mono-runtime https://learn.microsoft.com/en-us/xamarin/ios/troubleshooting/questions/xs-mono-runtime
Xamarin Profiler(这一切都可以为您完成,并且有一个漂亮的 GUI):
- https://learn.microsoft.com/en-us/xamarin/tools/profiler/ https://learn.microsoft.com/en-us/xamarin/tools/profiler/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)