Commit Graph

9941 Commits

Author SHA1 Message Date
Bartosz Taudul
db8bfc9ba9 Prevent in-flight query notification flicker. 2026-05-07 22:34:48 +02:00
Bartosz Taudul
305382453d Add callstack sample events with 32 and 16 bit timestamps. 2026-05-07 02:16:53 +02:00
Bartosz Taudul
ccaef5ba0b ZoneBegin / ZoneBeginCallstack with 32 and 16 bit time data. 2026-05-07 02:16:53 +02:00
Bartosz Taudul
4d094c108d Add zone end messages with 32 and 16 byte time deltas.
Change in test application:
    compressed data: 130 Mpbps -> 105 Mbps
    uncompressed: 830 Mbps -> 740 Mbps
2026-05-06 19:09:19 +02:00
Bartosz Taudul
b1768b98a5 Protocol was bumped to 77 after 0.13.1. 2026-05-06 01:37:54 +02:00
Bartosz Taudul
d6e77b3f40 Remove server query fast path.
The profiler will typically want to send bursts of queries (e.g. 3 queries
to retrieve source location strings, or multiple queries to get all the call
stack frames, etc.).

Each of these queries will be sent immediately, if available space in the
network buffer permits. Each of these sends is a separate syscall.

Remove this and instead batch all queries with the already existing network
buffer overflow handling functionality.
2026-05-06 00:42:24 +02:00
Bartosz Taudul
58eaa330af Set TCP_NODELAY on profiler data channel. 2026-05-06 00:12:21 +02:00
Bartosz Taudul
8c2a970222 Merge pull request #1352 from wolfpld/slomp/apple-systrace
System tracing (callstack sampling) for Apple devices
2026-05-05 19:05:41 +02:00
Bartosz Taudul
173c58bb6e Merge pull request #1353 from siliceum/fix/winsdk-compat
Fix #1243 compatibility with WinSDK < 10.0.26100
2026-05-05 18:05:51 +02:00
Marcos Slomp
6a214ed419 refactoring globals 2026-05-05 08:28:15 -07:00
Marcos Slomp
df20e8ad84 refactoring 2026-05-05 08:05:56 -07:00
Marcos Slomp
761d50e8f5 debug cleanup 2026-05-05 07:49:15 -07:00
Clément Grégoire
2997a78872 Fix #1243 compatibility with WinSDK < 10.0.26100
After investigating (downloading and installing) all publicly available SDKs at https://learn.microsoft.com/en-us/windows/apps/windows-sdk/downloads-archive I concluded the `TRACEHANDLE` deprecation started in `10.0.26100`.
This defines `PROCESSTRACE_HANDLE` and `CONTROLTRACE_ID` as done by the SDK when using older versions. Using `WDK_NTDDI_VERSION` (and not `NTDDI_VERSION` which may change based on `_WIN32_WINNT` or user input seems to be the most reliable way to do it. While it says "WDK" it's been part of the SDK in `shared\sdkddkver.h`. Note it doesn't work for MinGW because it updates half of its sdk files for some reason.
Tested with both 10.0.26100 and 10.0.22621.0 which is the last one I found without the new types.
Also changes CONTROLTRACE_ID to ULONG64 on mingw which is correct (type used by `TRACEHANDLE` too in mingw fe2763863a/mingw-w64-headers/include/evntrace.h (L60) )
2026-05-05 16:14:21 +02:00
Marcos Slomp
6b4ed90323 remove modern c++ 2026-05-04 21:43:27 -07:00
Marcos Slomp
ace8f18adb handle ARM64 PAC 2026-05-04 16:21:19 -07:00
Marcos Slomp
c877d0bcb4 TracySysTrace already manages the wprker thread lifetime... 2026-05-04 15:45:56 -07:00
Marcos Slomp
5a168f7ae4 initial prototype of system tracing for Apple devices 2026-05-04 15:29:24 -07:00
Bartosz Taudul
5bbafeabd7 Patch ppqsort to fix binary_semaphore release race. 2026-05-04 01:13:53 +02:00
Bartosz Taudul
04728994a5 Shorten external frames in call stack tooltips. 2026-05-04 01:05:02 +02:00
Bartosz Taudul
600227a30b More compact assembly code form.
For Qwen3.6-27B tokenizer:

AStar<> (3018 byte binary): 25546 -> 21099 tokens (82.6%)
LZ4_compress_fast_continue (10.47 KB): 84140 -> 69016 tokens (82%)
2026-05-02 16:31:59 +02:00
Bartosz Taudul
6d4a080da5 More compact symbol view source attachments. 2026-05-02 16:04:29 +02:00
Bartosz Taudul
7fac1ef8c9 Update NEWS. 2026-05-02 15:44:26 +02:00
Bartosz Taudul
7e043e21e7 Enable resizing of child call distribution box. 2026-05-02 15:42:34 +02:00
Bartosz Taudul
40b328dc95 Add drawable height splitter widget. 2026-05-02 15:42:18 +02:00
Bartosz Taudul
0a64f16c2d More compact time range limits window. 2026-05-02 12:41:12 +02:00
Bartosz Taudul
9965aff723 Use fractional max rows for visible threads display to imply scrolling. 2026-05-02 01:41:28 +02:00
Bartosz Taudul
6276f1b12a Rebuild markdown manual. 2026-05-02 00:38:44 +02:00
Bartosz Taudul
335403d860 Always dim out external frames. 2026-05-02 00:38:34 +02:00
Bartosz Taudul
4e6f7c2152 More return stack reinforcement. 2026-05-02 00:31:53 +02:00
Bartosz Taudul
8877a2527d Proper count of possibly visible threads in wait stacks window. 2026-05-01 22:03:39 +02:00
Bartosz Taudul
71fb624ec4 Update NEWS. 2026-05-01 21:23:14 +02:00
Bartosz Taudul
4394d79c39 Limit "visible threads" rows displayed at once. 2026-05-01 21:20:51 +02:00
Bartosz Taudul
3900890ef4 Show visible threads list in columns.
Options list is excluded, as that's drag-n-drop, and that's too much
complication.
2026-05-01 21:20:51 +02:00
Bartosz Taudul
a11e417e43 Provide detailed call stack analysis instructions. 2026-05-01 17:56:36 +02:00
Bartosz Taudul
78bac8dcbc Use correct tid field name. 2026-05-01 17:56:35 +02:00
Alan Tse
9a7233ced5 Add MCP server for AI-assisted trace analysis (#1347)
* Add MCP server for AI-assisted trace analysis.

Introduce an optional Model Context Protocol (MCP) server that lets AI
assistants analyze Tracy captures and live sessions through Tracy's own
server engine. The server runs as a Python sidecar and talks to the
existing C++ analysis code through new pybind11 bindings.

- python/bindings/ServerModule.cpp: TracyServerBindings module exposing
  Worker, file I/O, zones, GPU zones, frame data, plots, messages, locks,
  source locations, and summary statistics (zone/GPU child stats, frame
  timing, etc.).
- python/CMakeLists.txt: builds and installs TracyServerBindings alongside
  TracyClientBindings.
- extra/mcp/tracy_mcp.py: FastMCP SSE singleton with dynamic port
  discovery, PID-file based singleton detection, session-isolated worker
  instances, synchronous and background eval, task polling, and a
  shutdown tool to release the .pyd lock during development.
- extra/mcp/start_mcp.sh, .gitignore: launcher with local override hook;
  ignores generated port/pid files.
- manual/tracy.md: documents building, running, and integrating the
  server with an AI assistant.

* Improve Tracy MCP cold-start guidance.

Cold-start usability testing showed an LLM agent burned ~7 exploratory
calls discovering the ctx object model, time-unit conventions, and join
keys before producing useful analysis. Surface that information up front
through MCP resources and entry-point tool guidance.

- extra/mcp/eval_guide.md: new bindings-layer reference covering the
  Worker object graph (zone / GPU zone / frame / thread / message /
  plot / lock / memory entry points), nanosecond time units, ZoneStats
  field semantics including self-time via get_child_zone_stats, the
  opaque 'name (addr)[arch] <srcloc_id>' key format, and worked
  examples translating common queries into ctx Python.
- extra/mcp/tracy_mcp.py: expose system.prompt.md and eval_guide.md as
  MCP resources (tracy://prompt and tracy://eval-guide) so external
  agents and Tracy Assist share the same guidance source. Resource
  content is re-read per request — edits propagate without a server
  restart.
- Point load_capture and live_connect return values plus the eval tool
  description at the resources, so the agent reads them before its
  first eval rather than introspecting blind.
- Expand load_capture docstring: name the path parameter explicitly,
  show Windows path syntax, and direct agents to list_captures plus
  TRACY_CAPTURES_DIR for capture discovery.
- Probe is_connected() briefly after Worker construction in
  live_connect and surface an actionable error on silent handshake
  failures (typically a Tracy client/server version mismatch or
  TRACY_ON_DEMAND) instead of returning misleading success.

Reduces a fresh agent's cold-start overhead from 7 exploratory calls
to 4, where the remaining 4 are unavoidable harness/schema-fetch
overhead, not API-design friction.

* Detect Tracy protocol mismatches via UDP broadcast pre-flight.

Tracy clients announce themselves on UDP port 8086 every ~3 seconds with
a BroadcastMessage carrying the protocol version, listen port, and
program name (public/common/TracyProtocol.hpp). The Tracy GUI reads this
and refuses to attempt a TCP connection on protocol mismatch, surfacing
a precise error. live_connect previously had no equivalent check, so a
mismatch produced an opaque 2-second handshake timeout with no
diagnostic about what was wrong.

- Add a broadcast parser handling versions 0-3, with variable-length
  programName (Tracy sends only the actual name + null terminator on
  the wire, not the full 64-byte buffer).
- Add a non-blocking UDP listener that binds 8086 with SO_REUSEADDR
  and waits up to 3.5s — enough to guarantee catching at least one
  beat at the 3s broadcast cadence.
- Read our bindings' ProtocolVersion at startup by parsing
  TracyProtocol.hpp, so the comparison stays in sync with the build
  without new C++ wiring.
- live_connect runs the broadcast pre-flight before constructing
  Worker. On a matched listen_port with a differing protocol_version,
  it returns a single-line error naming the program, both versions,
  and the remediation, without ever opening a TCP connection. If no
  matching broadcast arrives, it falls through to the existing
  handshake probe, which now reports any other broadcasts seen as a
  hint (helpful when the target uses a non-default port).

* Add MCP Server section to LaTeX manual.

The markdown manual is auto-generated from the LaTeX source; add the
corresponding \subsection{MCP Server} so the two stay in sync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove hand-written MCP section from tracy.md.

tracy.md is generated from tracy.tex via latex2md.sh. The MCP section
was previously written by hand directly in the markdown; now that the
LaTeX source has been updated, the markdown section should be
regenerated by running latex2md.sh rather than maintained manually.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 16:17:55 +02:00
Bartosz Taudul
460352d0d5 Allow opening callstack window from LLM attachment. 2026-04-30 21:42:22 +02:00
Bartosz Taudul
89bd8b2ba5 Add public View method for opening callstack window. 2026-04-30 21:41:53 +02:00
Bartosz Taudul
cf2c07d905 Mark GetSelectThread() const. 2026-04-30 21:38:33 +02:00
Bartosz Taudul
529c688ff2 Callstack thread display is not gated by LLM. 2026-04-30 18:40:54 +02:00
Bartosz Taudul
af665ef3dc Update NEWS. 2026-04-30 18:13:11 +02:00
Bartosz Taudul
6c5e0cdf1d Draw call stack thread name in call stack window. 2026-04-30 18:08:15 +02:00
Bartosz Taudul
80f504019f Store callstack window callstack id together with origin thread id. 2026-04-30 17:06:59 +02:00
Bartosz Taudul
6ccad8a94d Generic thread id naming in crash callstack attachments. 2026-04-30 12:48:58 +02:00
Bartosz Taudul
f0df6112dc Move callstack summary in callstack window to its own line. 2026-04-30 12:46:22 +02:00
Bartosz Taudul
170b0b4edf More compact listing format. 2026-04-30 12:19:13 +02:00
Bartosz Taudul
39cd16a92b Move specialized LLM skills out of the system prompt. 2026-04-30 02:41:48 +02:00
Bartosz Taudul
eaf66e7af9 Cleanup. 2026-04-28 00:27:27 +02:00
Bartosz Taudul
ab75aeeac9 Add section headers to the in-program user manual. 2026-04-27 23:32:34 +02:00
Bartosz Taudul
4fe2949033 Instruct LLM how to provide user manual links. 2026-04-27 23:21:49 +02:00