Commit Graph
70 Commits
Author SHA1 Message Date
Bartosz Taudul da5c8153bc Disable capture-daemon directory lock on windows. 2026-09-06 01:48:06 +02:00
Bartosz Taudul d288c38c98 Add a per-directory lock file to the capture daemon.
Only one daemon can write to a given output directory at a time. The
lock holds the daemon PID and is removed on a clean exit; a lock whose
owner is verifiably gone is taken over on the next start, and a lock
whose owner cannot be read or that reads as alive must be removed by
hand.
2026-09-06 01:07:47 +02:00
Bartosz Taudul db6a46cf3e Extract shared capture-side tool code into TracyUtil. 2026-09-06 01:07:46 +02:00
Bartosz Taudul ebf5ebd9bd Replace the output file safely in tracy-capture.
The old pre-flight truncated the output at startup with -f, so an
interrupted capture lost the trace, and the probe fopen followed a
symlink. The existing file is now moved to FILE~ for the duration of
the capture and restored if the trace cannot be written.
2026-09-06 01:07:45 +02:00
Bartosz Taudul 89f12318a1 Fix empty rate sample list read in the daemon stats. 2026-09-06 01:07:45 +02:00
Bartosz Taudul fa4336dd26 Fix empty rate sample list read in the progress line.
HasData() flips when the connection is established, but the rate
list is only filled by the worker periodic stats update, whose first
entry arrives ~200ms later, so the first render could read an empty
list.
2026-09-06 01:07:45 +02:00
Bartosz Taudul a7926283a8 Wait for capture workers to disconnect before saving. 2026-08-09 18:32:17 +02:00
Bartosz Taudul fddbb5d990 Print tracy version in all tools. 2026-03-28 21:38:47 +01:00
Bartosz Taudul 53fa2ba67b Fix includes. 2026-03-02 23:58:16 +01:00
Bartosz Taudul 80c849a2aa Fix client identification in tracy-capture-daemon
Use '<pid>_<ip>_<port>' string as client ID instead of IP+port hash.
This allows:
- Same program restarting (new PID) to be recognized as new client
- Multiple instances of same program (different PIDs) to capture separately
2026-03-02 23:00:42 +01:00
Bartosz TaudulandGrégoire Roussel e6aae0c18e Add tracy-capture-daemon for multi-client capture
A discovery-and-capture daemon that listens for UDP broadcasts from
Tracy clients, automatically connects to discovered clients, and
captures each to a separate file.

Features:
- Continuous discovery until Ctrl+C
- Per-client capture threads
- Terminal display with per-client stats
- Output files named: <program>_<ip>_<port>.tracy
- Collision handling with _1, _2 suffix
- Graceful shutdown on signal

Based on the multicapture design by Grégoire Roussel, but simplified
to output separate files instead of merging (use tracy-merge for that).

Co-authored-by: Grégoire Roussel <gregoire.roussel@wandercraft.eu>
2026-03-02 22:32:45 +01:00
Bartosz Taudul 03f01b9c49 Include fixes. 2026-03-02 21:34:35 +01:00
Bartosz TaudulandGrégoire Roussel 2341dee04a Refactor capture utilities into CaptureOutput
Extract common output functions from capture.cpp into a proper library:

- InitTerminalDetection()/IsTerminal() - terminal detection
- AnsiPrintf() - printf with ANSI escape codes
- WaitForConnection() - blocks until connected, returns error code
- PrintCaptureProgress() - prints throughput/memory/time stats
- PrintWorkerFailure() - prints failure details with callstack

Functions are declared in CaptureOutput.hpp and implemented in
CaptureOutput.cpp. Both tracy-capture and future tools can share
this code.

Co-authored-by: Grégoire Roussel <gregoire.roussel@wandercraft.eu>
2026-03-02 21:28:22 +01:00
Jakub Konka e5646b1f6a capture: Display current query backlog 2026-01-23 15:26:07 +01:00
Bartosz Taudul 880c600506 Remove queue delay calibration.
This value is not used for anything, it was just a number displayed in
the UI without much meaning to anyone.

