0

有人知道如何扩大“am profile”命令的缓冲区大小吗?或者甚至可以使用命令行扩大缓冲区大小?

我知道使用 Debug.startMethodTracing() 是可能的,但我需要它用于“am profile”命令。

谢谢!

4

1 回答 1

2

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.

于 2014-05-01T15:18:50.717 回答