Is anyone familiar with radeontop? [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Is anyone familiar with radeontop? [SOLVED]

Post by Logansfury »

Hello,

I have radeontop working on my system and giving a nice amount of GPU information. Is there any way Conky can read from radeontop while its running in a terminal? If not, can radeontop's data be sent to a text document that Conky can read and display data from in widgets?

Thank you for reading,

Logan
Last edited by Logansfury on Sun Mar 17, 2024 9:48 am, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop?

Post by Koentje »

Have you tried radeontop --help ?

radeontop -l1 -d ./radeontop.dump dumps one cycle into a file.

And this is how the dump looks like

Code: Select all

1710595668.672722: bus 03, gpu 27.50%, ee 0.00%, vgt 23.33%, ta 0.00%, tc 0.00%, sx 25.00%, sh 23.33%, spi 26.67%, smx 22.50%, cr 0.00%, sc 25.83%, pa 1.67%, db 23.33%, cb 25.00%, vram 58.16% 2300.98mb, gtt 3.48% 141.19mb, mclk 62.75% 0.705ghz, sclk 17.58% 0.523ghz
Now you have to figure out what all means and how to separate..

My advice, don't use radeontop because it is slow!!
Image
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop?

Post by Koentje »

Code: Select all

#!/bin/bash

rm -f ./radeontop.dump
radeontop -l1 -d ./radeontop.dump
wait
sed -i 's/, /\n/g' ./radeontop.dump
Saves per line..
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop?

Post by Logansfury »

Hello Koentje,

I am just playing with conky and seeing what other kinds of info I can gather from my system that could become a minimalis widget. The radeontop is giving me 4 interesting fields about my graphic card:

virtual RAM use
graphic translation tasks memory used
memory clock
shader clock.

I put together a conky that launched your bash script to create a dump and then read and display info from the dump. Here is where I am at so far.

I will be moving files off desktop and into the conky subdirs once I get everything working.

Code: Select all

conky.text = [[

${execi 5 /home/logansfury/Desktop/radeontop.sh}

${color}${execpi 5 cat /home/logansfury/Desktop/radeontop.dump}

${color1}Memory Clock: ${color2}${execpi 5 sed -n '15p' /home/logansfury/Desktop/radeontop.dump}

${color1}Memory Clock: ${color2}${execpi 5 awk '/mclk/ { for(i=1; i<=NF; i++) { if($i == "mclk") { printf "%s ", $(i+1); for(j=i+2; j<=NF; j++) { if($j ~ /^[0-9.]+ghz$/) { printf "%s\n", $j; exit; } } } } }' /home/logansfury/Desktop/radeontop.dump}

${color1}Shader Clock: ${color2}${execpi 5 awk '/sclk/ { for(i=1; i<=NF; i++) { if($i == "sclk") { printf "%s ", $(i+1); for(j=i+2; j<=NF; j++) { if($j ~ /^[0-9.]+ghz$/) { printf "%s\n", $j; exit; } } } } }' /home/logansfury/Desktop/radeontop.dump}

]]
This is giving me this:

Image

so far, so good, except that when the bash script gets run, it is printing out confirmation of the dump visibly in the conky. How would I best eliminate that?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop?

Post by Koentje »

Code: Select all

#!/bin/bash

rm -f ./radeontop.dump
radeontop -l1 -d ./radeontop.dump > /dev/null
wait
sed -i 's/, /\n/g' ./radeontop.dump

mclk=$(cat ./radeontop.dump | grep 'mclk' | awk '{print $2" "$3}')
sclk=$(cat ./radeontop.dump | grep 'sclk' | awk '{print $2" "$3}')
vram=$(cat ./radeontop.dump | grep 'vram' | awk '{print $2" "$3}')
gtt=$(cat ./radeontop.dump | grep 'gtt' | awk '{print $2" "$3}')

echo "\${color red}Memory Clock: \${color white}$mclk"
echo "\${color red}Shader Clock: \${color white}$sclk"
echo "\${color red}Virtual RAM : \${color white}$vram"
echo "\${color red}GTT         : \${color white}$gtt"
Now you can remove all these crypto lines from your conky and only use this one:
${execpi 5 /home/logansfury/Desktop/radeontop.sh}
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop?

Post by Logansfury »

Koentje wrote: Sun Mar 17, 2024 6:48 am

Code: Select all

#!/bin/bash

rm -f ./radeontop.dump
radeontop -l1 -d ./radeontop.dump > /dev/null
wait
sed -i 's/, /\n/g' ./radeontop.dump

mclk=$(cat ./radeontop.dump | grep 'mclk' | awk '{print $2" "$3}')
sclk=$(cat ./radeontop.dump | grep 'sclk' | awk '{print $2" "$3}')
vram=$(cat ./radeontop.dump | grep 'vram' | awk '{print $2" "$3}')
gtt=$(cat ./radeontop.dump | grep 'gtt' | awk '{print $2" "$3}')

echo "\${color red}Memory Clock: \${color white}$mclk"
echo "\${color red}Shader Clock: \${color white}$sclk"
echo "\${color red}Virtual RAM : \${color white}$vram"
echo "\${color red}GTT         : \${color white}$gtt"
Now you can remove all these crypto lines from your conky and only use this one:
${execpi 5 /home/logansfury/Desktop/radeontop.sh}
Far Out!!

This is working just fine and refreshing the data steadily like a champ!

Thank you very much! I'm off to google images to look for a suitable GPU icon.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop?

Post by Logansfury »

Hey Koentje, are you still around?

I have been using your provided scripts as a template to expand upon and I have figured out the syntax by studying your code.

I am going up the column of radeontop info, and have added color block, depth block, and primitive assembly successfully. Then I went for Scan Converter and I ran into an issue. It is printing the sclk info below it's own. I think its because it's code abbreviation of sc is part of sclk?

Here is what it looks like:

Image

Here is the code:

Code: Select all

#!/bin/bash

rm -f ./radeontop.dump
radeontop -l1 -d ./radeontop.dump > /dev/null
wait
sed -i 's/, /\n/g' ./radeontop.dump

sc=$(cat ./radeontop.dump | grep 'sc' | awk '{print $2}')
pa=$(cat ./radeontop.dump | grep 'pa' | awk '{print $2}')
db=$(cat ./radeontop.dump | grep 'db' | awk '{print $2}')
cb=$(cat ./radeontop.dump | grep 'cb' | awk '{print $2}')
vram=$(cat ./radeontop.dump | grep 'vram' | awk '{print $2" "$3}')
gtt=$(cat ./radeontop.dump | grep 'gtt' | awk '{print $2" "$3}')
mclk=$(cat ./radeontop.dump | grep 'mclk' | awk '{print $2" "$3}')
sclk=$(cat ./radeontop.dump | grep 'sclk' | awk '{print $2" "$3}')

echo "\${color red}Scan Converter: \${color white}\${alignr}$sc"
echo "\${color red}Primitive Assembly: \${color white}\${alignr}$pa"
echo "\${color red}Depth Block: \${color white}\${alignr}$db"
echo "\${color red}Color Block: \${color white}\${alignr}$cb"
echo "\${color red}Virtual RAM: \${color white}\${alignr}$vram"
echo "\${color red}GTT: \${color white}\${alignr}$gtt"
echo "\${color red}Memory Clock: \${color white}\${alignr}$mclk"
echo "\${color red}Shader Clock: \${color white}\${alignr}$sclk"
Is there a way to make the sc and sclk info display separately and not duplicate data on the scan converter line?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop?

Post by Logansfury »

I have completed adding all the info to the conky, but I have one misprint.

For some reason, the Scan Converter (sc) is showing the data for Shader Clock (sclk) on a separate line. This is the only issue keeping this widget from being complete!

Suggestions please? :D

Image

Code: Select all

#!/bin/bash

rm -f ./radeontop.dump
radeontop -l1 -d ./radeontop.dump > /dev/null
wait
sed -i 's/, /\n/g' ./radeontop.dump

gpu=$(cat ./radeontop.dump | grep 'gpu' | awk '{print $2}')
vgt=$(cat ./radeontop.dump | grep 'vgt' | awk '{print $2}')
ta=$(cat ./radeontop.dump | grep 'ta' | awk '{print $2}')
sx=$(cat ./radeontop.dump | grep 'sx' | awk '{print $2}')
sh=$(cat ./radeontop.dump | grep 'sh' | awk '{print $2}')
spi=$(cat ./radeontop.dump | grep 'spi' | awk '{print $2}')
sc=$(cat ./radeontop.dump | grep 'sc' | awk '{print $2}')
pa=$(cat ./radeontop.dump | grep 'pa' | awk '{print $2}')
db=$(cat ./radeontop.dump | grep 'db' | awk '{print $2}')
cb=$(cat ./radeontop.dump | grep 'cb' | awk '{print $2}')
vram=$(cat ./radeontop.dump | grep 'vram' | awk '{print $2" "$3}')
gtt=$(cat ./radeontop.dump | grep 'gtt' | awk '{print $2" "$3}')
mclk=$(cat ./radeontop.dump | grep 'mclk' | awk '{print $2" "$3}')
sclk=$(cat ./radeontop.dump | grep 'sclk' | awk '{print $2" "$3}')

echo "\${color red}Graphics Pipe: \${color white}\${alignr}$gpu"
echo "\${color red}Vertex Grouper + Tesselator: \${color white}\${alignr}$vgt"
echo "\${color red}Texture Addresser: \${color white}\${alignr}$ta"
echo "\${color red}Shader Export: \${color white}\${alignr}$sx"
echo "\${color red}Shader Interpolator: \${color white}\${alignr}$spi"
echo "\${color red}Scan Converter: \${color white}\${alignr}$sc"
echo "\${color red}Primitive Assembly: \${color white}\${alignr}$pa"
echo "\${color red}Depth Block: \${color white}\${alignr}$db"
echo "\${color red}Color Block: \${color white}\${alignr}$cb"
echo "\${color red}Virtual RAM: \${color white}\${alignr}$vram"
echo "\${color red}GTT: \${color white}\${alignr}$gtt"
echo "\${color red}Memory Clock: \${color white}\${alignr}$mclk"
echo "\${color red}Shader Clock: \${color white}\${alignr}$sclk"
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop?

Post by Logansfury »

I got it.

The issue was indeed that "sc" was seen as part of "sclk" so a grep -w was needed:

Code: Select all

sc=$(grep -w 'sc' ./radeontop.dump | awk '{print $2}')
The display is now perfect :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Koentje »

See, you can do it! ;)
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Logansfury »

