Skip to content

Commit

Permalink
Add i915-perf sampling support
Browse files Browse the repository at this point in the history
In addition to the normal ftrace recording, the scripts will use the
i915-perf-recorder tool from IGT to record GPU generated performance
data on Intel platforms.

Before starting the recording, set the following variable

  export USE_I915_PERF=1

You can also select what metric set you want to use. This will affect
what kind of GPU performance data is recorded. A list of metric set is
available from the following command :

  i915-perf-recorder -m list

You can list counters recorded for each metric set along with their
description :

  i915-perf-recorder -m RenderBasic -C

then

  ./trace-cmd-start-tracing.sh
  • Loading branch information
llandwerlin-intel authored and mikesart committed Feb 18, 2020
1 parent e6962d9 commit 812c8a5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
5 changes: 5 additions & 0 deletions sample/trace-cmd-capture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 3 additions & 1 deletion sample/trace-cmd-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -134,4 +137,3 @@ else
fi

spewTraceStatus

21 changes: 20 additions & 1 deletion sample/trace-cmd-start-tracing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 6 additions & 0 deletions sample/trace-cmd-stop-tracing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 812c8a5

Please sign in to comment.