How to profile Android game? (How to look for performance issues when working with android games?)

I come from the Unity community, where we have a profiler which shows which methods cost how many milliseconds to run, and shows CPU usage, for example. I wonder if there is such a profiler available for MonoGame Android game developers.

From what I have Googled, I can find the following methods:

  • Android Profiler (Android Studio)
  • Xamarin Profiler (Microsoft)
  • Performance Profiler (Microsoft Visual Studio)
  • Snapdragon Profiler (Qualcomm)

Android Profiler
This is one of the best ones out there, and I got it to work by loading in an APK into Android Studio. However, it cannot sample .NET code, meaning even though I would be able to see CPU and memory usage, I cannot see what method in C# is causing that lag, or whatever else I am profiling.

Xamarin Profiler
Needs Visual Studio Enterprise. Now, that is very expensive. And I do not want to subscribe to that. (No one does.)

Performance Profiler
It doesn’t work for Android. At least, it might, but it lists some very important tools such as CPU and Memory Usage as “not applicable”?

Snapdragon Profiler
I got to admit, I haven’t tried this one. However, it only works with Snapdragon-powered devices, and I think that to be very limiting. And I’m not sure, but I think this one also doesn’t support .NET code sampling.

Anyways, what are methods you MonoGame Android developers are using? Do you use Stopwatches, Stopwatches, everywhere?

using stopwatches and writing to console or android.log to determine the method that’s taking up most of the cpu.

then profiling that same app on the desktop to see fine details about which inner methods /lines are taking up time.
Continue working on the desktop as i fine tune / rewrite and measure results.
it’s faster to work on the desktop rather than deploing to a device anyway.
At the end I check on the device to confirm that my changes do have an effect.

Most androids are ARM and desktops are usualy X86-x64, but most of the time the botleneck is a wrong struct/collection/algorithm ,boxing etc.

1 Like

Ah, I see. That makes sense. That is a simple solution to the problem.