xref: /aosp_15_r20/external/crosvm/third_party/virglrenderer/perf-testing/README.md (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1*bbecb9d1SAndroid Build Coastguard WorkerThe files in this directory help with testing Virgl on the virtio-gpu winsys
2*bbecb9d1SAndroid Build Coastguard Workerby means of Crosvm.
3*bbecb9d1SAndroid Build Coastguard Worker
4*bbecb9d1SAndroid Build Coastguard WorkerA whole environment will be built in a Docker image, then Mesa and Virglrenderer
5*bbecb9d1SAndroid Build Coastguard Workerwill be built from local directories to be used both in the host and the guest.
6*bbecb9d1SAndroid Build Coastguard Worker
7*bbecb9d1SAndroid Build Coastguard WorkerThe container image builds on top of other images built by scripts in the crosvm repository.
8*bbecb9d1SAndroid Build Coastguard Worker
9*bbecb9d1SAndroid Build Coastguard WorkerInstructions for building base images:
10*bbecb9d1SAndroid Build Coastguard Worker
11*bbecb9d1SAndroid Build Coastguard Worker```console
12*bbecb9d1SAndroid Build Coastguard Worker$ git clone https://chromium.googlesource.com/chromiumos/platform/crosvm
13*bbecb9d1SAndroid Build Coastguard Worker$ pushd crosvm
14*bbecb9d1SAndroid Build Coastguard Worker$ sh docker/build_crosvm_base.sh
15*bbecb9d1SAndroid Build Coastguard Worker$ sh docker/build_crosvm.sh
16*bbecb9d1SAndroid Build Coastguard Worker```
17*bbecb9d1SAndroid Build Coastguard Worker
18*bbecb9d1SAndroid Build Coastguard WorkerInstructions for building target image:
19*bbecb9d1SAndroid Build Coastguard Worker
20*bbecb9d1SAndroid Build Coastguard Worker```console
21*bbecb9d1SAndroid Build Coastguard Worker$ cd virglrenderer
22*bbecb9d1SAndroid Build Coastguard Worker$ sh perf-testing/build-dockerimage.sh
23*bbecb9d1SAndroid Build Coastguard Worker```
24*bbecb9d1SAndroid Build Coastguard Worker
25*bbecb9d1SAndroid Build Coastguard WorkerInstructions for running the container:
26*bbecb9d1SAndroid Build Coastguard Worker
27*bbecb9d1SAndroid Build Coastguard Worker```console
28*bbecb9d1SAndroid Build Coastguard Worker$ cd virglrenderer
29*bbecb9d1SAndroid Build Coastguard Worker$ bash perf-testing/run_trace-in-container.sh \
30*bbecb9d1SAndroid Build Coastguard Worker    --root $PATH_THAT_CONTAINS_MESA_CHECKOUT_VIRGLRENDERER_AND_TRACES_DB_CHECKOUT \
31*bbecb9d1SAndroid Build Coastguard Worker    --trace $API_TRACE_TO_RUN
32*bbecb9d1SAndroid Build Coastguard Worker```
33*bbecb9d1SAndroid Build Coastguard Worker
34*bbecb9d1SAndroid Build Coastguard WorkerThere are also options for run_trace-in-container.sh that allow specifying the
35*bbecb9d1SAndroid Build Coastguard Workerpath to mesa, virglrenderer, and the traces db. These override the root path.
36*bbecb9d1SAndroid Build Coastguard WorkerIn addition, the root path defaults to the current working directory.
37*bbecb9d1SAndroid Build Coastguard Worker
38*bbecb9d1SAndroid Build Coastguard WorkerAs a conveniance for shell autocompletion users running the script from the default
39*bbecb9d1SAndroid Build Coastguard Workerroot that contains the traces db as subdirectory the the trace file name can be
40*bbecb9d1SAndroid Build Coastguard Workeralso given with this traces db sudirectory name, i.e. if the traces db is located
41*bbecb9d1SAndroid Build Coastguard Workerin '$workdir/traces-db', root=$workdir,  and the trace is calles 'sometrace.trace',
42*bbecb9d1SAndroid Build Coastguard Workerthen both commands
43*bbecb9d1SAndroid Build Coastguard Worker```
44*bbecb9d1SAndroid Build Coastguard Worker  perf-testing/run_trace-in-container.sh -r $rootdir -t traces-db/sometrace.trace
45*bbecb9d1SAndroid Build Coastguard Worker```
46*bbecb9d1SAndroid Build Coastguard Workerand
47*bbecb9d1SAndroid Build Coastguard Worker```
48*bbecb9d1SAndroid Build Coastguard Worker  perf-testing/run_trace-in-container.sh -r $rootdir -t sometrace.trace
49*bbecb9d1SAndroid Build Coastguard Worker```
50*bbecb9d1SAndroid Build Coastguard Workerwill work equally.
51*bbecb9d1SAndroid Build Coastguard Worker
52*bbecb9d1SAndroid Build Coastguard WorkerAt the moment of writing, the branch perfetto-tracing is needed for mesa at
53*bbecb9d1SAndroid Build Coastguard Workercommit ec4277aea63cf3, and the for virglrenderer at least commit
54*bbecb9d1SAndroid Build Coastguard Worker"perf: compile mesa with perfeto support" is needed so that these projects
55*bbecb9d1SAndroid Build Coastguard Workeremit the required traces.
56*bbecb9d1SAndroid Build Coastguard Worker
57*bbecb9d1SAndroid Build Coastguard WorkerThe perfetto traces will be saved to the a subdirectory of the traces-db checkout
58*bbecb9d1SAndroid Build Coastguard Workerdirectory with a name based on the api trace passed in with the --trace parameter.
59*bbecb9d1SAndroid Build Coastguard Worker
60*bbecb9d1SAndroid Build Coastguard WorkerOnce the run_trace-in-container.sh script finishes, 3 Perfetto trace files will be written:
61*bbecb9d1SAndroid Build Coastguard Worker$(API_TRACE_TO_RUN%.*}-host.perfetto, $(API_TRACE_TO_RUN%.*}-guest.perfetto
62*bbecb9d1SAndroid Build Coastguard Workerand $(API_TRACE_TO_RUN%.*}-summary.perfetto. The last one is the fusion of the two first.
63*bbecb9d1SAndroid Build Coastguard Worker
64*bbecb9d1SAndroid Build Coastguard WorkerIn order to visualize the traces, the Perfetto UI needs to be running in a local
65*bbecb9d1SAndroid Build Coastguard Workerservice which can be started as follows:
66*bbecb9d1SAndroid Build Coastguard Worker
67*bbecb9d1SAndroid Build Coastguard Worker```console
68*bbecb9d1SAndroid Build Coastguard Worker$ perf-testing/perfetto-ui.sh
69*bbecb9d1SAndroid Build Coastguard Worker```
70*bbecb9d1SAndroid Build Coastguard Worker
71*bbecb9d1SAndroid Build Coastguard WorkerThe Perfetto UI can be loaded then on Chromium on the http://localhost:10000 address.
72