Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从logcat到登录代码的Android活动启动时间_Android_Performance_Logcat - Fatal编程技术网

从logcat到登录代码的Android活动启动时间

从logcat到登录代码的Android活动启动时间,android,performance,logcat,Android,Performance,Logcat,首先,我使用两种方法来测量活动启动时间。 第一个是使用以下命令adb logcat-b events-d | grep am_activity_launch_time,其中最后一个的第二个是表示启动时间 11-02 17:14:39.710 608 626 I am_activity_launch_time [0,146177546,com.example.audiorecorder/.MainActivity,322,322] 无论如何,如果在代码Log.i(appName,star

首先,我使用两种方法来测量活动启动时间。 第一个是使用以下命令
adb logcat-b events-d | grep am_activity_launch_time
,其中最后一个的第二个是表示启动时间

11-02 17:14:39.710   608   626 I am_activity_launch_time [0,146177546,com.example.audiorecorder/.MainActivity,322,322]
无论如何,如果在代码
Log.i(appName,start)
中使用,在
onCreate
的开头和
onResume()
的结尾,经过的时间大约是50毫秒(这似乎是不可能的),而在logcat中则是322毫秒

有没有想过这种差异会如此之大

我需要使用
Log.I()
获得正确的度量值,以便使用我开发的活页夹服务计算相同应用程序(活动)的开销

谢谢