DEV Community

cryptocode
cryptocode

Posted on

Build the Tracy profiler server on macOS

Overview

Tracy is a high performance sampling profiler. Here's a short note on how to build the profiler server on macOS:

Build

$ brew install freetype capstone gtk
$ git clone https://github.com/wolfpld/tracy.git
$ cd tracy/profiler/build
$ make release
Enter fullscreen mode Exit fullscreen mode

Run

We can now run the server and UI:

$ ./Tracy-release
Enter fullscreen mode Exit fullscreen mode

Hit the Connect button and then start your Tracy-updated application.

To actually profile an application, you have to integrate a couple of source files and demark frames and zones using macros.

This is not too hard, and is best explained by the instructions in tracy.pdf, found at https://github.com/wolfpld/tracy/releases

The short version is, add Tracy.hpp, TracyClient.cpp to your makefiles, then include Tracy.hpp in every source file you want to profile. Then use macros such as ZoneScoped.

If using cmake, the easiest approach is to add tracy as a submodule, add the Tracy.hpp/TracyClient.cpp files and make sure include dir and TRACY_ENABLE is set:

add_compile_definitions(TRACY_ENABLE)
include_directories("tracy")
Enter fullscreen mode Exit fullscreen mode

Discussion (2)

Collapse
folex profile image
folex

It has changed a bit:

# also install glfw
brew install freetype capstone gtk glfw

# now makefile is under profile/unix dir
cd tracy/profiler/unix

# same as before
make release
Enter fullscreen mode Exit fullscreen mode
Collapse
stein profile image
cryptocode Author

Appreciate the update @folex !