-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High CPU usage #7062
Comments
This comment has been minimized.
This comment has been minimized.
Okay I debugged this a bit: Used video: https://www.youtube.com/watch?v=GDqxvHSPu5c Device: Huawei P20lite (CPU: 4x 2.36 GHz, 4x 1.7 GHz)
GUI rendering is done on the GPU side and should have little to no effect on the above mentioned cpu processes So in my opinion everything works as expected:
|
@thefalsedev |
I am comparing it now with youtube vanced music. For newpipe:
For vanced:
For musicolet opus file:
We are talking about new pipe process and not other processes, and with the screen turned off while you are outdoors. |
After couple of songs it got 7% and after another few it has now 8%. I measured the battery, it consumes 0.041 mAh per second so far so it gives 16h playback. I think it's not bad compared to other players I got and their playtime.
The threads are looking like this:
For now, for over 35min it consumed 0.046 mAh per second. |
In vanced there is no HeapTaskDaemon working, hence lower cpu usage:
This seems that this HeapTaskDaemon has something to do with garbage collection. So it could be something is allocating and deallocating memory during playback. |
Ok over 1500s the vanced player with the same album on minimal volume consumed less power and so far it seems stable for 10 last minutes. I watched other processes and in both measurements nothing was happening like updates or some workers. Note that this supposedly garbage collection sometimes goes higer so the excessive power usage could hit 40% more no problem. I keep now playing now in newpipe to see if it goes any higher just from network playback. |
After a while of playing with the app, the HeapTaskDaemon increased to 7%:
I think this can be related to the total ram usage of the app in this case 175M. |
So I traced this to player and the progress loop firing too often. I did some changes and so far in emulator it's sometimes just 0.2% garbage collector cpu or whatever it is. Will test on that moto g4 player the release and compare. |
After disabling updating of progress in player there is 3% CPU usage as it should be:
Threads:
Now need to figure out how to start and stop this update loop properly. Right now it's firing thousdand times a second but should every 500ms. I dont fully understand how this SerialDisposable is supposed to work with stopping and starting progress loop. |
It seems that this progress bar is just too slow to update. But, the number of firings per second can be reduced from 2 to 1. So every 1 second as it's one second anyway. After such change it has 2% less CPU usage so by 30% of the whole process.
This is good and works fine, in Player.java, just change this:
However the best would be to make player progress loop stop when screen is off for optimal power consumption. |
I think we can close this issue as it was fixed with #7071 |
Checklist
Steps to reproduce the bug
Search for any song.
Press background play
Measure cpu time with adb shell top
Turn the screen off to disable gui to make sure gui is not rendering something
Actual behavior
CPU usage either 6% or 10% in top for newpipe process
Expected behavior
0% cpu usage for newpipe process as with other players where only media.codec is using 1% cpu
Device info
Moto G4 stock
Android 7
The text was updated successfully, but these errors were encountered: