Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[131335]: nouveau-pm / run-trace.sh Maximize Restore History

Download this file

run-trace.sh    102 lines (73 with data), 2.7 kB

 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
#!/bin/bash
error() {
echo "ERROR - $1"
exit 1
}
if [ $UID -ne 0 ]; then
error "Running as a non root user"
fi
TRACER=`cat /sys/kernel/debug/tracing/current_tracer`
if test "x$TRACER" != xmmiotrace; then
error "mmiotrace is not the current tracer"
fi
for i in "cat" "grep" "gawk" "sed" "perl" " lspci" "tar" "xz" "gzip"
do
$i --version 1>/dev/null || error "$1 not found"
done
timeout --help 2>/dev/null
if [ $? -ne 1 ]; then
error "timeout not found"
fi
TMPDIR=`mktemp -d nouveau-pm.XXXXXXXXXX` || error "Cannot create temporary directory"
cat /sys/kernel/debug/tracing/trace_pipe > $TMPDIR/dump-downclock &
echo "Running glxgears" > /sys/kernel/debug/tracing/trace_marker
timeout 5s glxgears
echo "Stoping glxgears" > /sys/kernel/debug/tracing/trace_marker
echo "Running the monitor_downclocking"
./monitor_downclocking 2> /sys/kernel/debug/tracing/trace_marker
echo "Dumping done. Stopping tracer"
sleep 1
echo nop > /sys/kernel/debug/tracing/current_tracer
sleep 1
kill -12 %1
echo "Getting additional information"
cd $TMPDIR
if test -e /proc/driver/nvidia/version; then
cat /proc/driver/nvidia/version > ./driver-version
else
echo "unknown" > ./driver-version
fi
# Getting the bus the card is actually connected to
lspci | grep VGA | gawk '{print $1}' > ./CARD_BUS
# And some detailed information of the card itself form lspci
lspci -vvnn -d 10de: -s `cat ./CARD_BUS` > ./lspci
# get device/pci id
lspci -n -d 10de: -s `cat ./CARD_BUS` | gawk '{print $3}' > ./dev_pci_id
sed -nre 's/^10de:(.*)/\1/p' ./dev_pci_id |head -n 1 > ./pci_id
rm ./dev_pci_id
# The PBAR0
NV_BASE_OFFSET=0x`cat ./lspci | grep 'Region 0' | gawk '{print $5}'`
# Now lets get BOOT_0
grep $NV_BASE_OFFSET ./dump-downclock | gawk '{ATTRB=$1; offset=strtonum($5); \
if ((ATTRB == "R") && (offset=='$NV_BASE_OFFSET')) \
print $6;}' | head -n 1 > ./BOOT
# Now to get the card generation/arch
perl -e '$_ = <>; chomp; $v = hex($_); if(($v & 0x0f000000) > 0) {printf("%x\n", ($v >> 20) & 0xff);} elsif(($v & 0xff00fff0) == 0x20004000) {print (($v & 0x00f00000) ? "05\n" : "04\n");} else {print "ff\n";}' ./BOOT > arch
# System info
uname -a > ./uname
nouveau_pm_name=nv`cat ./arch`-`cat ./BOOT`-`cat ./pci_id`-downclock
mv ./dump-downclock ./$nouveau_pm_name
echo "Compressing the dump"
xz -z -9 -v ./$nouveau_pm_name
cd ..
echo "Compressing the hole set of information"
mkdir ./$nouveau_pm_name
mv ./$TMPDIR/* ./$nouveau_pm_name/
tar -cpzf $nouveau_pm_name.tar.gz ./$nouveau_pm_name/
cd ..
echo "Unmounting debugfs"
umount /sys/kernel/debug
echo "Removing temporary directories"
rm -rf $TMPDIR/
rm -rf $nouveau_pm_name/
exit 0