Chris Wilson | 61ff130 | 2011-12-12 17:44:58 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # usage: sudo who.sh |
| 4 | # |
| 5 | # Requires root permissions to both query who has the device open, |
| 6 | # and to read the mappings of likely root-owned processes |
| 7 | # |
| 8 | |
| 9 | for i in `lsof -t /dev/dri/card0`; do |
| 10 | who=`readlink /proc/$i/exe` |
| 11 | count=`grep /dev/dri/card0 /proc/$i/maps | wc -l | cut -f1 -d\ ` |
Chris Wilson | 7ac492a | 2011-12-12 20:19:03 +0000 | [diff] [blame] | 12 | echo "$who [$i]: $count" |
Chris Wilson | 61ff130 | 2011-12-12 17:44:58 +0000 | [diff] [blame] | 13 | done |