Android 检索ActivityManager报告的有关活动启动性能的值

Android 检索ActivityManager报告的有关活动启动性能的值,android,performance,android-activity,Android,Performance,Android Activity,ActivityManager自动将系统绘制活动所花费的总时间打印到logcat: ActivityManager: Displayed com.example.SomeActivity: +500ms (total +1s500ms) 有没有办法订阅此事件并在应用程序本身中获取这些值?在应用程序本身中获取值?@azizbekian Yes除了不断轮询logcat之外,我看不到其他方法。您可以通过以下方式过滤logcat输出:logcat-s ActivityManager-e Display

ActivityManager
自动将系统绘制
活动所花费的总时间打印到logcat:

ActivityManager: Displayed com.example.SomeActivity: +500ms (total +1s500ms)

有没有办法订阅此事件并在应用程序本身中获取这些值?

在应用程序本身中获取值?@azizbekian Yes除了不断轮询logcat之外,我看不到其他方法。您可以通过以下方式过滤logcat输出:
logcat-s ActivityManager-e Displayed
。将其视为一个框架实现。在应用程序本身中获取值吗?@azizbekian Yes除了不断轮询logcat之外,我看不到其他方法。您可以通过以下方式过滤logcat输出:
logcat-s ActivityManager-e Displayed
。将其视为一个框架实现。