New issue
Advanced search Search tips

Issue 731860 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

High CPU consumption on Android when metronome is playing

Project Member Reported by dskiba@chromium.org, Jun 9 2017

Issue description

When Google's metronome widget (google for 'metronome') is playing, all three Chrome processes consume ~98% of CPU on Android (as shown by adb shell top).

Here are typical results from current canary (61.0.3124.3):

  PID USER         PR  NI VIRT  RES  SHR S[%CPU] %MEM     TIME+ ARGS            
26813 u0_i33       10 -10 1.7G  85M  46M S 53.0   2.2   0:12.26 com.chrome.cana+
26852 u0_a123      10 -10 1.7G  75M  45M S 23.3   1.9   0:05.57 com.chrome.cana+
26785 u0_a123      16  -4 1.7G 117M  74M S 21.6   3.1   0:09.68 com.chrome.cana+
  637 audioserver  20   0  42M 4.2M 2.5M S  9.3   0.1   2:26.11 android.hardwar+
  490 system       -2  -8  68M  16M  12M S  9.3   0.4  11:14.40 surfaceflinger
  682 audioserver  20   0  66M 7.1M 3.1M S  9.0   0.1   2:26.66 audioserver
  981 system       16  -4 2.5G 283M 229M S  5.0   7.5  22:47.92 system_server
27003 root         20   0  10M 2.6M 1.4M R  4.6   0.0   0:00.29 top
  492 system       -3  -8  34M 3.8M 2.6M S  3.0   0.1   4:46.92 android.hardwar+
21578 root         RT   0    0    0    0 D  2.6   0.0   0:35.63 [mdss_fb0]
  681 root         RT   0    0    0    0 D  2.6   0.0   2:15.22 [kschedfreq:0]
16074 root         RT   0    0    0    0 D  2.3   0.0   0:33.88 [kschedfreq:2]
26772 root         20   0    0    0    0 S  2.0   0.0   0:00.24 [kworker/0:2]
26670 root         20   0    0    0    0 S  2.0   0.0   0:02.69 [kworker/u8:10]
26627 root         20   0    0    0    0 S  1.0   0.0   0:01.04 [kworker/u8:8]
   50 root         20   0    0    0    0 S  1.0   0.0   1:21.41 [smem_native_rp+
26923 root         20   0    0    0    0 S  0.6   0.0   0:00.39 [kworker/u8:11]
    7 root         -2   0    0    0    0 S  0.6   0.0   1:59.53 [rcu_preempt]
    3 root         20   0    0    0    0 S  0.6   0.0   2:11.89 [ksoftirqd/0]
26955 root         20   0  13M 984K 692K S  0.3   0.0   0:00.16 adbd --root_se

I.e.
* Renderer (26813) consumes 53% CPU
* Browser (26785) consumes 21.6% CPU
* GPU (26852) consumes 23.3% CPU


Is this expected?

 
When playing or when changing the bpm?

Comment 2 by dskiba@chromium.org, Jun 12 2017

The usage is when metronome is playing (i.e. after clicking 'play' button).
Hmm, seems a bit high, but I don't think it's media/ related. Putting the tab in the background on desktop drops the media/ usage to ~1-5% so I think it's all the animated effects around the blinking tick.

Comment 4 by dskiba@chromium.org, Jun 12 2017

When metronome tab is in the background CPU usage drops on Android too:

* Renderer (metronome): 20.6% CPU
* audioserver (2 processes): 22% CPU
* Browser: 7.6% CPU
* GPU process: 0.3% CPU
* Renderer (new tab page): ~0% CPU (not even showing)

Note the 2 audioserver processes are consuming similar amount (~18% CPU) when tab is in foreground.
Unfortunately audioserver (until N MR1 maybe?) won't allow us to do anything about it's CPU usage. I have a staged CL here which might help: 

https://codereview.chromium.org/2795743003

Even on the latest version of N that I have it doesn't seem to be working yet though.
Cc: -dalecur...@chromium.org
Owner: dalecur...@chromium.org
Status: Assigned (was: Untriaged)
dale, based on c#5, can I assign this bug to you in order to remove from untriaged plate?
Components: -Internals>Media Internals>Media>Audio
Project Member

Comment 8 by bugdroid1@chromium.org, Jul 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2fef49bc869c92b6ade718ac3ba07168b417ae02

commit 2fef49bc869c92b6ade718ac3ba07168b417ae02
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Fri Jul 28 02:29:57 2017

Enable power saving audio for LATENCY_PLAYBACK on Android.

Per the Android audio team's recommendation, enables
SL_ANDROID_PERFORMANCE_POWER_SAVING when playing back
audio which is tagged as AudioLatency::LATENCY_PLAYBACK.

BUG= 731860 , 747541 
TEST=audio playback works as normal.

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ie877e9ffe7e164f955905463f8175b2480a4a611
Reviewed-on: https://chromium-review.googlesource.com/581668
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Tommi <tommi@chromium.org>
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490215}
[modify] https://crrev.com/2fef49bc869c92b6ade718ac3ba07168b417ae02/media/audio/android/audio_manager_android.cc
[modify] https://crrev.com/2fef49bc869c92b6ade718ac3ba07168b417ae02/media/audio/android/audio_manager_android.h
[modify] https://crrev.com/2fef49bc869c92b6ade718ac3ba07168b417ae02/media/audio/android/opensles_output.cc
[modify] https://crrev.com/2fef49bc869c92b6ade718ac3ba07168b417ae02/media/audio/android/opensles_output.h
[modify] https://crrev.com/2fef49bc869c92b6ade718ac3ba07168b417ae02/media/audio/audio_manager_base.cc
[modify] https://crrev.com/2fef49bc869c92b6ade718ac3ba07168b417ae02/media/renderers/audio_renderer_impl.cc

