How to get higher precision of “CPU%” than that from TOP command?

前端 未结 4 678
走了就别回头了
走了就别回头了 2021-02-02 02:08

When I use TOP command, I could get the following info:

shell@android:/ $ top -n 1                                                     

User 31%, System 10%, IO         


        
4条回答
  •  情深已故
    2021-02-02 02:26

    Use DDMS and method profiling to get a TraceView.

    Basically:

    1. Launch your app in debug mode
    2. In DDMS, in the Devices tab, click "Start method profiling"
    3. Do stuff on your device to recreate the conditions you want to monitor
    4. Click "Stop method profiling"
    5. You'll get a fairly detailed graph with each thread's execution that you can drill down into

    More details here: http://developer.android.com/tools/debugging/debugging-tracing.html

    Disclaimer: I've only done this with a simple test app so I don't know how much mileage you'll get out of it. It does seem to give a bit more precision than what has been described so far, and does not require root.

    enter image description here

提交回复
热议问题