summaryrefslogtreecommitdiff
path: root/tools/intel_aubdump.in
blob: feee23a4e28330a34b0a5c9f822a8fe9d811ccf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# -*- mode: sh -*-

function show_help() {
    cat <<EOF
Usage: intel_aubdump [OPTION]... [--] COMMAND ARGUMENTS

Run COMMAND with ARGUMENTS and dump an AUB file that captures buffer
contents and execution of the GEM application.

  -o, --output=FILE  Name of AUB file. Defaults to COMMAND.aub

      --device=ID    Override PCI ID of the reported device

  -v                 Enable verbose output

      --help         Display this help message and exit

EOF

    exit 0
}

verbose=0
device=0

while true; do
      case "$1" in
	  -o)
	      file=$2
	      shift 2
	      ;;
	  -v)
	      verbose=1
	      shift 1
	      ;;
	  -o*)
	      file=${1##-o}
	      shift
	      ;;
	  --output=*)
	      file=${1##--output=}
	      shift
	      ;;
	  --device=*)
	      device=${1##--device=}
	      shift
	      ;;
	  --help)
	      show_help
	      ;;
	  --)
	      shift
	      break
	      ;;
	  -*)
	      echo "intel_aubdump: invalid option: $1"
	      echo
	      show_help
	      ;;
	  *)
	      break
	      ;;
      esac
done

[ -z $1 ] && show_help

file=${file:-$(basename $1).aub}

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@

LD_PRELOAD=${libdir}/intel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
	  INTEL_AUBDUMP_ARGS="verbose=$verbose;file=$file;device=$device" \
	  exec -- "$@"