Skip to content

added condition for ryzen to CPU temperature.#81

Open
basaran wants to merge 1 commit intotmux-plugins:masterfrom
basaran:master
Open

added condition for ryzen to CPU temperature.#81
basaran wants to merge 1 commit intotmux-plugins:masterfrom
basaran:master

Conversation

@basaran
Copy link

@basaran basaran commented Jul 12, 2022

closes #78

Copy link
Collaborator

@casperdcl casperdcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the delay!

Comment on lines +21 to +30
val=$(echo "$val" | sed -e 's/^Tccd/Core /')
if [[ $val =~ Core ]]; then
echo "$val" | awk -v format="$cpu_temp_format$cpu_temp_unit" '/^Core [0-9]+/ {gsub("[^0-9.]", "", $3); sum+=$3; n+=1} END {printf(format, sum/n)}'
elif [[ $val =~ Tctl ]]; then
echo "$val" | sed -n 's/Tctl:\s*+//p' | tr -d " "
elif [[ $val =~ Tdie ]]; then
echo "$val" | sed -n 's/Tdie:\s*+//p' | tr -d " "
else
echo "NA"
fi
Copy link
Collaborator

@casperdcl casperdcl Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this?

Suggested change
val=$(echo "$val" | sed -e 's/^Tccd/Core /')
if [[ $val =~ Core ]]; then
echo "$val" | awk -v format="$cpu_temp_format$cpu_temp_unit" '/^Core [0-9]+/ {gsub("[^0-9.]", "", $3); sum+=$3; n+=1} END {printf(format, sum/n)}'
elif [[ $val =~ Tctl ]]; then
echo "$val" | sed -n 's/Tctl:\s*+//p' | tr -d " "
elif [[ $val =~ Tdie ]]; then
echo "$val" | sed -n 's/Tdie:\s*+//p' | tr -d " "
else
echo "NA"
fi
echo "$val" | sed -r -e 's/^(Tccd|Tctl:|Tdie:)/Core /' | awk -v format="$cpu_temp_format$cpu_temp_unit" '/^Core\s+[0-9]+/ {gsub("[^0-9.]", "", $3); sum+=$3; n+=1} END {printf(format, sum/n)}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not working for my CPU (AMD Ryzen 9 3950X). The original proposal somehow works for me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Can you post the output of sensors?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm a little bit busy lately. Here's my sensors output:

➜ sensors
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:            N/A

k10temp-pci-00c3
Adapter: PCI adapter
Tdie:         +57.8°C  (high = +70.0°C)
Tctl:         +57.8°C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants