tmassie / aospx

Automatically exported from code.google.com/p/aospx
0 stars 0 forks source link

Autorotate causes high CPU usage in system_server #116

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Enable autorotate

It seems that when auto-rotate is enabled its causing higher than normal cpu 
usage in system_server. This is also reported on stock Galaxy Nexus and Nexus S 
ICS builds, so its not something rom/device specific, or even kernel specific 
(2.6 vs 3.0). Granted having the sensor enabled some increase is expected, but 
not at this high rate..You can verify this by running 0xdroid VM test with it 
on versus off and you will see about a 200-300ms increase with it ON (hence 
more load on the cpu causing higher results)

0xdroid VM Auto-Rotate OFF = 41xx 
0xdroid VM Auto-Rotate ON = 43xx-44xx

Below is a link to the AOSP bug report and some logs from top/strace showing 
about +14% increase when idel.. This still needs to be verified on a stock HTC 
Sense rom to see if its just an AOSP issue, or if it happens on a stock rom as 
well (note that some increase is expected since the sensor is constantly 
monitoring, but it shouldnt be this high)

http://code.google.com/p/android/issues/detail?id=29965

### autorotate disabled (cpu usage is normal):
top -m 100 -d 1 -n 1 | head -20
User 0%, System 3%, IOW 0%, IRQ 0%
User 0 + Nice 0 + Sys 4 + Idle 99 + IOW 0 + IRQ 0 + SIRQ 0 = 103

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
11891  0   7% R     1   1000K    396K  bg root     top
11867  0   0% S     1      0K      0K  fg root     kworker/0:0
11814  0   0% S    11 273628K  23708K  bg app_70   
com.google.android.maps.mytracks
  132  0   0% S    81 369556K  45464K  fg system   system_server
  330  0   0% S    25 294536K  29760K  fg radio    com.android.phone
    8  0   0% S     1      0K      0K  fg root     sync_supers
    9  0   0% S     1      0K      0K  fg root     bdi-default
   10  0   0% S     1      0K      0K  fg root     kblockd
   11  0   0% S     1      0K      0K  fg root     khubd

### autoroate enabled - system_server usage is high

 top -m 100 -d 1 -n 1 | head -20
User 7%, System 12%, IOW 0%, IRQ 0%
User 6 + Nice 2 + Sys 13 + Idle 85 + IOW 0 + IRQ 0 + SIRQ 0 = 106

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
  132  0  14% S    81 369572K  45768K  fg system   system_server
12030  0   5% R     1   1004K    400K  bg root     top
  200  0   3% S    17 285416K  33964K  fg system   com.android.systemui
   78  0   2% S     8  42944K  16884K  fg system   /system/bin/surfaceflinger
  290  0   0% S     1   2464K    636K  fg wifi     /system/bin/wpa_supplicant
  223  0   0% S     1      0K      0K  fg root     dhd_dpc
11939  0   0% S     1      0K      0K  fg root     kworker/0:1
   10  0   0% S     1      0K      0K  fg root     kblockd
   11  0   0% S     1      0K      0K  fg root     khubd

### strace is writing following block repeatedly like crazy

Code:
(Timeout) <0.000037>
[pid   147] write(103, 
"h\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0pe\34d\2340\0\0\354\337\267?>\205\326@\275"..., 
104 <unfinished ...>
[pid   166] <... epoll_wait resumed> )  = 1 <0.031740>
[pid   166] read(102, 
"h\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0pe\34d\2340\0\0\354\337\267?>\205\326@\275"..., 
104) = 104 <0.000034>
[pid   166] clock_gettime(CLOCK_MONOTONIC, {53448, 257720074}) = 0 <0.000030>
[pid   166] write(46, "W"..., 1)        = 1 <0.000278>
[pid   166] read(102, 0x519ebb80, 104)  = -1 EAGAIN (Resource temporarily 
unavailable) <0.000032>
[pid   166] epoll_wait(0x6a, 0x519eb9f0, 0x10, 0xffffffff <unfinished ...>
[pid   148] <... epoll_wait resumed> )  = 1 <0.029798>
[pid   148] read(45, "W"..., 16)        = 1 <0.000038>
[pid   148] clock_gettime(CLOCK_MONOTONIC, {53448, 261245950}) = 0 <0.000035>
[pid   148] getpid()                    = 132 <0.000090>
[pid   148] getuid32()                  = 1000 <0.000029>
[pid   148] epoll_wait(0x2f, 0x50787a90, 0x10, 0) = 0 <0.000032>
[pid   148] clock_gettime(CLOCK_MONOTONIC, {53448, 263335575}) = 0 <0.000276>
[pid   148] epoll_wait(0x2f, 0x50787a90, 0x10, 0xa6d7 <unfinished ...>
[pid   147] <... write resumed> )       = 104 <0.008302>
[pid   147] poll([{fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=42, 
events=POLLIN}, {fd=43, events=POLLIN}, {fd=41, events=POLLIN}], 5, -1 
<unfinished ...>
[pid   146] <... write resumed> )       = 16 <0.012667>
[pid   146] ioctl(39, 0x80066108, 0x50587ec0) = 0 <0.016268>
[pid   146] write(36, "\0\0\0\0\0\0\0\0\2\0\0\0]\1\0\0"..., 16) = 16 <0.000044>

So as a temp fix you can just enable auto-rotate only when needed...in the 
notification pull down you can hit the little Settings icon to bring up the 
quick toggles and enable/disable from there without having to go into 
Settings->Display

Original issue reported on code.google.com by robbe...@gmail.com on 4 Oct 2012 at 5:02

GoogleCodeExporter commented 8 years ago
Also this is not build specific, or something new..this has happened since the 
initial ICS releases. Its just taken me this long to verify what was causing 
the higher scores in 0xdroid VM test..lol

Original comment by robbe...@gmail.com on 4 Oct 2012 at 5:13

GoogleCodeExporter commented 8 years ago

Original comment by robbe...@gmail.com on 4 Oct 2012 at 6:54

GoogleCodeExporter commented 8 years ago
Moving this to "backlog" for now,.. it is still undetermined whats causing this 
and since it is an AOSP bug I will wait a little bit to see if any changes are 
made upstream. A fix seems unlikely in near/upcoming releases (hence moving to 
backlog), once work is started on this I will pull it out of the backlog queue 
and back to a MRx target.

Original comment by robbe...@gmail.com on 27 Oct 2012 at 7:33

GoogleCodeExporter commented 8 years ago
is there any status update for this fix? The phone is basically ruined (hence 
the low battery life) and, as far as i can tell, almost everybody is affected. 
There are several other threads around describing the same problem.

What is the point in buying a "Google phone" when one update just breaks it and 
the fix is "ultra low priority". For now I'm sticking to my "auto rotation auto 
lock" application, however seeing the phone lagging when you rotate the screen 
because of the high cpu usage is just pitiful. 

Original comment by klaus.gr...@gmail.com on 23 Dec 2012 at 4:04