测量Android应用程序的启动时间 [英] Measure Android app startup time

查看:158
本文介绍了测量Android应用程序的启动时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是最precise的方法来衡量的Andr​​oid应用程序的启动时间?

通过启动时间,我指的是2和3之间的区别:

  1. 在该应用程序没有运行
  2. 在用户点击应用程序图标,启动
  3. 主要活动是完全初始化

所以,我基本上都需要以某种方式得到的时间过去了,因为JVM启动,并记录它。

解决方案
  

我想这个发展过程中跟踪启动时间在不同的设备和Android版本

完成,这将是经由LogCat中的唯一途径。根据定义,你可以不知道的启动时间的code得到控制权从自己的code之前。你将不得不寻找与启动器图标点击相关的LogCat中的条目,然后寻找一个LogCat中的条目添加的是不管你认为主要活动是完全初始化(例如,结束 onResume( )),并计算增量。

What is the most precise way to measure startup time of an Android app?

By startup time I mean the difference between 2. and 3. :

  1. The app process is not running
  2. User clicks on app icon in the launcher
  3. Main Activity is fully initialized

So I basically need to somehow get time elapsed since JVM started and log it.

解决方案

I want this to track the startup time on different devices and Android version during the development

The only way of accomplishing this will be via LogCat. By definition, you cannot know the startup time before your code gets control from your own code. You will have to look for the LogCat entry associated with the launcher icon click, and then look for a LogCat entry you add that is whatever you consider "Main Activity is fully initialized" (e.g., end of onResume()), and compute the delta.

这篇关于测量Android应用程序的启动时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