scripts: Add a trivial script to show which programs are using the GPU

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-12-12 17:44:58 +00:00
parent 10e36edabe
commit 61ff1309ca
2 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,6 @@
noinst_SCRIPTS = \
throttle.py\
who.sh \
$(NULL)
EXTRA_DIST = $(noinst_SCRIPTS)

13
scripts/who.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
#
# usage: sudo who.sh
#
# Requires root permissions to both query who has the device open,
# and to read the mappings of likely root-owned processes
#
for i in `lsof -t /dev/dri/card0`; do
who=`readlink /proc/$i/exe`
count=`grep /dev/dri/card0 /proc/$i/maps | wc -l | cut -f1 -d\ `
echo "$who: $count"
done