tracy icon indicating copy to clipboard operation
tracy copied to clipboard

Dynamically allocated frame names

Open YaLTeR opened this issue 1 year ago • 2 comments

Hi! I'm using Tracy to profile a Wayland compositor I'm writing, using the Rust Tracy bindings. I'm really quite enjoying it, thanks for this fantastic piece of software!

I've recently started using discontinuous frames to measure my compositor rendering monitor contents. However, since every monitor has a completely separate repaint and vsync cycle, I need to use a distinct frame set for every monitor. And since monitors can be plugged in and out at runtime, I need to name those frame sets dynamically.

As far as I understand, there's currently no API for creating frames that copies the name string that it receives. For now I've worked around this by leaking the generated name string (making it valid for the rest of the program's lifetime), but this is not ideal. If I understand correctly, spans do have an API that copies the string they get.

YaLTeR avatar Sep 04 '23 13:09 YaLTeR

The workaround you are using is the intended solution. The amount of monitor connect/disconnect events is so insignificant that leaking the memory is not a problem. The alternative solution, if implemented, would require making per-frame copies of the provided string, making things not ideal in another way.

wolfpld avatar Sep 04 '23 13:09 wolfpld

Right, I see.

YaLTeR avatar Sep 04 '23 13:09 YaLTeR