Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create or generate the .mlpd file for check the application performance in xamarin profiler

Hello Xamarin team,

I am working on Xamarin forms in Visual Studio 2017 Community, and I wanted to check the app performance in the Xamarin Profiler. For that I need to create an .mlpd to check the app performance in the Xamarin Profiler. How can I generate this file?

like image 623
praveena H M Avatar asked Sep 08 '18 11:09

praveena H M


1 Answers

Use the debug.mono.profile environment variable to enable the Mono profiler.

The debug.mono.profile system property enables the profiler. It is equivalent to, and uses the same values as, the mono --profile option. (See the mono(1) man page for more information.)

  • https://www.mono-project.com/docs/debug+profile/profile/profiler/#profiler-option-documentation

Quick Android Example:

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 files can become huge (not just megabytes, but 10s/100s of gigabytes in size depending upon what options you are using with the "log" profiler, make sure you have the storage available on your device (the Xamarin Profiler streams the log data over TCP and thus does not have this issue)

!Note!: If you are trying to store the mlpd file in a location outside of your app's sandbox, Mono will log the error under the mono-prof tag. If this is the case, you will need to grant your app write permission (i.e. via Android manifest and runtime permissions) from within the app itself.

[mono-prof] Could not create log profiler output file '/sdcard/Download/output.mlpd': Permission denied

Android Environment:

  • https://docs.microsoft.com/en-us/xamarin/android/deploy-test/environment

iOS Environment:

  • https://docs.microsoft.com/en-us/xamarin/ios/troubleshooting/questions/xs-mono-runtime

Xamarin Profiler (Does that all for you and has a nice GUI):

  • https://docs.microsoft.com/en-us/xamarin/tools/profiler/
like image 66
SushiHangover Avatar answered Oct 24 '22 09:10

SushiHangover