Chris Wilson 61ff1309ca scripts: Add a trivial script to show which programs are using the GPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 17:47:14 +00:00

14 lines
324 B
Bash
Executable File

#!/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