The Tracy profiler system is currently in version hell on Linux. It used to work very well, but now it's broken. I have a workaround, but it's awful.
The Tracy profiler has a part that's embedded in the program being profiled, and an external client that talks to it over a socket and displays the results. With each new version, the protocol changes, and clients and the embedded server do not work cross-version.
The current recommended version of the Rust client on crates.io is
tracy-client = "0.15.2".
The version compatibility table on crates.io does not list this version.
However, the version compatibility table on Github, which is different, says that Tracy v0.9.1 matches tracy-client 0.15.2. So we need Tracy v0.9.1.
Tracy can be obtained from Github. There's a "release" for 0.9.1. It comes with a Windows executable, but you have to build Linux from source. Which is where things go downhill.
Trying to build the Linux version of the Tracy profiler from source fails.
../../../server/TracySourceView.cpp: In member function ‘bool tracy::SourceView::Disassemble(uint64_t, const tracy::Worker&)’: ../../../server/TracySourceView.cpp:736:46: error: ‘CS_GRP_BRANCH_RELATIVE’ was not declared in this scope 736 | else if( detail.groups[j] == CS_GRP_BRANCH_RELATIVE && opType < OpType::Branch ) opType = OpType::Branch;
Turns out that this is a documented fail.
2.3 Building the server
2.3.1 Required libraries
To build the application contained in the profiler directory, you will need to install external libraries, which are not bundled with Tracy.
At the time of writing, the capstone library is in a bit of disarray. The officially released
version 4.0.2 can’t disassemble some AVX instructions, which are successfully parsed by the next branch. However, the next branch somehow lost information about input/output registers for some functions. You may want to explore the various available versions to find one that suits your needs the best. Note that only the next branch is actively maintained. Be aware that your package manager might distribute the deprecated master branch
Yes, it really says that.
So going over to the Capstone library., which is a tool for disassembly, we find the problem. There hasn't been a release in two years. it's not abandoned; there are check-ins on the branch "next". Not "master" - "master" is 2613 commits behind "next."
So you're supposed to figure out something the developer of Tracy can't figure out, and mod the thing yourself to use some development version of the capstone library. Yes, that's really what the directions say.
There is, however, an amusing workaround. The Tracy release comes with a compiled version of the profiler for Windows. That will run under Wine. It's possible to profile a Linux program running on Linux by running
It seems silly, but it works.