wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
8.66k stars 598 forks source link

Find Zone searches for Function instead of Zone name when used with TracyCZoneName #606

Open olegbl opened 10 months ago

olegbl commented 10 months ago

I'm using TracyCZone, TracyZZoneName, and TracyCZoneEnd to annotate some method calls. These are coming from another language and just being logged in C++, so all the start and end calls actually occur in the same place in C++ code (the name passed to TracyCZoneName is dynamic).

The calls show up properly in Tracy's timeline and I can browse them without issues. Everything looks good in the Zone Info panel as well (I can see the dynamic zone names I set via TracyCZoneName, and the name of the C++ function that started the zone).

However, when I try to use the Find Zone panel to search for these zones, it doesn't work as expected. Instead of finding them using their zone name, they all show up under the same name which is the C++ function that started the zone. Essentially, they all show up listed as their "Function" instead of their "Zone name". This makes it impossible to actually search for specific ones.

The non-TracyC APIs (i.e. the C++ Tracy APIs like ZoneNamedN) that I'm using to instrument other calls (that are in C++ code), including named ones, do not have this issue. The Find Zone panel searches for them using "Zone name" rather than "Function", as expected.

What am I doing wrong?

wolfpld commented 10 months ago

See 3.13.10 in the manual for how to set custom source locations.

olegbl commented 10 months ago

Thanks for the reply!

Does that mean that it's intended that it searches for "Function" instead of "Zone name" for these zones? I'll try just faking the "Function" to be the same as "Zone name".

It's confusing since it searches for "Zone name" for zones setup using the non-C API.

EDIT: Making "Zone name" and "Function" match using the APIs in 3.13.10 did indeed fix the searching issue! The previous value of "Function" wasn't useful anyway, so this is a great workaround. Thanks again!