Search code examples
androidmonitoringcpu-usagemulticore

How do I monitor the usage by CPU on Android?


I know that I can monitor the total usage by using, for instance:

adb top -m 10

But I would be interested in monitoring each CPU separately. Using top on Linux, I can use the interactive command '1' to show the usage for each CPU separately. How can I do this on Android?


Solution

  • Doesn't look like you can:

    # top -h
    Usage: top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ]
        -m num  Maximum number of processes to display.
        -n num  Updates to show before exiting.
        -d num  Seconds to wait between updates.
        -s col  Column to sort by (cpu,vss,rss,thr).
        -t      Show threads instead of processes.
        -h      Display this help screen.
    

    You could use systrace to track execution time of processes per cpu. Also see Analyzing Display and Performance with Systrace. If you have a rooted device busybox might have a more complete implementation.