This topic describes how to add performance logs.
Performance logs include:
Startup time log
Lag log
Stuck log
To view performance data, you can:
Log in to the mPaaS console and choose Mobile Analysis Service > Basic analysis to view the startup duration.
Log in to the mPaaS console and choose Mobile Analysis Service > Performance analysis to view lag and stuck reports.
Startup time tracking
The startup duration of an app is about the seconds elapsed from the time the app starts to the time the following method is called.
MPLogger.reportLaunchTime(Context context);
We recommend that you call the preceding method in the onCreate()
method of Activity
for the home page.
Lag tracking
A lag occurs if an Android main thread does not complete executing a method within 2.25 seconds. The lag threshold may vary by APK package.
When the APK package is a debug package, the lag threshold is 0.75 seconds, so that you can find the potential lagging problems during debugging.
When the APK package is a release package, the lag threshold is 0.25 seconds.
To enable lag monitoring, the activity must inherit the classes BaseActivity
, BaseFragmentActivity
, or BaseAppCompatActivity
provided by the mPaaS framework.
If the APK package is a debug package, lag monitoring covers full data; if the APK package is a release package, lag monitoring covers the data sampled at a rate of 10%.
Stuck tracking
A stuck occurs when an Android main thread does not respond for more than 5 seconds.
To enable stuck monitoring, the activity must inherit the classes BaseActivity
, BaseFragmentActivity
, or BaseAppCompatActivity
provided by the mPaaS framework.