summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-12 17:44:58 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-12 17:47:14 +0000
commit61ff1309cabaa1fc879ed0c3179696ad64a79da3 (patch)
tree90a8d1e328174a5edae5cbb1158660ee740497f0 /scripts
parent10e36edabe42e52f7862f66147d4433e8947ebc2 (diff)
scripts: Add a trivial script to show which programs are using the GPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am1
-rwxr-xr-xscripts/who.sh13
2 files changed, 14 insertions, 0 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index e4c26c44..dad9cf75 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,5 +1,6 @@
noinst_SCRIPTS = \
throttle.py\
+ who.sh \
$(NULL)
EXTRA_DIST = $(noinst_SCRIPTS)
diff --git a/scripts/who.sh b/scripts/who.sh
new file mode 100755
index 00000000..9aab7041
--- /dev/null
+++ b/scripts/who.sh
@@ -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