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
Copy file name to clipboardExpand all lines: _docs_v7/Tracy-Integration.md
+25-17Lines changed: 25 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,23 +50,31 @@ This embeds the Tracy client into SU2 for profiling.
50
50
51
51
## Instrumenting SU2 Code
52
52
53
-
To profile a functionin SU2, add Tracy macros to the source code. Here’s an example:
54
-
55
-
1. **Include the Tracy Header:**
56
-
- Add this at the top of the source file:
57
-
```c++
58
-
#include <tracy/Tracy.hpp>
59
-
```
60
-
61
-
2. **Instrument the Function:**
62
-
- Use `ZoneScopedN` to mark the functionfor profiling:
63
-
```c++
64
-
void MyFunction() {
65
-
ZoneScopedN("MyFunction");
66
-
// Function implementation
67
-
}
68
-
```
69
-
- The `"MyFunction"` label identifies this section in the Tracy GUI.
53
+
To profile a functionin SU2, you must use the project's centralized wrapper macros. This approach ensures that profiling can be cleanly enabled or disabled at compile time without modifying the core logic.
54
+
55
+
1. **Include the SU2 Tracy Wrapper Header:**
56
+
- Add an include directive for `tracy_structure.hpp` at the top of your C++ source file. The relative path will depend on the file's location. For example, fora filein`SU2_CFD/src/fluid/`:
- **Important:** Do not include `<tracy/Tracy.hpp>` directly. The wrapper header manages the actual Tracy library.
61
+
62
+
2. **Instrument the Function with SU2 Macros:**
63
+
- Use `SU2_ZONE_SCOPED_N("MyLabel")` to mark a functionor scope with a custom name. This is the recommended macro for clarity.
64
+
```cpp
65
+
void MyFunction() {
66
+
SU2_ZONE_SCOPED_N("MyFunction");
67
+
// Function implementation
68
+
}
69
+
```
70
+
- The label you provide (e.g., `"MyFunction"`) is what will appear in the Tracy profiler's timeline.
71
+
- Alternatively, for a quick annotation, you can use `SU2_ZONE_SCOPED;`. This macro automatically uses the compiler-provided function name for the label.
0 commit comments