diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-07-27 09:51:44 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-07-27 09:51:44 +0300 |
| commit | d5a8074b5388518871a949093e34f44d735157e7 (patch) | |
| tree | 190ca2430cac310190d458acc476aca0d1609cc6 | |
| parent | c506fecc8706e6e215d671672b2d213d0fb4b74b (diff) | |
| download | niri-d5a8074b5388518871a949093e34f44d735157e7.tar.gz niri-d5a8074b5388518871a949093e34f44d735157e7.tar.bz2 niri-d5a8074b5388518871a949093e34f44d735157e7.zip | |
Add profile-with-tracy-ondemand feature
Finally this can be added without disabling frames.
manual-lifetime is needed to avoid initializing Tracy for CLI commands,
since that is quite slow.
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | wiki/Developing-niri.md | 15 |
2 files changed, 14 insertions, 3 deletions
@@ -116,6 +116,8 @@ systemd = ["dbus"] xdp-gnome-screencast = ["dbus", "pipewire"] # Enables the Tracy profiler instrumentation. profile-with-tracy = ["profiling/profile-with-tracy", "tracy-client/default"] +# Enables the on-demand Tracy profiler instrumentation. +profile-with-tracy-ondemand = ["profile-with-tracy", "tracy-client/ondemand", "tracy-client/manual-lifetime"] # Enables dinit integration (global environment). dinit = [] diff --git a/wiki/Developing-niri.md b/wiki/Developing-niri.md index f30bfb3c..8fd93e89 100644 --- a/wiki/Developing-niri.md +++ b/wiki/Developing-niri.md @@ -49,10 +49,19 @@ The `niri-visual-tests` sub-crate is a GTK application that runs hard-coded test We have integration with the [Tracy](https://github.com/wolfpld/tracy) profiler which you can enable by building niri with a feature flag: ``` -cargo build --release --features=profile-with-tracy +cargo build --release --features=profile-with-tracy-ondemand ``` -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. +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. + +> [!NOTE] +> If you need to profile niri startup or the niri CLI, you can opt for "always on" profiling instead, using this feature flag: +> +> ``` +> cargo build --release --features=profile-with-tracy +> ``` +> +> When compiled this way, niri will **always** collect profiling data, so you can't run a build like this as your main compositor. To make a niri function show up in Tracy, instrument it like this: @@ -62,4 +71,4 @@ pub fn some_function() { // Code of the function. } -```
\ No newline at end of file +``` |