Operations on the queue during early init may not work correctly, stopping
some programs from running past the calibration loop.
2025-07-11 23:23:31 +02:00
Bartosz Taudul a636950eb5 Fix wrong printf. 2024-07-17 17:55:19 +02:00
Bartosz Taudul 455738a266 Default to zstd level 3 with 4 streams in tracy-capture. 2024-06-02 15:35:07 +02:00
Bartosz Taudul 5730884678 Print memory limit in capture utility, if appropriate. 2024-05-05 21:21:19 +02:00
Bartosz Taudul c31bf6f7f8 Add blue ANSI color macro. 2024-05-05 21:21:19 +02:00
Bartosz Taudul ee56e1fcd5 Allow setting memory limit in capture utility. 2024-05-05 21:21:19 +02:00
Bartosz Taudul 6748d11a2f Fix capture utility. 2024-05-05 21:12:50 +02:00
Bartosz Taudul 377e41fe61 Make memUsage an atomic. 2024-05-04 14:28:55 +02:00
Bartosz Taudul dbcffb8c4f Print active time in the capture utility. 2023-03-03 22:51:04 +01:00
Che-Yu Wu ceb474e072 Wait on HasData condition to avoid infinite loop.
Tracy worker resets the IsConnected to false when finishing the
capture. If it finishes too quick, the waiting loop in capture.cpp
might never see IsConnected = true.
2023-01-25 11:23:04 +00:00
Bartosz Taudul 7eba104e12 Sleep in capture when waiting for connection. 2022-10-19 22:00:40 +02:00
Bartosz Taudul 73fe208b97 Remove unused variable. 2022-09-29 21:02:05 +02:00
Bartosz Taudul 06c7984a16 Move all client headers and sources to public/ directory. 2022-07-17 15:47:38 +02:00
Benoit Jacob 10ad96c29e 4-space indent 2022-04-12 20:36:08 +00:00
Benoit Jacob 92fdf12e05 make progress info and ANSI colors conditional on being a TTY 2022-04-12 20:31:47 +00:00
Benoit Jacob ce1f6d0526 explicitly initialize as false - hope the compiler optimizes that 2022-04-12 17:47:14 +00:00
Benoit Jacob 331f39e6a5 rename to s_disconnect and make file-scope static 2022-04-12 17:45:33 +00:00
Benoit Jacob 55ae38a138 Make disconnect atomic because it's written by a signal handler 2022-04-12 17:34:41 +00:00
Benoit Jacob 8c3868e43b Make disconnect volatile as it's written by a signal handler. 2022-04-12 16:06:54 +00:00
Bartosz Taudul 5a2a58f68f Make capture output better suited for 80-char-wide terminals. 2021-12-30 16:21:25 +01:00
Bartosz Taudul 13b28714ee Display failure context in capture utility. 2021-10-10 14:52:30 +02:00
Graydon Hoare 26fd867e52 Add -s <seconds> parameter to capture.cpp 2021-08-25 22:52:23 -07:00
Bartosz Taudul f8ccd8c40d Move TracyStackFrames to common. 2021-05-23 23:51:56 +02:00
Bartosz Taudul 3d75bf653a Add interface for frame images dict building. 2021-05-15 15:50:20 +02:00
Bartosz Taudul 9892407ff0 Use system getopt in capture utility on unix.
This fixes header clash between getopt.h and unistd.h (required for unlink),
which prevented LTO on macos.
2021-01-27 00:32:38 +01:00
Bartosz Taudul 8adfd45453 Display failure callstack in capture utility. 2020-10-06 14:50:55 +02:00
Bartosz Taudul 9f00bde629 Use 127.0.0.1 instead of localhost in capture.
This is to keep the default address uniform between tools. There was a
case where localhost wasn't resolving properly and a connection couldn't
be established.
2020-09-24 01:31:24 +02:00
Bartosz Taudul 4a0926aa70 Early check if output is writable in capture utility. 2020-09-20 20:11:19 +02:00
Bartosz Taudul a1916a7c6c Mark Usage() as a noreturn function. 2020-09-20 20:08:39 +02:00
Bartosz Taudul 7da17680ae Prevent overwriting existing files by the capture utility. 2020-09-20 20:04:43 +02:00
kubouch 1f6d18efcd Fix getopt include for Windows build of capture 2020-07-11 15:10:47 +03:00
kubouch 276e40ab2a Move getopt to root 2020-07-11 12:26:01 +03:00
Bartosz Taudul 3f236b7e91 Handle ^C in capture utility on windows. 2020-04-03 02:00:07 +02:00
Bartosz Taudul 9f15d402de The capture utility will connect to localhost by default. 2020-04-03 01:46:07 +02:00
Bartosz Taudul f58c96e4b3 Display trace file size in capture utility. 2020-02-08 13:10:41 +01:00
Bartosz Taudul f017b27ae2 RealToString() is always called with separator set to true. 2020-01-31 01:43:24 +01:00