Koentje wrote: Sun Mar 17, 2024 11:15 am See, you can do it! ;)
Yes but history may never know how many aneurysms I had getting it correct.

I am now moving on to memory! I have discovered the dmidecode command, and am having an issue with permissions. It needs sudo prefix to work in a terminal:

Code: Select all

logansfury@OptiPlex-5040:~$ sudo dmidecode --type 16 | awk '/Maximum Capacity/ {print $3, $4}'
32 GB
I tried it in Conky but no display, Im sure because of permissions:

Code: Select all

${color1}${goto 35}Maximum Capacity: ${color0}${alignr}${exec dmidecode --type 16 | awk '/Maximum Capacity/ {print $3, $4}'}
Is there a way to get conky to perform sudo commands with exec? If not, is there a bash workaround?

Thanks man :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Logansfury »

Logansfury wrote: Sun Mar 17, 2024 11:36 am Is there a way to get conky to perform sudo commands with exec? If not, is there a bash workaround?
I may be on the right track to figuring this out myself, stand by.....
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Logansfury »

Nope, I am stuck.

I have the following .conf:

Code: Select all

conky.text = [[
${color1}${font ConkySymbols:size=16}J${font} ${voffset -10}${goto 35}Memory» ${hr}
${exec /home/logansfury/Desktop/mem.sh}

]];
Here is mem.sh:

