You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZJIT: Update trace-exits docs for Fuchsia trace format
The Stackprof-based documentation was outdated after the switch to
Fuchsia Trace Format (.fxt) output. Update with Perfetto UI and
trace_processor_shell workflow, including a working example and
SQL query for finding hottest exit locations.
Copy file name to clipboardExpand all lines: doc/jit/zjit.md
+48-4Lines changed: 48 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,18 +294,62 @@ This metric only appears when ZJIT is built with `--enable-zjit=stats` [or more]
294
294
295
295
### Tracing side exits
296
296
297
-
Through [Stackprof](https://github.com/tmm1/stackprof), detailed information about the methods that the JIT side-exits from can be displayed after some execution of a program. Optionally, you can use `--zjit-trace-exits-sample-rate=N` to sample every N-th occurrence. Enabling `--zjit-trace-exits-sample-rate=N` will automatically enable `--zjit-trace-exits`.
297
+
`--zjit-trace-exits` records a backtrace every time compiled code takes a
298
+
side exit. The output is a [Fuchsia Trace Format](https://fuchsia.dev/fuchsia-src/reference/tracing/trace-format)
299
+
(`.fxt`) file written to `/tmp/perfetto-{pid}.fxt`, which can be opened
300
+
directly in [Perfetto UI](https://ui.perfetto.dev/) or queried with the
ZJIT: writing trace exits to /tmp/perfetto-123456.fxt
301
314
```
302
315
303
-
A file called `zjit_exits_{pid}.dump` will be created in the same directory as `script.rb`. Viewing the side exited methods can be done with Stackprof:
316
+
To find the hottest side-exit locations, download `trace_processor_shell` and
You can also trace a specific counter with `--zjit-trace-exits=<counter_name>`
348
+
(e.g. `--zjit-trace-exits=exit_compile_error`), or downsample with
349
+
`--zjit-trace-exits-sample-rate=N` to record every N-th exit.
350
+
Enabling `--zjit-trace-exits-sample-rate=N` will automatically enable
351
+
`--zjit-trace-exits`.
352
+
309
353
### Viewing HIR as text
310
354
311
355
The compiled ZJIT HIR can be viewed as text using the `--zjit-dump-hir` option. However, HIR will only be generated if the call threshold is reached (default 30). By setting the threshold to 1 you can easily view the HIR for code snippets such as `1 + 1`:
0 commit comments