Skip to content

Commit 812f28e

Browse files
authored
Merge pull request #14 from fabinsch/add-tracy
Add tracy
2 parents 464c846 + e15809b commit 812f28e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ With `pdb++`, add breakpoints again with `breakpoint()`. You may run `sticky` in
118118
119119
For debugging code with a graphical interface, check [pudb](https://documen.tician.de/pudb/starting.html) (similar usage).
120120
121-
## Performance analysis
121+
## Performance analysis with FlameGraph
122122
123123
Checking how much time is spent for every function. Can help you to find the bottleneck in your code.
124124
[FlameGraph](https://github.com/brendangregg/FlameGraph) is a nice visual tool to display your stack trace.
@@ -173,6 +173,25 @@ cd <cloned-flamegraph-repo>
173173
174174
As the process with the default flamegraph repo is quite a pain, you can write your own script like @ManifoldFR in [proxDDP](https://github.com/Simple-Robotics/proxddp/blob/wj/nnl-rollout/scripts/make_flamegraph.sh).
175175
176+
## Performance analysis with Tracy Profiler
177+
Tracy is a real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications that comes with a nice [documentation](https://github.com/wolfpld/tracy/releases/latest/download/tracy.pdf).
178+
You can checkout the interactive [demo](https://tracy.nereid.pl/).
179+
180+
To use it in your project, you can follow the same steps as in pinocchio or simple:
181+
1. Install it via: `conda install tracy-profiler tracy-profiler-gui -c conda-forge`
182+
2. Include `tracy.cmake` from jrl-cmakemodules in your main CMakeLists file
183+
3. Add tracy as project dependency e.g.
184+
```cmake
185+
if(PROJECT_NAME_BUILD_WITH_TRACY)
186+
# assume it is installed somewhere
187+
add_project_dependency(Tracy REQUIRED)
188+
endif(PROJECT_NAME_BUILD_WITH_TRACY)
189+
```
190+
4. In your code: `#include "project_name/tracy.hpp"` and use `PROJECT_NAME_TRACY_ZONE_SCOPED_N("NAME_OF_ZONE")` , where project_name should be replaced by your actual project name.
191+
See [here](https://github.com/jrl-umi3218/jrl-cmakemodules/blob/b5ae8e49306840a50ae9c752c5b4040f892c89d8/tracy.hh.cmake) for all macros.
192+
193+
After specifying the code segments you wish to monitor with Tracy, execute `tracy-profiler` from the command line (ensure your conda environment is active). Run your benchmark files and review the various statistics in the GUI. Note that if you are benchmarking on a remote server, you can connect to it using `ssh user@remote -X` to display the Tracy GUI on your screen.
194+
176195
## Finding memory leaks
177196
178197
[Valgrind](https://valgrind.org/) can automatically detect many memory management and threading bugs.

0 commit comments

Comments
 (0)