-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphicsTest.sh
executable file
·158 lines (125 loc) · 3.24 KB
/
graphicsTest.sh
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash
# by: Gašper Sedej
# GPL-v3 lincence
# ver 0.4, 2012-07-31
if [ $# -ne 1 ] ; then
echo "Use folder as argument (e.g.: ./graphicsTest.sh gf-550)"
exit
fi
sleepTime="1"
useGlmark2="n"
useGlmark2es="n"
rootFolder="/tmp/graphicsTest/$1"
saveFolder="`pwd`/$1"
#echo "Path: `pwd`/$1"
echo "Working path: $rootFolder"
# check if folder exists
if [ -d $rootFolder ]; then
read -p "Folder already exists. Continue (y/n)?"
if [ "$REPLY" != "y" ]; then
"Exiting..."
fi
fi
mkdir -p "$rootFolder"
echo -e "\n"
echo "----------"
echo "GPU:"
echo "----------"
#lspci | grep VGA
lspci -nn > "$rootFolder"/"lspci.out"
lspci | grep VGA | cut -f5- -d ' '
#info about all graphics cards
for I in `lspci |awk '/VGA/{print $1}'`;do lspci -v -s $I;done > "$rootFolder"/"lspci-gpu.out"
echo "GPU memory:"
for I in `lspci |awk '/VGA/{print $1}'`;do lspci -v -s $I | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p';done
sleep $sleepTime
echo -e "\n"
echo "----------"
echo "modinfo:"
echo "----------"
modFile="$rootFolder"/"modinfo.out"
for I in `lspci |awk '/VGA/{print $1}'`;do lspci -v -s $I | grep -i "kernel driver" | awk '{print $NF}';done > /tmp/activeMod
activeMod=`cat /tmp/activeMod`
echo "Active kernel object: $activeMod"
# nvidia has different mod name, at least on ubuntu
if [ $activeMod == nvidia ] ; then
# ne morem ugotoviti kateri obstaja. skrijem error
modinfo "nvidia_current" "nvidia_current_updates" 2>&1 | grep -v "ERROR: modinfo:" | > $modFile
# nvidia-smi
else
modinfo $activeMod > $modFile
fi
echo "Modinfo:"
cat $modFile | grep file
sleep $sleepTime
echo -e "\n"
echo "----------"
echo "OpenGL information:"
echo "----------"
glxin=`which glxinfo`
if [ -n $glxin ]; then
glxfile="$rootFolder"/"glxinfo.out"
glxinfo > $glxfile
#echo "Direct rendering:"
cat $glxfile | grep "direct rendering"
# `cat $glxfile | grep "direct rendering"| awk '{print $3}'`
cat $glxfile | grep -i "opengl"
sleep $sleepTime
else
echo "glxinfo not installed"
fi
sleep $sleepTime
echo -e "\n"
echo "----------"
echo "Graphical benchmarks:"
echo "----------"
if [ $useGlmark2 == "y" ]; then
echo "Benchmarking glmark2"
# najprej preveri ce obstaja program
glm2=`which glmark2`
if [ -n $glm2 ]; then
gl2file="$rootFolder"/"glmark2.out"
echo "glmark2 (opengl2)"
sleep $sleepTime
glmark2 > "$gl2file"
cat "$gl2file" | grep "Score"
else
echo "glmark2 not found"
fi
else
echo "Skipping glmark2..."
fi
if [ $useGlmark2es == "y" ]; then
echo "Benchmarking glmark2-es"
if [ -n $glm2 ]; then
gl2esfile="$rootFolder"/"glmark2-es2.out"
echo "glmark2-es2 (OpenGL ES2.0)"
sleep $sleepTime
glmark2-es2 > "$gl2esfile"
cat "$gl2esfile" | grep "Score"
else
echo "glmark2-es not found"
fi
else
echo "Skipping glmark2-es..."
fi
sleep $sleepTime
echo -e "\n"
echo "----------"
echo "Saving logs..."
echo "----------"
dmesg > "$rootFolder"/"dmesg.out"
cat "/var/log/syslog" > "$rootFolder"/"syslog.out"
cat "/var/log/Xorg.0.log" > "$rootFolder"/"Xorg.0.log.out"
echo "Test ended!"
read -p "Save results to $saveFolder/? (y/n)"
if [ "$REPLY" == "y" ]; then
if [ -d $saveFolder ]; then
read -p "Directory exists. Overwrite? (y/n)"
if [ "$REPLY" != "y" ]; then
echo "Exiting without saving"
exit
fi
fi
echo "saving results... "
fi