Code: Select all

#!/bin/bash

sudo dmidecode --type 16 | awk '/Maximum Capacity/ {print $3, $4}' > mem.txt

# Read content of mem.txt
content=$(<mem.txt)

# Print the content using echo
echo "\${color red}Graphics Pipe: \${color white}\${alignr}$content"
but my output is horrible:

Image

Why are the color and align commands not working in this .sh but working in the GPU .sh?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Koentje »

If you want the output of a bash script show in the conky window with all the colors and alignments you have to use exec with P.

So ${execp command}
Image
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Koentje »

Just curious.. why don't you use ${memmax} ??
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Logansfury »

Koentje wrote: Sun Mar 17, 2024 1:03 pm Just curious.. why don't you use ${memmax} ??
I've never met the man in my life.

I have got a bash script that is printing memory info to a text document:

mem.sh

Code: Select all

#!/bin/bash

# Run sudo dmidecode commands and redirect output to mem.txt
sudo dmidecode --type memory | grep "Number Of Devices" | sed 's/^[ \t]*//' >> mem.txt
sudo dmidecode --type memory | awk '/Memory Device/{flag=1; next} flag && $1=="Size:"{print "Size:", $2; exit}' >> mem.txt
sudo dmidecode --type memory | grep "Maximum Capacity" | sed 's/^[ \t]*//' >> mem.txt
sudo dmidecode --type memory | awk '/Memory Device/{flag=1; next} flag && $1=="Type:"{print "Type:", $2; exit}' >> mem.txt
sudo dmidecode --type memory | awk '/Memory Device/{flag=1; next} flag && $1=="Speed:"{print "Speed:", $2" "$3; exit}' >> mem.txt
sudo dmidecode --type memory | grep -m1 "Configured Voltage" | sed 's/^[[:blank:]]*//' >> mem.txt
here is the memory.conf

