Skip to content

Setting up a local copy of the UI

Clark Gaebel edited this page Apr 28, 2022 · 4 revisions

magic-trace can, but does not by default, serve its own UI after it takes a trace. That saves you from having to scp trace files around, at the cost of having to build the UI and then keep it around somewhere.

Besides being convenient, a local UI is also handy if you don't trust that our hosted version is entirely client-sided, or if it's unavailable.

Initial setup

The site only builds on Linux machines.

  1. Clone our github repo
git clone https://github.com/janestreet/perfetto.git
cd perfetto
  1. Build it
tools/install-build-deps --ui
ui/build
  1. The site was generated in out/ui/ui/dist. Rename dist to ui, and move it into shared filesystem somewhere if you want to make it available to your whole company.

Using it

You need to point magic-trace at wherever you built that site. Do so by setting the environment variable MAGIC_TRACE_PERFETTO_DIR=/path/to/wherever/you/put/ui. You'll know you did this right if the output of ls -1 $MAGIC_TRACE_PERFETTO_DIR/ui looks something like:

favicon.png
index.html
service_worker.js
service_worker.js.map
v25.0-f53c1d9ef

The hash may be different.

Setting that environment unlocks a new command line argument: -serve, which you can use to change the port on which Perfetto is served.