From 61ff1309cabaa1fc879ed0c3179696ad64a79da3 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 12 Dec 2011 17:44:58 +0000 Subject: scripts: Add a trivial script to show which programs are using the GPU Signed-off-by: Chris Wilson --- scripts/who.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 scripts/who.sh (limited to 'scripts/who.sh') 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 -- cgit v1.2.3