ActivityManagerService: Rework dumping of top CPU processes.
Try and measure the CPU load as early as possible to get a more
realistic picture. Also, reduce the sampling set for the CPU
load to a 200ms timeslice.
Pros:
- Stack dumping for the first / native processes can take a while,
which might mean that our CPU measurement happens several seconds
after the ANR occurred.
- CPU measurements might be skewed by the stack dumping itself.
Cons:
- We capture traces for the "important" processes ~500ms later. This
will not make any difference to the class of ANRs caused by
deadlocks etc. It might however mean that we get unhelpful stack
traces for ANRs caused by starvation / livelock etc. since the main
thread might have made progress in this additional time. Arguably,
this is isn't a big drawback since ANR reports from such apps are
likely to be noisy anyway.
Bug: 32064548
Test: Manual: Compared two ProcessCpuTrackers that would fire at the
same time, one with a 500ms timeslice and another with a 200ms
timeslice. There was usually no difference in the top 5
processes in their working sets. When there was, it was just an
ordering difference the vast majority of the time.
Change-Id: Ic81802cb62828fdc02a01b229dc1d6545a465ecd
1 file changed