[Toybox] ps -T
enh
enh at google.com
Thu Oct 19 16:13:28 PDT 2017
On Sun, Oct 15, 2017 at 11:10 AM, Rob Landley <rob at landley.net> wrote:
> And this one was stuck in gmail's spam filter too. (Sorry for the delay,
> the down arrow on my keyboard came off. I have a new keyboard but
> swapping it out involves shutting this down and closing 6 desktops full
> of windows full of tabs. Working on it...)
>
> [Notices this email didn't get sent, while stopped at a McDonald's in
> Oklahoma on the drive back from minneapolis to austin. Right, time to
> press send...]
>
> On 09/20/2017 05:08 PM, enh wrote:
>> ps -T doesn't really work if you have any filters. so ps -AT is fine,
>> but ps -p <chrome pid> -T only shows the main thread.
>
> Alas, I don't personally use threads much so basically never test this.
>
>> why? because slots[SLOT_pid] is "wrong" in shared_match_process (where
>> by wrong i mean "is the tid").
>>
>> why? because toybox reads (say) /proc/147047/task/147058/stat and sees
>>
>> 147058 (CompositorTileW) S 31782 6249 6249 0 -1 1077952576 4 0 0 0 0 0
>> 0 0 20 0 11 0 1211910244 928649216 35602 18446744073709551615
>> 94558515900416 94558627572512 140720560858928 140506510343072
>> 140506833892356 0 0 4098 1073827581 1 0 0 -1 31 0 0 0 0 0
>> 94558627579744 94558633602584 94558666661888 140720560866826
>> 140720560866928 140720560866928 140720560869342 0
>>
>> and copies 147058 into SLOT_pid because that code no longer knows the real pid.
>>
>> not sure how best to fix this.
>
> Hmmm... Reasonably straightforward to fix, but my tree has local c
> changes in ps.c. Looks like I'm adding -m to show maximum number of
> lines (somebody asked, it's easy enough.)
i said "no" to the single internal request we had for that when we
switched from traditional Android top to toybox top. easy, yes, but
not obviously useful. the original Android top only had batch mode, so
it was a bit more useful then. but "first N" isn't an obviously
meaningful heuristic. "field X no lower than Y" would be more
convincing. but that's no longer as easy :-)
> And -H to iotop (which is
> where I left off; need to come up with a test for this and haven't got
> one. Is chrome threads or processes? The big scott mccloud comic implied
> processes, but the way google does everything implies threads, but
> threads would defeat the entire VM sandboxing purpose of having each tab
> in its own process...)
if you run (GNU) "ps -AT" while chrome's running, you'll see it's a
mix. i think even the original design assumed that. see the first
diagram here, where solid boxes are processes and dashed boxes are
threads: https://www.chromium.org/developers/design-documents/multi-process-architecture
here's far more detail than you could possibly want (including the
command-line options that let you configure the model):
https://www.chromium.org/developers/design-documents/process-models
and here's a Chrome engineer's "it's complicated, and everyone
misunderstands" post:
https://plus.google.com/+PeterKasting/posts/TC4ACtKevJY
> [Which is where I stopped doing the "this is simple, I should just fix
> it before finishing the reply..." and 3 days later that part's not done
> yet...]
>
> [Rob]
>
> [P.S. You can use two finger scrolling to replace a down arrow in
> chrome, the "j" key instead of a down arrow in vi, and hit page down and
> cursor back up a lot. I really should finish closing windows and shut
> down so I can replace the keyboard one of these days...]
--
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