amanusk / s-tui

Terminal-based CPU stress and monitoring utility

Home Page:https://amanusk.github.io/s-tui/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

S-tui shows unit as Mhz, even tho the value is in GHz

neilschark opened this issue · comments

Step 1: Describe your environment

  • System (Intel/AMD/Raspberry Pi etc): AMD R9 3900X
  • OS version: Arch Linux
  • s-tui version: 1.1.3 / master
  • Installation method(pip/PPA/source code): pacman, source code

Step 2: Describe the problem:

Observed Results:

s-tui shows the CPU frequency as GHz, although is shows the data in Ghz.

image

Debug Results, output of s-tui -d created in a file _s-tui.log:

* Replace this with debug output *

Step 3: Reproduce the problem:

Steps to reproduce:

  1. open s-tui
* Replace this with relevant code to reproduce the problem *

Also, besides the summary showing 'MHz' instead of 'GHz', the graphs for frequency are empty as they are likely interpreting it as MHz instead of GHz.

Than it seems like the intended unit is MHz indeed and it's a problem of the reading of the data.

Also having this issue on s-tui 1.1.3, same rough setup (Manjaro 21.2.2 on a Thinkpad X1 Carbon gen 9)

I also noticed glances isn't showing CPU frequency either. lscpu also isn't showing current MHz. I can see it via cat /proc/cpuinfo.

I'm wondering if something in arch/manjaro changed where reading CPU frequency no longer works as expected

giampaolo/psutil#2069

I actually wonder if this is an issue with psutil? That might track - psutil is giving back values in GHz, but s-tui is reading it as MHz. So we get what appear to be artificially small values.

Hello,
I have the same issue on my Ryzen 5 PRO on Ubuntu Linux with kernel 5.13.
I did some quick code inspection, and I removed the 1000 divider in the psutils package in the _pslinux.py file.
But looks like this is a bug in the psutil library, and not an s-tui issue, or?

Hi,

Same issue with s-tui version 1.1.3 on unraid running Kernel 5.15.27.
My CPU is a Ryzen 5800X.

I just installed s-tui today on my i5-4690K. Did not have the frequency graphs. Made the change hook77 made to _pslinux.py and the psutils.cpu_freq() function and s-tui now display in Mhz and everything looks golden.

@hook77 @ohagandavid Could you be more detailed about your solution? Where is that file located?

Was ~/.local/lib/python3.9/site-packages/psutil/_pslinux.py for me. At line 762 in the cpu_freq() function I've commented out curr = int(curr) / 1000.

This should get fixed when psutil 5.9.1 is released:
giampaolo/psutil@83d7067

psutilVersion=`pip show psutil | grep 'Version' | awk -F ': ' '{print $2}'` \
&& psutilLocation=`pip show psutil | grep 'Location' | awk -F ': ' '{print $2}'`/psutil \
&& [ $psutilVersion == 5.9.0 ] \
&& sudo sed -i "/curr = cpuinfo_freqs\[i\]$/ s/$/ * 1000/" $psutilLocation/_pslinux.py

or
If you know the directory where psutil is stored.

sudo sed -i "/curr = cpuinfo_freqs\[i\]$/ s/$/ * 1000/" /usr/lib/python3.10/site-packages/psutil/_pslinux.py

This problem has been solved in psutil v5.9.1 (5.9.0 still has this problem)

So I suggest that we set the required psutil to be >=5.9.1?

Yep, definitely we should.
My worry is mainly the way debian/ubuntu is packaged, and that this will not go away until psutil is updated there, but should be updated regardless.

The solution from wc7086 worked for me, but some limitations as I am using zsh:

~ psutilVersion=`pip show psutil | grep 'Version' | awk -F ': ' '{print $2}'` && echo $psutilVersion
5.9.0
~ pip show psutil | grep 'Location' | awk -F ': ' '{print $2}'        
/usr/lib/python3/dist-packages
~ psutilVersion=`pip show psutil | grep 'Version' | awk -F ': ' '{print $2}'` \
&& psutilLocation=`pip show psutil | grep 'Location' | awk -F ': ' '{print $2}'`/psutil \
&& [ $psutilVersion == 5.9.0 ] \
&& sudo sed -i "/curr = cpuinfo_freqs\[i\]$/ s/$/ * 1000/" $psutilLocation/_pslinux.py
zsh: = not found
~ sudo sed -i "/curr = cpuinfo_freqs\[i\]$/ s/$/ * 1000/" $psutilLocation/_pslinux.py

After applying this patch, the frequency graph is rendered as usual.

My set-up is the following:

~ lsb_release -d | awk -F ':' '{ print $2}' \
&& python --version \
&& echo "psutil: $(pip show psutil | grep "Version" | awk '{print $2}')" \
&& s-tui --version
	Ubuntu 22.04 LTS
Python 3.10.4
psutil: 5.9.0
s-tui 1.1.3 - (C) 2017-2020 Alex Manuskin, Gil Tsuker
    Released under GNU GPLv2