[Toybox] Interpreting top -H -O CPU output

Rob Landley rob at landley.net
Wed Feb 6 14:34:41 PST 2019


On 2/6/19 12:56 PM, Dmitry Shmidt wrote:
> Hi Rob,
> 
> I am using your top tool implementation for Android from
> toybox project.
> I am wondering if in the mode where it shows cpu usage
> per thread, the total usage per task (process) is included in initial
> ("main") thread?

I don't really use threads much, Elliott provided most of the use cases for that.

> For example: com.google.android.youtube.tv
> <http://com.google.android.youtube.tv> shows 153% usage
> for main thread and some more for other threads, like MainWebView - 31%.
> Is this 31% included in 153% report or not?

It should never report more than 100%, so it sounds like it is combining CPU
usage from threads into the parent, yes.

Hmmm... Top -H isn't showing TID by default, and top -H -O TID is never showing
more than one instance of the same PID... until I sort by TID, and then I get a
bunch of chrome threads under the same PID, each with 1.5% of the CPU. So yeah,
CPU usage is per process here, not per thread.

I'm trying to cut a release, but let me add that to the todo list for next
release. (I should try to come up with a better test case because y system's way
too loaded normally...)

Rob


More information about the Toybox mailing list