[SOLVED] Too high Idle CPU @ARM devices. What changed since Jarvis? How to reduce it?

Hello,

I noticed, that (most propably because Kodi changes in time) idle CPU usage of vanilla CE is around 14-20% (Odroid C2). When I tested release with Jarvis 16.1, idle CPU usage is around 2-6% (and was that also on weaker Raspberry Pi2). This is a bit important for me, as I am using 24/7 installations.

I am suspecting that this is because some changes in rendering system inside Kodi (?), because I remember, for 18y old PC, I limited GUI fps by limitframes variable@Application.cpp CApplication::Render()
Jarvis:

if (limitFrames) {
  singleFrameTime = 30;  //no need to render menu more than 25 fps on old computer
  // Screensaver is on, 1 fps - idle for Raspberry, slow PC etc.
  if (m_bScreenSave==true) {
  singleFrameTime = 1000;  // 1 fps, high wakeup latency but v.low CPU usage
  }

and thats greatly (20% --> 4% on Odroid C2/Rpi2) reduced Idle CPU usage, when ARM box/Old PC was running, but TV shutdowned and not used (=actived [Black] screensaver).

I used this (screensaver part) also for Rpi2 LE some time (years back, maybe it was OE, maybe LE, old version, maybe 4/5/6), but then propably some LE patch/hack (?) did similiar work, and I remember Ive got 2-5% idle CPU even without my modification on LE 7. And I dont use any overclocking, dirty region hacks, etc., I am using standard values and standard installation.

Leia (CoreElec 9):
Now, I am trying to get similiar results with Leia releases, but I am not sucessfull yet. I think, the previous patch/hack is gone, and Kodi again renders all the time all the FPS, and therefore put unecessary CPU Idle load to the 24/7 ARMs .

I tried to address this on the Kodi side, not much solution there. With suspiction, that some guys already sucesfully fought with this before (and then benefit was lost when Kodi code changed), I am trying get some opinions here also.

The code for CApplication::Render() changed since Jarvis, and unfortunatelly I wasnt able to stop/limit Rendering, through similiar modification on the Leia:

void CApplication::Render()
{
// do not render if we are stopped, in background, or screensaver active
if (m_bStop || (m_screensaverActive))
return;

I didnt see any change and video out was always rendering. Limitframes variable is gone, so for now I dont know, how to kick at least frame limitation, during screensaver.

Is there any chance, that this could be solveable similiary as on Jarvis release? I dont get much Kodi support on their forum yet. I believe, that even with Leia it should be possible be somewhere near 4% Idle. When I stopped Kodi service, CPU usage drops kinda that way, and I am pretty sure that Kodi itself when doing nothing doesnt take that amount (20%) of CPU, so it should be most propably rendering. And the same observation I had on Jarvis…

Differences between LE 7.0.3 and CE 9, with black screensaver on inactivity, without any of my modifications.

CPU_Snap_Kodi_18

Maybe Smart Redraw

1 Like

The difference in power usage will be tiny, having your power block plugged in constantly will be a far bigger waster of electricity. The difference between idle and full tilt is about 3W with a peak usage of just 7watts. Not worth losing any sleep over - about €4.00 per year.

Shoog

1 Like

Its hard to compare between different processors like that, its only 20% of one core and that core maybe being throttled back so you maybe comparing 20% of 600Mhz with 6% of 1200M. If you look at the idle levels its 97.7% on the RPI to 94% on the Odroid so there isn’t much diference in CPU usage.

1 Like

Thank you! Thats seems at least promising, that someone takes care about wasted cycles also… I did first tests: Noticed some GUI/Confluence hickups (like white arrows of status bar, when choosing Video/Audio submenu) but nothing serious. CPU usage drops, not to 1-5%, but at least its around 5-15%, which is at least improvement to the 16-24% with default values.

Understand. It could be (I didnt measure consuption on 1-5% (kodi.service shutdowned) vs ~18% CPU). But having some experience with previous version, I would just like to know what is “worse”/“broken”, to get best possible results… Apart from lowered consuption, others could benefit also in a way, if they are running something more (www server etc.) on Amlogic together with Kodi…

I dont think its platform HW specifics. I am almost sure its either Kodi problem, or missing platform optimalization which there were before. I remember when I test some LE 7.0.3 based images for C2 (from wrxtasy and others, like LibreELEC-Odroid_C2.aarch64-7.1.3.media_build.img, LibreELEC-Odroid_C2.aarch64-7.1.3.img), Ive got very similiar CPU 1-5% as with Rpi+7.0.3, when running it.

My Rpi2s have: arm_freq=900 and I remember, that on idle it runs on 600MHz. Although running cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq gives 900000 currently.

My C2: setenv max_freq is "1536". Governor ondemand. Idle cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq 500000
So it should be 500MHz vs 600(900)MHz.

Load average is 0.06 (Kodi 16.1) vs 2.2 (Kodi 18), there must be something which eats it within Kodi…

Try hitting shift-i while running top.

1 Like

oh! Now I feel stupid :slight_smile: Thank you. top results drops to
4-6% with default config
1.5-3.5% with smartredraw true

load average values remains same (I dont expect they change immediatelly), but Irix mode is something needs to be studied by me. Could it be that I just compared different modes (when 7.x versions comes without it, and 9.x with)? :thinking:

EDIT: cdu13a is spot on. Busybox’s top from 7.0.3 run in “Solaris mode”, procps-ng from 9.x runs in Irix mode. Not sure yet, why average load doesnt fits, but it seems I was wrong and CPU usage is relativelly same. With smartredraw even better maybe.