Kodi Community Forum

Full Version: High CPU only when on Movies or TV item of home menu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
I know there are tons of "Why is CPU usage high?" questions. I've read them all and found that my high usage was only in this specific scenario.

When XBMC is on the Home screen if I select either Movies or TV (not entering those sub menus, just highlighting while remaining on the Home screen) my CPU usage pegs at 100% (monitoring via top over ssh). By 100% I mean xbmc.bin takes up whatever processor power is left and the system load reported by top then averages ~1.2 to ~1.5. This seems to last indefinitely. The longest I had it sitting on one of these menus was ~48 hours and every time I checked the CPU was pegged.

Selecting any other menu item on the Home screen immediately results in CPU usage of ~10-20% (indefinitely).

My suspicion is that it has to do with the "Recently Added" listings for each of these menus, however there is no similar CPU usage for Music which also has a "Recently Added" listing.

I would suspect video file thumbnails, but only TV has actual file thumbnails. Movies has DVD cover art thumbnails (and Music has album cover art thumbnails).

I'm using RaspBMC 1.0 Final and the default Confluence skin.

It's not a big deal, but I have some other processes running on the system that I would prefer to not be CPU-starved for no reason without having to remember to adjust the UI selection before turning off my TV.

It seems like a legitimate bug.

Any thoughts?

