Add profile-with-tracy-ondemand feature
Browse files at this commitd5a8074b5388518871a949093e34f44d735157e7Parent: c506fec2 changed files +14 -3
- Cargo.toml +2 -0
- wiki/Developing-niri.md +12 -3
Cargo.tomlmodified+2 -0
| @@ -116,6 +116,8 @@ systemd = ["dbus"] | |||
| 116 | xdp-gnome-screencast = ["dbus", "pipewire"] | 116 | xdp-gnome-screencast = ["dbus", "pipewire"] |
| 117 | # Enables the Tracy profiler instrumentation. | 117 | # Enables the Tracy profiler instrumentation. |
| 118 | profile-with-tracy = ["profiling/profile-with-tracy", "tracy-client/default"] | 118 | profile-with-tracy = ["profiling/profile-with-tracy", "tracy-client/default"] |
| 119 | +# Enables the on-demand Tracy profiler instrumentation. | ||
| 120 | +profile-with-tracy-ondemand = ["profile-with-tracy", "tracy-client/ondemand", "tracy-client/manual-lifetime"] | ||
| 119 | # Enables dinit integration (global environment). | 121 | # Enables dinit integration (global environment). |
| 120 | dinit = [] | 122 | dinit = [] |
| 121 | 123 | ||
wiki/Developing-niri.mdmodified+12 -3
| @@ -49,10 +49,19 @@ The `niri-visual-tests` sub-crate is a GTK application that runs hard-coded test | |||
| 49 | We have integration with the [Tracy](https://github.com/wolfpld/tracy) profiler which you can enable by building niri with a feature flag: | 49 | We have integration with the [Tracy](https://github.com/wolfpld/tracy) profiler which you can enable by building niri with a feature flag: |
| 50 | 50 | ||
| 51 | ``` | 51 | ``` |
| 52 | -cargo build --release --features=profile-with-tracy | 52 | +cargo build --release --features=profile-with-tracy-ondemand |
| 53 | ``` | 53 | ``` |
| 54 | 54 | ||
| 55 | -Then you can open Tracy (you will need the latest stable release) and attach to a running niri instance to collect profiling data. This is **not** currently "on-demand" (until the next Tracy release), so niri will always collect profiling data when compiled this way, and you can't run a build like this as your main compositor. | 55 | +Then you can open Tracy (you will need the latest stable release) and attach to a running niri instance to collect profiling data. Profiling data is collected "on demand"---that is, only when Tracy is connected. You can run a niri build like this as your main compositor if you'd like. |
| 56 | + | ||
| 57 | +> [!NOTE] | ||
| 58 | +> If you need to profile niri startup or the niri CLI, you can opt for "always on" profiling instead, using this feature flag: | ||
| 59 | +> | ||
| 60 | +> ``` | ||
| 61 | +> cargo build --release --features=profile-with-tracy | ||
| 62 | +> ``` | ||
| 63 | +> | ||
| 64 | +> When compiled this way, niri will **always** collect profiling data, so you can't run a build like this as your main compositor. | ||
| 56 | 65 | ||
| 57 | To make a niri function show up in Tracy, instrument it like this: | 66 | To make a niri function show up in Tracy, instrument it like this: |
| 58 | 67 | ||
| @@ -62,4 +71,4 @@ pub fn some_function() { | |||
| 62 | 71 | ||
| 63 | // Code of the function. | 72 | // Code of the function. |
| 64 | } | 73 | } |
| 65 | -``` | ||
| \ No newline at end of file | \ No newline at end of file | ||
| 74 | +``` | ||