👨‍💻Analyse Mobile Games with APM

Bünyamin Eymen Alagöz
Huawei Developers
Published in
4 min readNov 30, 2022
Performance Monitoring of Mobile Games

Introduction

Hi everyone. In this article, we will talk about the Huawei APM kit definition, the reasons we need this kit, its integration with the Unity game engine, and how to use this kit specifically for the game.

What Is APM?

Application Performance Management (APM) is a mobile service that allows users to track the performance metrics of the applications they use and reports this to the developers on the panel in App Gallery Connect.

APM features and Basic Functions

APM Features

The performance metrics of our applications on the user side are of great importance to the application owners. Because no matter how many devices are tested, it is not possible to catch all the specific performance problems that the users may encounter during the testing phase. Therefore, it is a waste of time to handle and report these metrics by the users. It enables us to bring our application to a good point in terms of performance with fast updates without experiencing any problems. The Huawei APM Kit fully meets this need.

These are the metrics we can obtain by using the APM kit in applications.

  • Analysis of desired codes
  • Analysis of network metrics
  • Application not responding
  • High CPU usage
  • Page response time
  • Network request response time, success rate, and response size

🚧Integration of APM Kit into Unity Project🚧

First of all, our project needs to be created in AGC. You can find the necessary details here.

After the necessary actions are taken, the APM kit must be activated in App Gallery Connect.

App Gallery Connect

After that, you need to integrate the hms-unity-plugin into your unity project. You can access all versions of the plugin from this link.

Reference Game

🚧Usage of the APM Kit🚧

First of all, the EnableCollection(true) and EnableAnrMonitor(true) methods have to be run in the relevant script. Then our application will be able to obtain and report the relevant metrics.

ANR

If our mobile game does not take any action despite user reactions and the image on the screen is stable, it means that the application known as Application Not Responding does not respond (freezes). In such cases, the Android operating system produces a popup.

Application Not Responding

APM kit detects ANR statuses and reports them in App Gallery Connect. It is very possible that we encounter performance-related ANR status in mobile games. Therefore, it is very important to follow the situations that may cause performance problems with the trace structure, which we will see shortly, in order to quickly detect the problem.

AGC — ANR Report

APM Kit also detects and reports commands that cause ANR conditions.

Command Caused By ANR

Custom Event Analyse

Sometimes, we may want to set up an analysis structure that integrates performance problems in our game with any parameter in our game or system. In such cases, APM Kit provides us with a trace monitoring infrastructure. You can see the relevant commands below.

Custom Event

Let’s consider this trace structure with a real-game scenario. If we talk about unity, one of the most challenging stages in mobile games, let’s consider an FPS game that does not use the Object Pool design pattern. Also, shader optimization is not done :) Let’s consider the scenario where the rifle is fired. Let’s set up a trace structure in the fired command and get the CPU, Frames Per Second, and GPU data in this trace structure with system commands and add them to the trace structure. Comparative analysis with metrics maintained by APM will allow us quick on-site detection.

Custom Event Analyse

Conclusion

We have come to the end of our article on the analysis and reporting of game-specific problems that may occur in mobile game projects. Since the performance problems experienced in the mobile game projects, the performance problems in the android platform cause user losses, which brings a substantial financial burden to the companies. APM will take the companies one step forward in the game industry. I hope the article will be useful, have a good reading everyone…

References

--

--