[Toybox] ps down, top to go

enh enh at google.com
Fri May 6 11:58:18 PDT 2016


in case you're wondering why i sent the roadmap update saying i'd
switched to toybox ps although the ps pid/tid truncation bug i found
hasn't been fixed, it's because no current or near-future Android
system has max_pid > 65536 anyway.

(for the record, i'm no longer able to reproduce the "tcnt always 0"
bug, so you can ignore that. i'll poke more if i see it again.)

as for top, dumpstate's "toolbox top -n 1 -d 1 -m 30 -H” is more or
less equivalent to “toybox top -b -n 1 -o
pid,tid,user,pr,ni,%cpu,s,vsz,rss,pcy,name -s 6”, except for the fact
that toolbox's top shows both thread and process name. so you'll see
something like this:

 1794  1806 u0_a11   20   0   0% S 1502820K  54016K  fg Binder_1
 com.android.onetimeinitializer
 1794  1807 u0_a11   20   0   0% S 1502820K  54016K  fg Binder_2
 com.android.onetimeinitializer
 1811  1811 u0_a24   20   0   0% S 1518092K  57752K  bg
ndroid.calendar com.android.calendar
 1811  1816 u0_a24   29   9   0% S 1518092K  57752K  bg Jit thread
pool com.android.calendar

where (manually editing the above just to make the difference more
obvious) with toybox i can only get something more like:

 1794  1806 u0_a11   20   0   0% S 1502820K  54016K  fg [Binder_1]
 1794  1807 u0_a11   20   0   0% S 1502820K  54016K  fg [Binder_2]
 1811  1811 u0_a24   20   0   0% S 1518092K  57752K  bg com.android.calendar
 1811  1816 u0_a24   29   9   0% S 1518092K  57752K  bg [Jit thread pool]

so the []s are helpful in making the threads stand out, but unlike ps
it's a lot less obvious with top *whose* jit thread pool and *whose*
binder threads we're looking at. afaict this would require either
adding yet another slightly different "name" field or changing the
interpretation of one of the existing ones. thoughts?

(if you want a stand-alone C pthread test .c file let me know, but if
you're running chrome, you can see this even with toybox ps -A -T ---
chrome has plenty of threads.)

-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.



More information about the Toybox mailing list