Code: Select all

conky.text = [[
${color1}${font ConkySymbols:size=16}J${font} ${voffset -10}${goto 35}Memory» ${hr}
${execi 3600 /home/logansfury/Desktop/mem.sh}
${voffset -14}${goto 35}${execpi 3600 awk 'NR==1 {printf "${color1}Number of Devices: ${color0} %s\n", $4}' /home/logansfury/Desktop/mem.txt} ${alignr}${execpi 3600 awk 'FNR==4 {printf "${color1}Memory Type: ${color0}%s\n", $2; exit}' /home/logansfury/Desktop/mem.txt}
${goto 35}${execpi 3600 awk 'FNR==2 {printf "${color1}Max Size per Device: ${color0}%s GB\n", $2}' /home/logansfury/Desktop/mem.txt} ${alignr}${execpi 3600 awk 'FNR==5 {printf "${color1}Speed: ${color2}%s %s${color}\n", $2, $3; exit}' /home/logansfury/Desktop/mem.txt}
${goto 35}${execpi 3600 awk 'FNR==3 {printf "${color1}Maximum Capacity: ${color0}%s GB\n", $3 GB}' /home/logansfury/Desktop/mem.txt} ${alignr}${execpi 3600 awk 'FNR==6 {printf "${color1}Configured Voltage: ${color0}%s\n", $3" "$4}' /home/logansfury/Desktop/mem.txt}
${color1}${goto 35}RAM : ${color0}${mem}/${memmax} ${alignr}${memperc}% ${membar 6,100}
${color1}${goto 35}SWAP: ${color0}${swap}/${swapmax} ${alignr}${swapperc}% ${swapbar 6,100}
]];
It's coming along! My Minimalis is now more of a Maximallis. Working on the second column of data now :)

Thank you so much for the help Koentje!
Image
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Logansfury »

I think my used/total RAM display uses ${memmax}. It's still the default code that came with Minimalis.

I just added Form Factor and Type Detail to my memory section.

It's been very fun working with the terminal and checking and getting edits from resources to uncover the paths to all this detailed GPU and Memory information.

I believe I learned a lot going line by line editing each until it displayed as desired.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Koentje »

Maximum Capacity is not the max ram that is in the system, but it seems the max ram the board can handle.
I have 32gb in my system, but Max Capacity says 64gb.

And in your bash script i would not start dmidecode everytime. This uses more cpu resource then is necessary. Start it once and output it in a temporary textfile, then cat the textfile and grep the lines out of it.

Code: Select all

sudo dmidecode --type memory > ./mem.tmp

cat ./mem.tmp | grep "Number Of Devices" | sed 's/^[ \t]*//' > mem.txt
cat ./mem.tmp | awk '/Memory Device/{flag=1; next} flag && $1=="Size:"{print "Size:", $2; exit}' >> mem.txt
cat ./mem.tmp | grep "Maximum Capacity" | sed 's/^[ \t]*//' >> mem.txt
cat ./mem.tmp | awk '/Memory Device/{flag=1; next} flag && $1=="Type:"{print "Type:", $2; exit}' >> mem.txt
cat ./mem.tmp | awk '/Memory Device/{flag=1; next} flag && $1=="Speed:"{print "Speed:", $2" "$3; exit}' >> mem.txt
cat ./mem.tmp | grep -m1 "Configured Voltage" | sed 's/^[[:blank:]]*//' >> mem.txt
Image
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Koentje »

