Repository navigation
Runtime profiler: trace format, file/live inspectors, viewer UI - #238
Merged
Merged
Conversation
19 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a complete runtime profiling system for the Typhon engine: trace format, capture inspectors (file + live TCP stream), profiler server, and a browser-based viewer UI.
Engine-side capture
TraceEventCaptureBase— abstract per-thread SPSC ring buffer pipeline (~20-30 ns/event hot path, zero contention between worker threads)TraceFileInspector— writes to.typhon-tracebinary files with LZ4 block compression and delta-encoded timestampsTcpStreamInspector— streams the same block format over TCP with non-blocking sends (Socket.Blocking = false+SocketError.WouldBlockhandling), so the timer thread never blocks on I/O. Drops frames under backpressure rather than stalling the engineDagSchedulerinstrumented at 23 points guarded by a JIT-eliminatedTelemetryConfig.SchedulerDeepTracestatic readonly flagActivityListenerintegration captures spans from theTyphon.EngineActivitySourcewith interned name IDsWire format
.typhon-tracefiles: header + system definition table + span name table + LZ4-compressed event blocksTraceBlockEncoderis the shared encode/decode path, so file writer and TCP inspector can never driftSpawnManagerwon't collide with theSPANmarkerProfiler server (ASP.NET Core)
LiveSessionService—BackgroundServicethat connects to the engine's TCP port, decompresses frames, and fans out to SSE subscribers via boundedChannel<T>(DropOldestbackpressure).typhon-tracefiles and building flame graphs from companion.nettracefiles/api/live/eventsstreams tick batches with 5s heartbeatsViewer (Preact + TypeScript + Vite)
ClientApp/, built output inwwwroot/, MSBuild targets run npm install + vite build ondotnet buildprocessTickAndAppendfor live mode with 100ms state-update batching (~10 Hz React rerender at 60 Hz engine tick rate)Tests
TraceBlockEncoderTestsround-trip contract test: writes events throughTraceFileWriter, reads back throughTraceFileReader, verifies all fields preserved (6 tests)Test plan
dotnet build Typhon.slnx— clean builddotnet test test/Typhon.Engine.Tests— all 3,216 tests passnpx tsc --noEmitintools/Typhon.Profiler.Server/ClientApp— zero TypeScript errorsnpm run buildinClientApp— vite production build succeedsTcpStreamInspectorinto a test harness (e.g. AntHill) and verify end-to-end live streaming in the browser (follow-up — demo harness changes not in this PR)🤖 Generated with Claude Code