murat8505 / android-xbmcremote

Automatically exported from code.google.com/p/android-xbmcremote
0 stars 0 forks source link

Using too much CPU #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I did "./adb shell top | grep xbmc" while playing a song, and having "now
playing" active. This is the result:

18804  64% S    12 109228K  17424K app_68   org.xbmc.android.remote
18804  51% S     8 107200K  17484K app_68   org.xbmc.android.remote
18804  73% S     9 108244K  17508K app_68   org.xbmc.android.remote
18804  61% S     8 105084K  17404K app_68   org.xbmc.android.remote
18804  76% S    12 111344K  17536K app_68   org.xbmc.android.remote
18804  38% S     7 104048K  17396K app_68   org.xbmc.android.remote
18804  62% S    11 110308K  17528K app_68   org.xbmc.android.remote
18804  59% S    10 107156K  17420K app_68   org.xbmc.android.remote
18804  36% S     9 106120K  17412K app_68   org.xbmc.android.remote
18804  50% S    12 109228K  17444K app_68   org.xbmc.android.remote
18804  75% S     8 107200K  17516K app_68   org.xbmc.android.remote
18804  79% S    10 108192K  17444K app_68   org.xbmc.android.remote
18804  63% S    10 109280K  17536K app_68   org.xbmc.android.remote
18804  61% S    12 109228K  17452K app_68   org.xbmc.android.remote
18804  68% S     9 108240K  17524K app_68   org.xbmc.android.remote
18804  54% S     7 104048K  17412K app_68   org.xbmc.android.remote
18804  78% S     8 105084K  17420K app_68   org.xbmc.android.remote
18804  64% S    12 111344K  17552K app_68   org.xbmc.android.remote
18804  53% R    10 107156K  17432K app_68   org.xbmc.android.remote
18804  76% S    10 109284K  17516K app_68   org.xbmc.android.remote
<18804  65% S    10 107156K  17440K app_68   org.xbmc.android.remote
18804  62% S    11 108192K  17448K app_68   org.xbmc.android.remote
18804  72% S     8 105084K  17420K app_68   org.xbmc.android.remote
18804  64% S     9 106120K  17432K app_68   org.xbmc.android.remote
18804  58% S    12 109228K  17456K app_68   org.xbmc.android.remote
18804  57% S    12 111348K  17540K app_68   org.xbmc.android.remote

This is a with Magic at 528Mhz.

Original issue reported on code.google.com by sop...@gmail.com on 20 Sep 2009 at 10:05

GoogleCodeExporter commented 9 years ago
Actually, the cpu-usage doesnt go down even with xbmcremote in the background!

Original comment by sop...@gmail.com on 20 Sep 2009 at 10:06

GoogleCodeExporter commented 9 years ago
Playing a song where? Locally or on XBMC machine? Playing on XBMC should not 
make any
difference since "playing a song" is just sending the play command and go back 
to
idling. 

I'll check how much CPU it uses here, but I never noticed any particular 
problems.

Original comment by phree...@gmail.com on 20 Sep 2009 at 3:34

GoogleCodeExporter commented 9 years ago
I was playing it in XBMC.

When starting the app again, I see that it starts out at 0% nice enough. But 
then if
I browse mp3s it starts going up to ~50% and stays there whatever I do.

Original comment by sop...@gmail.com on 20 Sep 2009 at 8:36

GoogleCodeExporter commented 9 years ago
Actually, not even choosing "exit" in the menus seems to help. That is very bad 
:)

Original comment by sop...@gmail.com on 20 Sep 2009 at 8:48

GoogleCodeExporter commented 9 years ago
This is the stack of the thread (MAIN) that seems to use too much CPU:

Object.wait(long, int) line: not available [native method]  
MessageQueue(Object).wait(long) line: 326   
MessageQueue.next() line: 144   
Looper.loop() line: 110 
ActivityThread.main(String[]) line: 3960    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) 
line: not
available [native method]   
Method.invoke(Object, Object...) line: 521  
ZygoteInit$MethodAndArgsCaller.run() line: 782  
ZygoteInit.main(String[]) line: 540 
NativeStart.main(String[]) line: not available [native method]  

Original comment by sop...@gmail.com on 20 Sep 2009 at 8:55

GoogleCodeExporter commented 9 years ago
This patch atleast points to what the problem is: some sort of never-ending 
message
loop seemingly related to display updates? I don't know how to fix it.

Index: src/org/xbmc/android/remote/activity/NowPlayingActivity.java
===================================================================
--- src/org/xbmc/android/remote/activity/NowPlayingActivity.java    (revision 85)
+++ src/org/xbmc/android/remote/activity/NowPlayingActivity.java    (working copy)
@@ -48,6 +48,7 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.Handler.Callback;
+import android.util.Log;
 import android.view.Display;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -130,6 +131,7 @@
    Thread updateViewThread;

    public boolean handleMessage(Message msg) {
+       Log.i("Mloop", "Got msg what: " + msg.what);
        if (msg.what == 1) {
            if (updateViewThread == null || !updateViewThread.isAlive()) {
                updateViewThread = new Thread(this);

Original comment by sop...@gmail.com on 20 Sep 2009 at 9:13

GoogleCodeExporter commented 9 years ago
We have a thread which constantly updates the data in the NowPlaying activity 
which
does a postback when new data has arrived, My bet is that this thread is taking 
to
much CPU. And it's not stopped on minimize of XBMC Remote.

Original comment by Tobias.A...@gmail.com on 25 Sep 2009 at 5:09

GoogleCodeExporter commented 9 years ago
Can you look at the issue Tobias? I'll reassign it to you.

Original comment by phree...@gmail.com on 29 Sep 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Sure will take a good look at it

Original comment by Tobias.A...@gmail.com on 29 Sep 2009 at 11:28

GoogleCodeExporter commented 9 years ago
Fixed in r102 nice find sopues!

Original comment by Tobias.A...@gmail.com on 29 Sep 2009 at 8:07