Project Member

Comment 9 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/732ddfe0c3ff211936187e80879a6cef82cdb70b

commit 732ddfe0c3ff211936187e80879a6cef82cdb70b
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Thu Aug 03 17:51:11 2017

Expand no resampling support to Android; cleanup code.

Per discussions with the Android team they recommend we skip resampling
when using low power audio. This CL expands the workaround we already
have in place for ChromeOS into a more maintable state by introducing
AudioLatency::IsResamplingPassthroughSupported(). This method returns
true on ChromeOS and on Android when the right criteria are met.

There are several changes to the buffering size logic, but none should
result in any actual changes to the buffering size outside of the new
pass-through case. The pass-through case will prefer the larger of the
hardware buffer size or ~20ms to avoid issues with massive bluetooth
output buffers.

As part of this change I've cleaned up the logic in the mixer manager
for determining when to allow passthrough.

Per a battor run done by liberato@ this is a ~34% power reduction (!),
with a basic mp3 playback going from 0.265W to 0.175W.

BUG= 731860 , 747541 
TEST=verified resampling is not invoked for basic playback.

Change-Id: Ia885f41bc50d6fe36934587d34ae646d1ef89364
Reviewed-on: https://chromium-review.googlesource.com/590737
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491784}
[modify] https://crrev.com/732ddfe0c3ff211936187e80879a6cef82cdb70b/content/renderer/media/audio_renderer_mixer_manager.cc
[modify] https://crrev.com/732ddfe0c3ff211936187e80879a6cef82cdb70b/content/renderer/media/audio_renderer_mixer_manager_unittest.cc
[modify] https://crrev.com/732ddfe0c3ff211936187e80879a6cef82cdb70b/media/base/audio_latency.cc
[modify] https://crrev.com/732ddfe0c3ff211936187e80879a6cef82cdb70b/media/base/audio_latency.h
[modify] https://crrev.com/732ddfe0c3ff211936187e80879a6cef82cdb70b/media/renderers/audio_renderer_impl.cc

Status: Fixed (was: Assigned)
As fixed as it's going to get.

Sign in to add a comment