What the profiler's client leaves out

Where a thread waits stays out of the default build: the wait stacks walk the stack at every context switch, which Linux gives only to root with tracefs, and the build defines TRACY_NO_WAIT_STACKS to leave them off. Configure with -DSNX_TRACY_WAIT_STACKS=ON to build them in, and a run with tracy_context_switches=1, root and tracefs collects them. A zone's own source (TRACY_NO_CODE_TRANSFER off) and the client's zone verification (TRACY_NO_VERIFY off, so a zone begun and not ended is caught) are in the build, and both cost nothing until a GUI asks. A frame's picture is a readback and a downsample of the window's image, which takes tracy_frame_images' seconds.

The sampler covers every CPU and the threads that start later, so the guest's threads are sampled too. The names come from the ELF tables of the loaded objects: the runtime's own code and the game's recompiled code beside the game resolve to functions, a shared library to its exported ones, and the rest (a driver's, usually stripped) stays an address, which the tracy-update utility can resolve later. How many samples get through is the kernel's call: each one walks up to 127 frames, and a machine busy with a recompile drops most of them, so a trace can be coarse. Lowering kernel.perf_event_max_stack (it needs root) makes the samples smaller and more of them get through, and a longer run gives the statistics more to work with. The build-time TRACY_SAMPLING_HZ define sets another rate.


Made from docs/dev/development.md at 69237645142c. GPL-3.0-or-later.