(change version nu)

Added nvidia only gpu temp output for multiple gpus. If > 1 gpu screen is detected, it will output the gpu temp data for each 
discovered screen.

For 1 gpu with nvidia, it will show screen nu if you use the -x option, or with -F

This is an nvidia proprietary driver feature only.
This commit is contained in:
inxi-svn 2009-11-16 19:03:29 +00:00
parent 945ffef2b5
commit f85419e8a8

61
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.2.5
#### Date: October 14 2009
#### version: 1.2.6
#### Date: November 16 2009
########################################################################
#### SPECIAL THANKS
########################################################################
@ -1215,7 +1215,8 @@ show_options()
print_screen_output "-P Show Partition information (shows what -v 4 would show, but without extra data)."
print_screen_output " Shows, if detected: / /boot /home /tmp /usr /var. Use -p to see all mounted partitions."
print_screen_output "-r Show distro repository data. Currently supported repo types: APT; YUM."
print_screen_output "-s Show sensors output (if sensors installed/configured): mobo/cpu temp; detected fan speeds."
print_screen_output "-s Show sensors output (if sensors installed/configured): mobo/cpu/gpu temp; detected fan speeds."
print_screen_output " Gpu temp only for Fglrx/Nvidia drivers. Nvidia shows screen number for > 1 screens."
print_screen_output "-S Show System information: host name, kernel, distro"
print_screen_output "-u Show partition UUIDs. Default: short partition -P. For full -p output, use: -pu (or -plu)."
print_screen_output "-v Script verbosity levels. Verbosity level number is required."
@ -1227,7 +1228,8 @@ show_options()
print_screen_output " 4 - Also show partition size/filled data for (if present):/, /home, /var/, /boot"
print_screen_output " 5 - For multicore systems, also shows: per core clock speeds; audio card; full disk data."
print_screen_output "-x Show extra data: bogomips on Cpu; driver version (if available) for Network/Audio;"
print_screen_output " direct rendering status for Graphics (in X). Only works with verbose or line output."
print_screen_output " direct rendering status for Graphics (in X). Only works with verbose or line output;"
print_screen_output " shows (for single gpu, nvidia driver) screen number gpu is running on."
print_screen_output " Shows hdd temp with disk data if you have hddtemp installed, if you are root OR if you have"
print_screen_output " added to /etc/sudoers (sudo v. 1.7 or newer) (path to hddtemp): <username> ALL = NOPASSWD: /usr/sbin/hddtemp"
print_screen_output ""
@ -2196,26 +2198,43 @@ get_distro_lsb_data()
get_gpu_temp_data()
{
local gpu_temp='' gpu_fan=''
local gpu_temp='' gpu_fan='' screens='' screen_nu='' gpu_temp_looper=''
# we'll try for nvidia/ati, then add if more are shown
if [[ -n $( type -p nvidia-settings ) ]];then
gpu_temp=$( nvidia-settings -q GPUCoreTemp | gawk -F ': ' '
BEGIN {
IGNORECASE=1
gpuTemp=""
gpuTempWorking=""
}
/Attribute (.*)[0-9]+\.$/ {
gsub(/\./, "", $2)
if ( $2 ~ /^[0-9]+$/ ) {
gpuTemp=gpuTemp $2 "C "
}
# first get the number of screens
screens=$( nvidia-settings -q screens | gawk '
/:[0-9]\.[0-9]/ {
screens=screens gensub(/(.*)(:[0-9]\.[0-9])(.*)/, "\\2", "1", $0)
}
END {
print gpuTemp
}'
)
print screens
}
' )
# echo "$screens"
# now we'll get the gpu temp for each screen discovered. The print out function
# will handle removing screen data for single gpu systems
for screen_nu in $screens
do
gpu_temp_looper=$( nvidia-settings -c $screen_nu -q GPUCoreTemp | gawk -F ': ' '
BEGIN {
IGNORECASE=1
gpuTemp=""
gpuTempWorking=""
}
/Attribute (.*)[0-9]+\.$/ {
gsub(/\./, "", $2)
if ( $2 ~ /^[0-9]+$/ ) {
gpuTemp=gpuTemp $2 "C "
}
}
END {
print gpuTemp
}'
)
screen_nu=$( cut -d ':' -f 2 <<< $screen_nu )
gpu_temp="$gpu_temp $screen_nu:$gpu_temp_looper"
done
elif [[ -n $( type -p aticonfig ) ]];then
# gpu_temp=$( aticonfig --adapter=0 --od-gettemperature | gawk -F ': ' '
gpu_temp=$( aticonfig --adapter=all --od-gettemperature | gawk -F ': ' '
@ -4464,6 +4483,10 @@ print_sensors_data()
psu_temp="${C1}psu:${C2} ${a_sensors_working[2]} "
fi
gpu_temp=$( get_gpu_temp_data )
# dump the unneeded screen data for single gpu systems
if [[ $( wc -w <<< $gpu_temp ) -eq 1 && $B_EXTRA_DATA != 'true' ]];then
gpu_temp=$( cut -d ':' -f 2 <<< $gpu_temp )
fi
if [[ -n $gpu_temp ]];then
gpu_temp="${C1}gpu:${C2} ${gpu_temp} "
fi