The same for your gpu info... using radeontop uses too much cpu resources and it is slow! It takes more then a seconds to get the info from it, and you run it every 5 seconds. As i said before, i would not recommend using it!
All the info you want from radeontop you can also find in text files within sysfs!

Go to /sys/class/drm/card0/device (or card1 if you have more) and see there, all the info you want!

This is my own script to gather info from my amd gpu.

Code: Select all

#!/bin/bash
###########################################################
#                                                         #
#   Get GPU info, used by conky                           #
#   Depends on lspci, xrandr                              #
#                                                         #
#   Created by Koentje!   (lowrida007@gmail.com)          #
#                                                         #
#                                           version 1.0   #
###########################################################
#
# The file that gets all the goodies!
infofile="/home/admin/.conky/MyPanels/tempfiles/gpuinfo.tmp"


gpuname () {
 cardline=$(lspci -vnnn | grep "VGA controller")                                                        # Get complete line of defailt VGA controller
  cardmodel=$(echo $cardline | awk '{printf $13 " " $14 " " $17 " " $18}') # '                           # Get model of card, needs change for other cards
   cardmodel="${cardmodel:1:-1}"                                                                          # Substract the "[" and "]" characters
  cardvendor="$(echo $cardline | awk '{printf $10}')"                                                    # Get manufacturer of card, needs change for other cards

}


cardnr () {
 x=0; y=0
until [ "$y" = "1" ]                                                                                    # As long as y=0 then card is not found
do

 if [ -d "/sys/class/drm/card$x" ]; then                                                                # Check if cardnr X exist
   if [ -f "/sys/class/drm/card$x/device/uevent" ]; then                                                # If exist then check if uevent exist
     driver=$(cat /sys/class/drm/card$x/device/uevent | head -n1 | awk -F"=" '{print $2}')              # If exist, get drivername
     if [ "$driver" = "amdgpu" ]; then                                                                  # If driver is ampgpu, do things!
       y=1                                                                                              # Increase y by 1, card is found!

       dpmstate=$(cat /sys/class/drm/card$x/device/power_dpm_state)                                        ### Get power dpm state
       dpmlevel=$(cat /sys/class/drm/card$x/device/power_dpm_force_performance_level)                      ### Get dpm performance level
        if [ "$dpmlevel" = "high" ]; then
          dpmlevel="\${font Noto Sans:bold:size=7}\${color FF7044}$dpmlevel\${font Noto Sans:size=7}"      ### If performance level = high then color red
        fi
       linkwidth=$(cat /sys/class/drm/card$x/device/current_link_width)                                    ### Get PCIe link width
       linkspeed=$(cat /sys/class/drm/card$x/device/current_link_speed | awk -F" " '{print $1" "$2}')      ### Get PCIe link speed

       vramtotal=$(cat /sys/class/drm/card$x/device/mem_info_vram_total)                                   ### Get VRAM total
        vramused=$(cat /sys/class/drm/card$x/device/mem_info_vram_used)                                    ### Get VRAM in use
         vramperc=$(printf $(echo "scale=4; $vramused/$vramtotal * 100" | bc) | cut -d . -f 1)             ### Calculate % in use for Lua script
          vramused=$(echo "$vramused / 1024 / 1024" | bc)                                                  ### Human readable (mb)

       sclktotal=$(cat /sys/class/drm/card$x/device/pp_dpm_sclk | tail -n1 | awk -F" " '{print $2}')       ### Get SCLK total
       sclktotal=${sclktotal::-3}                                                                          ### Remove "mhz"
        sclknow=$(cat /sys/class/drm/card$x/device/pp_dpm_sclk | grep "*" | awk -F" " '{print $2}')        ### Get SCLK now
        sclknow=${sclknow::-3}                                                                             ### Remove "mhz"
         sclkperc=$(printf $(echo "scale=4; $sclknow/$sclktotal * 100" | bc) | cut -d . -f 1)              ### Calculate % in use for Lua script

       mclktotal=$(cat /sys/class/drm/card$x/device/pp_dpm_mclk | tail -n1 | awk -F" " '{print $2}')       ### Get MCLK total
       mclktotal=${mclktotal::-3}                                                                          ### Remove "mhz"
        mclknow=$(cat /sys/class/drm/card$x/device/pp_dpm_mclk | grep "*" | awk -F" " '{print $2}')        ### Get MCLK now
        mclknow=${mclknow::-3}                                                                             ### Remove "mhz"
         mclkperc=$(printf $(echo "scale=4; $mclknow/$mclktotal * 100" | bc) | cut -d . -f 1)              ### Calculate % in use for Lua script

       gpuloadperc=$(cat /sys/class/drm/card$x/device/gpu_busy_percent)                                    ### Get gpu load
       hwmon=$(sudo ls /sys/class/drm/card$x/device/hwmon)                                                 ### Get HWMON
       slowppt=$(echo "$(cat /sys/class/hwmon/$hwmon/power1_average) / 1000 / 1000" | bc) # "              ### Get power usage of card (Watts)
       vddgfx=$(cat /sys/class/hwmon/$hwmon/in0_input)                                                     ### Get vddgfx (mVolt)
       vrambusy=$(cat /sys/class/drm/card$x/device/mem_busy_percent)                                       ### Get Vram busy usage in %

     else                                                                                               # If driver is not admgpu
       x=$((x+1))                                                                                       # Increase card number by 1 for next search
     fi
   fi
 fi
done
}