(It'd also be great to have a idle setting that just stops the rendering loop altogether, no need to burn cycles rendering when I have my TV off.)

I'm new to posting on the forums, but I've been using XBMC since the original Xbox days and I've been using Linux exclusively for over 8 years (starting with Gentoo), and I work as a professional software developer, so I'm more than happy to poke around if anyone has ideas on what to look for.
Enabling logging and looking at xbmc.log may show if it's doing real work (like decoding jpegs).
I'd guess something is going wrong with the dirty rectangles code which should skip rendering when nothing has changed.

I'm only seeing about 30% CPU when on Movies or TV Shows.

What do you have "vertical blank sync" set to in settings/system/video output? I've set it to "always enabled" which may help.
Do you have a long movie title that is scrolling? Scrolling text seems to send the CPU load through the roof.
Here's the debug output for the relevant time period. Nothing interesting that I see.
The first set of KEY_LEFT events is navigating back from "System" to "TV".
At 12:19:44 the system is idling with TV highlighted in the Home menu (cpu usage is pegged).
After 15 seconds (at 12:20:00) I navigate to Music (cpu usage drops). [The KEY_RIGHT events]

The only thing in the log is:
12:19:44 T:2960786448   DEBUG: NEWADDON PythonCallbackHandler construction with PyThreadState 0x1eb1368
12:20:00 T:3035631616   DEBUG: Previous line repeats 32 times.

After a few seconds I navigated back to TV [The KEY_LEFT events].
The final set of KEY_RIGHT events is navigating back to the system menu to turn off debugging.

Moved debug output to paste.bin:
Remove that Debug Log and use pastebin.com!
(2013-02-15, 20:10)popcornmix Wrote: [ -> ]What do you have "vertical blank sync" set to in settings/system/video output? I've set it to "always enabled" which may help.

Vertical blank sync is set to "Let Driver Choose" which was the default value. Changing to "Always Enabled" and restarting results in no difference of behavior (I waited until normal updating processing finished before testing).

MilhouseVH Wrote:Do you have a long movie title that is scrolling? Scrolling text seems to send the CPU load through the roof.
Nothing scrolls when I leave the "Movies" or "TV" selected. They only start scrolling if I select the specific TV episode or Movie entry in the recently added listings.
Hmmm... Just checked in my menu and I have low (~30%) CPU for Movies and Music, but high (~90%) CPU for TV Shows.... curious. All other top level menu items (Weather, Pictures, Videos, Programs and System) clock in at about 26% CPU.

Vertical blank sync is set to "Always enabled", but I can't see why any effect it might have would be selective (ie. working for Movies/Music, but not TV Shows).

I'm using the very latest OpenELEC built from git, a 512MB Pi overclocked with force_turbo to 1GHz (so running solidly at 1000MHz), booted over NFS, media library accessed over NFS, meta-data in remote MySQL. Stock Confluence skin.

There is no activity in the debug log which would account for the increased CPU load when the TV Shows menu item is highlighted (four recently added episodes visible, no text scrolling).
I have been trying to figure out this problem for a couple of weeks. I think its the same problem. For me its only on Movies, dont really have TV shows set up. I think it does have something to do with the Recently Added. I even tried deleting the .xbmc dir to remove addons.
(Apologies to the OP for detouring this thread)

I do notice the Pi is constantly sending 12KB/s and receiving 10KB across the wired network even while idle - maybe this is a consequence of booting over NFS, but I'm not sure why there should be so much network activity when the Pi is doing absolutely nothing. Right now it's at the Videos menu, 27% CPU load, screensaver - dim - enabled, and constantly tickling the network.

Edit: Should have done this previously, but I've just run a network trace on the Pi and it does look like it's NFS traffic between the Pi and NFS boot server (which isn't the NFS server hosting the actual media). The Pi is constantly sending out a mass of NFS GETATTR calls, at a rate of about 50 per second... is this excessive?

Edit2: Some detective work on the filehandle that is constantly being hammered with GETATTR calls over NFS - turns out it is Addons15.db... anyone able to suggest why it is so important to hammer on this file 50 times a second? Probably not an ideal situation when using other boot media either, such as SD card. The hammering stops when playing a movie, but resumes as soon as playback is stopped, so at least it's not causing CPU/network overhead when it is needed most.

Edit3: In fact, the hammering also stops whenever choosing any item from the main menu (eg. when clicking on System), and resumes when returning back to the main top level menu. Something Confluence is doing to monitor add-ons? Is it optimal?

Edit4: Ah, wonder if it's this?
I had a theory about the CPU usage being related to trying to render the "recently added" thumbnails and there being some issue with generating thumbnails that never got shown because they were scrolled off screen.

So I cycled through all the TV episodes and then all the Movies in their respective "recently added" listings.

Interestingly, the high CPU usage is now gone for TV, but remains for Movies.

So now the only time I see high CPU usage is when on the Home menu with Movies selected. Any other time and the usage is low (~10-25%).
I have exactly the same behaviour with all versions i've tested. The high cpu usage will only occur if you have scraped some movies in your database. I've seen the same behaviour with other skins, especially Transparency! unfortunately the high cpu load is always there if using other skins, no matter which option is selected in home screen.
this is by no means a technical explanation, and I have limited knowledge in this area... but I'm fairly certain that just sneezing at the Raspberry Pi will cause high CPU usage. There's not a lot there, so it doesn't take a lot to cause "high" usage.
(2013-02-18, 14:39)Ned Scott Wrote: [ -> ]this is by no means a technical explanation, and I have limited knowledge in this area... but I'm fairly certain that just sneezing at the Raspberry Pi will cause high CPU usage. There's not a lot there, so it doesn't take a lot to cause "high" usage.

All very true Ned, and so hopefully further optimisations can be made that will help, such as eliminating the issue discussed here which is likely to impact low resource devices such as the Pi more than any other (and go largely unnoticed on more powerful x86 systems). I don't know if anyone can look at this particular issue, but the initial replies in that thread were quite disappointing as they seemed to suggest it is quite normal to seek for non-existent files hundreds of times a second... some sanity is needed here.
I've just done a fresh install of Raspbmc Final onto a SD/USB3 stick combo. I'm seeing 70-90% CPU on xbmc.bin pretty much all the time, on any screen. It only dropped to 22% when I started playing an AVI.

I haven't scraped anything yet, just got a couple of folders on my PC added as Sources but not added to the database yet, just in File mode.

On previous builds, I only saw this high CPU on the Settings screen (and tab) when on the right-hand pane and on the Home screen on tabs where the Addon Shortcuts were displayed.

EDIT: It's still doing this actually. If I go to for examples Settings - Appearance and move to the right-hand pane, xbmc.bin gets pegged at around 95%. Moving back to the left column it drops back to 60-75%.

I just tried adding Youtube as an Addon shortcut and with the Videos tab selected on the Home screen so that Youtube icon is visible, the CPU stays around 60-80% so I think that might be better as I'm sure it was at 95% before like in Settings, although I had more addon shortcuts before so it might go up once I add some more.
The high cpu in Movies / TV Shows / Music in home screen is caused by the recently added in Confluence (haven't tested any other skin).
Disable recently added in skin setting and the high cpu usage is gone... seems like when recently added is enabled (and visible in home screen) something is constantly being updated causing the high cpu usage.
Pages: 1 2 3 4