-
Notifications
You must be signed in to change notification settings - Fork 12
/
ati-info
executable file
·105 lines (88 loc) · 3.13 KB
/
ati-info
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
#
# ati-info - useful ATI/AMD GPU info using fglrx driver
#
# Copyright (C) 2012 Rodrigo Silva (MestreLion) <linux@rodrigosilva.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. See <http://www.gnu.org/licenses/gpl.html>
myname="${0##*/}"
usage() {
cat <<-USAGE
Usage: $myname [options]
USAGE
if [[ "$1" ]] ; then
cat >&2 <<- USAGE
Try '$myname --help' for more information.
USAGE
exit 1
fi
cat <<-USAGE
Displays useful information for ATI/AMD video adapters using fglrx.
Information include current core and memory clocks, GPU load (usage),
temperature and fan speed.
Options:
-h|--help - show this page.
-v|--verbose - print detailed info
Copyright (C) 2013 Rodrigo Silva (MestreLion) <linux@rodrigosilva.com>
License: GPLv3 or later. See <http://www.gnu.org/licenses/gpl.html>
USAGE
exit 0
}
# Option handling
for arg in "$@"; do [[ "$arg" == "-h" || "$arg" == "--help" ]] && usage ; done
while (( $# )); do
case "$1" in
-v|--verbose ) verbose=1 ;;
# --var=* ) var="${1#*=}" ;;
# --var ) shift ; var="$1" ;;
# -- ) shift ; break ;;
# -* ) invalid "$1" ;;
# -* ) opts+=( "$1" ) ;;
# * ) opterr "$1" ;;
esac
shift
done
# if not for formatting, the whole info could be displayed in a single command:
#aticonfig --odgc --odgt --pplib-cmd "get fanspeed 0" --pplib-cmd "get faninfo 0"
gputemp=$(aticonfig --odgt | awk -F ' - ' '/Temperature/{print $2}')
fanspeed=$(aticonfig --pplib-cmd "get fanspeed 0" | awk -F ': |%' '/^Result:/{print $3}')
fanmaxrpm=$(aticonfig --pplib-cmd "get faninfo 0" | awk -F '0 - | RPM' '{print $2}')
fanrpm=$((fanmaxrpm * fanspeed / 100))
odgc=$(aticonfig --odgc)
if [[ "$verbose" ]]; then
echo "$odgc"
echo " Fan speed : ${fanspeed}% (${fanrpm}/${fanmaxrpm} RPM)"
else
awk -F ' - | : ' 'NR==2{print $2} /load/{print}' <<< "$odgc"
echo " Fan speed : ${fanspeed}%, ${fanrpm} RPM"
fi
echo " Temperature : ${gputemp}"
exit
# for the future...
while true; do
temp=${gputemp%%.*} # "convert" to integer
if ((temp <= 40)); then speed=15
elif ((temp <= 45)); then speed=25
elif ((temp <= 50)); then speed=35
elif ((temp <= 55)); then speed=45
elif ((temp <= 60)); then speed=55
elif ((temp <= 65)); then speed=65
elif ((temp <= 70)); then speed=75
elif ((temp <= 75)); then speed=85
else speed=100
fi
echo 'aticonfig --pplib-cmd "set fanspeed 0 $speed"'
break
sleep 60
done