resolution () {
 reso=$(xrandr --current | grep -w "connected primary" | awk -F" " '{print $4}' | awk -F"+" '{print $1}')            ### Get resolution of primary display
}


# Start all routines
  gpuname
  cardnr
  resolution


# Write all goodies to gpuinfo.tmp
  echo "$cardvendor $cardmodel" > "$infofile"    # 1
  echo "$reso" >> "$infofile"                    # 2
  echo "$linkspeed" >> "$infofile"               # 3
  echo "PCIe x$linkwidth" >> "$infofile"         # 4
  echo "$dpmlevel" >> "$infofile"                # 5
  echo "$dpmstate" >> "$infofile"                # 6
  echo "$vramperc" >> "$infofile"                # 7
  echo "$vramused \${color3}mb" >> "$infofile"   # 8
  echo "$sclkperc" >> "$infofile"                # 9
  echo "$sclknow \${color3}mhz" >> "$infofile"   # 10
  echo "$mclkperc" >> "$infofile"                # 11
  echo "$mclknow \${color3}mhz" >> "$infofile"   # 12
  echo "$gpuloadperc" >> "$infofile"             # 13
  echo "$slowppt" >> "$infofile"                 # 14
  echo "$vddgfx" >> "$infofile"                  # 15
  echo "$vrambusy" >> "$infofile"                # 16

unset dpmstate dpmlevel linkwidth linkspeed vramtotal vramused vramperc
unset sclktotal sclknow sclkperc mclktotal mclknow mclkperc
unset gpuloadperc hwmon slowppt vddgfx vrambusy reso x


Time this script needs to gather way more info

Code: Select all

$ time /home/admin/.conky/MyPanels/gpuinfo.sh 

real	0m0,175s
user	0m0,055s
sys	0m0,012s


Time of your radeontop script that only gathers four values

Code: Select all

$ time /home/admin/.conky/MyPanels/test/radeontop/gpuinfo.sh 
${color red}Memory Clock: ${color white}97.67% 1.098ghz
${color red}Shader Clock: ${color white}18.04% 0.537ghz
${color red}Virtual RAM : ${color white}60.65% 2399.52mb
${color red}GTT         : ${color white}3.03% 122.90mb

real	0m1,065s
user	0m0,011s
sys	0m0,035s
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Is anyone familiar with radeontop? [SOLVED]

Post by Logansfury »

Koentje wrote: Sun Mar 17, 2024 5:08 pm The same for your gpu info... using radeontop uses too much cpu resources and it is slow! It takes more then a seconds to get the info from it, and you run it every 5 seconds. As i said before, i would not recommend using it!
All the info you want from radeontop you can also find in text files within sysfs!
I will take a look at this as well and set about recreating it with sysfs info.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”