1 | Gpuvis Tracing Annotations
|
---|
2 | ==========================
|
---|
3 |
|
---|
4 | `Gpuvis <https://github.com/mikesart/gpuvis>`__ is a tool to visualize ftrace
|
---|
5 | traces, with support for most GPU drivers to show GPU activity.
|
---|
6 |
|
---|
7 | Mesa can emit trace markers to be displayed in Gpuvis, which is useful for
|
---|
8 | figuring out why e.g. stalls are happening.
|
---|
9 |
|
---|
10 | Run on Linux
|
---|
11 | ------------
|
---|
12 |
|
---|
13 | Any traces can be made with trace-cmd. The Gpuvis repository contains
|
---|
14 | `scripts <https://github.com/mikesart/gpuvis/tree/master/sample>`__ for
|
---|
15 | configuring the markers needed for GPU events. To start tracing:
|
---|
16 |
|
---|
17 | .. code-block:: console
|
---|
18 |
|
---|
19 | sh trace-cmd-setup.sh && sh trace-cmd-start-tracing.sh
|
---|
20 | # Start your game etc. Then to capture a trace
|
---|
21 | sh trace-cmd-capture.sh
|
---|
22 | # and to finally stop
|
---|
23 | sh trace-cmd-stop-tracing.sh
|
---|
24 |
|
---|
25 | The resulting trace file can be opened with Gpuvis.
|
---|
26 |
|
---|
27 | Run on Steamos
|
---|
28 | --------------
|
---|
29 |
|
---|
30 | Steamos includes a script (`gpu-trace <https://github.com/lostgoat/gpu-trace>`__)
|
---|
31 | to capture traces.
|
---|
32 |
|
---|
33 | .. code-block:: console
|
---|
34 |
|
---|
35 | sudo gpu-trace
|
---|
36 | # Press Ctrl+C to stop capture and open report in gpuvis
|
---|
37 |
|
---|
38 | Note that on Steamos gpuvis is actually not installed by default, but the
|
---|
39 | script does write a gpu-trace.zip file in the current working directory. To
|
---|
40 | open it you'll want to do the following on your development machine:
|
---|
41 |
|
---|
42 | .. code-block:: console
|
---|
43 |
|
---|
44 | scp sd-host:gpu-trace.zip ./
|
---|
45 | unzip gpu-trace.zip
|
---|
46 | ./trace-cmd convert -i *.dat -o converted.dat --compression none --file-version 6
|
---|
47 | gpuvis *.json converted.dat
|
---|
48 |
|
---|
49 | The main advantage of the gpu-trace script is that it has an integration with
|
---|
50 | perf, so Gpuvis can also visualize perf samples in the timeline. Note that the
|
---|
51 | perf file is preprocessed before being put into the zip file, so the trace is
|
---|
52 | portable between machines.
|
---|
53 |
|
---|
54 |
|
---|
55 | Annotations in Steam games
|
---|
56 | --------------------------
|
---|
57 |
|
---|
58 | Steam games are run in a container, and need the environment variable
|
---|
59 | PRESSURE_VESSEL_DEVEL=1 to set up the tracing filesystem so the trace marker
|
---|
60 | can be written. This can e.g. be done by going to the game properties in
|
---|
61 | Steam and setting the command line to
|
---|
62 |
|
---|
63 | .. code-block:: console
|
---|
64 |
|
---|
65 | PRESSURE_VESSEL_DEVEL=1 %command%
|
---|
66 |
|
---|
67 | Then you can run the game as usual, and the driver will write trace annotations.
|
---|