有人知道如何扩大“am profile”命令的缓冲区大小吗?或者甚至可以使用命令行扩大缓冲区大小?
我知道使用 Debug.startMethodTracing() 是可能的,但我需要它用于“am profile”命令。
谢谢!
有人知道如何扩大“am profile”命令的缓冲区大小吗?或者甚至可以使用命令行扩大缓冲区大小?
我知道使用 Debug.startMethodTracing() 是可能的,但我需要它用于“am profile”命令。
谢谢!
I had the same problem and had to look into this in details. Turned out there is no option to use with adb am
to set the buffer size, while android.os.Debug.startMethodTracing
has that option.
The difference seems to be the way ActivityManager
and Debug
do this. Debug
directly accesses VMDebug and calls the native function startMethodTracingNative
which accepts buffer size as the parameter, while AM calls a function from ActivityManagerService called profileControl, which uses ApplicationThreadNative to start profiling. This might eventually lead to the same native method VMDebug uses, I don't know, but what's obvious is that there is no buffer parameter considered inside AMS, so not possible to set it via adb.