diff --git a/sample/trace-cmd-capture.sh b/sample/trace-cmd-capture.sh index ede82a19..354e3092 100755 --- a/sample/trace-cmd-capture.sh +++ b/sample/trace-cmd-capture.sh @@ -19,6 +19,11 @@ CMD="trace-cmd stop" echo ${CMD} $CMD +# Extract i915-perf trace +CMD="i915-perf-control -d trace_${DATE}.i915-dat" +echo ${CMD} +$CMD + # Extract trace CMD="trace-cmd extract -k -o trace_${DATE}.dat" echo ${CMD} diff --git a/sample/trace-cmd-setup.sh b/sample/trace-cmd-setup.sh index 92b3f2f1..41cd6976 100755 --- a/sample/trace-cmd-setup.sh +++ b/sample/trace-cmd-setup.sh @@ -83,6 +83,9 @@ else ROOT_CMDS+="chmod 0222 \"${TRACEFS}/trace_marker\"\n" fi +# Enable i915-perf to collect GPU data. +ROOT_CMDS+="sysctl dev.i915.perf_stream_paranoid=0" + if [ -z "${ROOT_CMDS}" ]; then : else @@ -134,4 +137,3 @@ else fi spewTraceStatus - diff --git a/sample/trace-cmd-start-tracing.sh b/sample/trace-cmd-start-tracing.sh index 4e0bf76a..66734d3b 100755 --- a/sample/trace-cmd-start-tracing.sh +++ b/sample/trace-cmd-start-tracing.sh @@ -12,6 +12,13 @@ if [ ! -u "${TRACECMD}" ]; then exit -1 fi +if [ "${USE_I915_PERF}" ]; then + if [ -z "${I915_PERF_METRIC}" ]; then + echo "WARNING: Missing I915_PERF_METRIC value. Using default value 'RenderBasic'." + I915_PERF_METRIC="RenderBasic" + fi +fi + EVENTS= # https://github.com/mikesart/gpuvis/wiki/TechDocs-Linux-Scheduler @@ -63,10 +70,22 @@ CMD="trace-cmd reset" echo $CMD $CMD +CLOCK=mono + echo -CMD="trace-cmd start -C mono -b 8000 -D -i ${EVENTS}" +CMD="trace-cmd start -C ${CLOCK} -b 8000 -D -i ${EVENTS}" echo $CMD $CMD +if [ -e /tmp/.i915-perf-record ]; then + CMD="i915-perf-control -q" + echo $CMD + $CMD +fi + +CMD="i915-perf-recorder -m ${I915_PERF_METRIC} -s 8000 -k ${CLOCK}" +echo $CMD +$CMD & + echo ./trace-cmd-status.sh diff --git a/sample/trace-cmd-stop-tracing.sh b/sample/trace-cmd-stop-tracing.sh index decf49c2..c5bf1082 100755 --- a/sample/trace-cmd-stop-tracing.sh +++ b/sample/trace-cmd-stop-tracing.sh @@ -8,4 +8,10 @@ CMD="trace-cmd snapshot -f" echo $CMD $CMD +if [ "${USE_I915_PERF} " ]; then + CMD="i915-perf-control -q" + echo $CMD + $CMD +fi + ./trace-cmd-status.sh