Moode Forum
Bring back the CPU + Temp real time meter - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Feature requests (https://moodeaudio.org/forum/forumdisplay.php?fid=8)
+--- Thread: Bring back the CPU + Temp real time meter (/showthread.php?tid=50)



Bring back the CPU + Temp real time meter - RafaPolit - 04-11-2018

I found really useful the real time CPU meter in the Audio Info pane.  Specially when playing / decoding DSD files... but also now that there are people suggesting underclocking to improve sound.

When doing such tests, it's useful to see possible CPU hogging operations, and temp could be interesting for people placing the Pi inside enclosures, etc.

The current system info is not real time updating.  It just shows a fixed value.

Am I missing where this is now located? If no-where, could this feature be brought back? Thanks.

Best regards,
Rafa.


RE: Bring back the CPU + Temp real time meter - Tim Curtis - 04-11-2018

Hi Rafa,

I don't disagree that when making system modifications and tweaks that things like CPU freq, ram, disk, temp etc can be helpful indicators but just not as regular parts of the UI. When CPU and temp were on audio info screen they were still just snapshots same as on System info.

If you want to try a quick and dirty util then just paste the code below into a file named /home/pi/systat.php. Use Ctrl-c to quit the util. It updates every two seconds as a result of taking two 1 second snapshots of cpu utilization via top.

-Tim

Code:
#!/usr/bin/php
<?php

while(true) {
    $cpuload = exec("top -bn 2 -d 1.0 | grep 'Cpu(s)' | tail -n 1 | awk '{print $2 + $4 + $6}'");
    $cpuload = number_format($cpuload,0,'.','');
    $cputemp = substr(shell_exec('cat /sys/class/thermal/thermal_zone0/temp'), 0, 2);
    $cpufreq = (float)shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq');
    
    if ($cpufreq < 1000000) {
            $cpufreq = number_format($cpufreq / 1000, 0, '.', '');
            $cpufreq .= ' MHz';
    }
    else {
            $cpufreq = number_format($cpufreq / 1000000, 1, '.', '');
            $cpufreq .= ' GHz';
    }
    
    $result = trim(exec('grep -c ^processor /proc/cpuinfo'));
    $cores = $result > 1 ? $result . ' cores' : $result . ' core';
    $sysarch = trim(shell_exec('uname -m'));
    
    echo $cpufreq . ' | ' . $cpuload . '%' . ' | ' . $cputemp . "\xB0" . ' | ' . $cores . ' | ' . $sysarch . "\r";
}



RE: Bring back the CPU + Temp real time meter - RafaPolit - 04-13-2018

Thanks for the feedback. Yeah, while in 'heavy programming mode', yeah, that's what I do... $ top even! Smile I guess you are right, it was just a commodity when testing DSD, but you are right in pointing out there are other ways for those scenarios.

Thanks.