lib/tracy/src/root.zig

daab053ee43316e1809a84551d573ddd1e5bf3d2

  1 //! The package instruments a running program, writes what it observes as a
  2 //! trace, and analyzes those traces afterwards. A caller wants timing from
  3 //! inside a running program, including from a program that must keep running
  4 //! long past the point where a full trace would be too large to keep.
  5 //!
  6 //! A call opens a named region of a thread's execution, closed by the returned
  7 //! value's `end`, as a *zone*. Another call ends one frame of a repeating
  8 //! workload as a *frame mark*. A call samples a named numeric series over time
  9 //! as a *plot*, with further calls reporting locks, GPU spans, fibers, context
 10 //! switches, memory operations, and messages. With `build_options.enabled` set
 11 //! to false, each of those calls answers immediately with an empty value, so a
 12 //! build that leaves the call sites in place carries no tracing work.
 13 //!
 14 //! An active runtime writes its events to a `std.Io.Writer` the caller passes
 15 //! to `start`, and this sequence of events is the *trace stream*. A ring buffer
 16 //! standing in for that writer is a *flight recorder*: it takes fixed caller
 17 //! buffers, keeps the most recent events, and writes the retained ones out on
 18 //! demand when asked for a snapshot. The *overflow policy* decides what a full
 19 //! recorder does with a new event, either overwrite the oldest event or stop
 20 //! accepting. A snapshot answers with a report counting the events observed,
 21 //! stored, retained, overwritten, dropped, and oversized. A caller halts the
 22 //! runtime with `stop` before taking a snapshot or resetting a recorder, which
 23 //! leaves the ring holding whole events.
 24 //!
 25 //! The analyzer reads a captured stream and reports summaries, frames against a
 26 //! budget, flame graphs, and comparisons between two captures.
 27 
 28 const build_options = @import("build_options");
 29 const allocator_mod = @import("allocator.zig");
 30 const capture_mod = @import("capture.zig");
 31 const event_mod = @import("event.zig");
 32 const flight_mod = @import("flight.zig");
 33 const frame_mod = @import("frame.zig");
 34 const instrumentation = @import("instrumentation.zig");
 35 const runtime = @import("runtime.zig");
 36 const transport_mod = @import("transport.zig");
 37 
 38 pub const TracedAllocator = allocator_mod.TracedAllocator;
 39 pub const cli = @import("cli/root.zig");
 40 pub const compare = @import("compare.zig");
 41 pub const capture = capture_mod;
 42 pub const context = @import("context.zig");
 43 pub const csv = @import("csv.zig");
 44 pub const event = event_mod;
 45 pub const File = @import("file.zig").File;
 46 pub const flight = flight_mod;
 47 pub const fibers = @import("fiber.zig");
 48 pub const find = @import("find.zig");
 49 pub const flame = @import("flame.zig");
 50 pub const frame = frame_mod;
 51 pub const gpu = @import("gpu.zig");
 52 pub const locks = @import("lock.zig");
 53 pub const memory = @import("memory.zig");
 54 pub const messages = @import("message.zig");
 55 pub const plots = @import("plot.zig");
 56 pub const record = @import("record.zig");
 57 pub const report = @import("report.zig");
 58 pub const samples = @import("sample.zig");
 59 pub const source = @import("source.zig");
 60 pub const stats = @import("stats.zig");
 61 pub const summary = @import("summary.zig");
 62 pub const system = @import("system.zig");
 63 pub const timeline = @import("timeline.zig");
 64 pub const tree = @import("tree.zig");
 65 pub const transport = transport_mod;
 66 
 67 pub const enabled = build_options.enabled;
 68 pub const FlightOverflowPolicy = transport_mod.OverflowPolicy;
 69 pub const FlightRecorder = flight_mod.FlightRecorder;
 70 pub const FlightReport = transport_mod.Report;
 71 pub const ContextSwitchOptions = runtime.ContextSwitchOptions;
 72 pub const Fiber = runtime.Fiber;
 73 pub const GpuContext = runtime.GpuContext;
 74 pub const GpuContextOptions = runtime.GpuContextOptions;
 75 pub const GpuContextType = runtime.GpuContextType;
 76 pub const GpuZone = runtime.GpuZone;
 77 pub const CpuTopology = runtime.CpuTopology;
 78 pub const HardwareSampleKind = runtime.HardwareSampleKind;
 79 pub const Lock = runtime.Lock;
 80 pub const PlotConfig = runtime.PlotConfig;
 81 pub const PlotUnit = runtime.PlotUnit;
 82 pub const SampleFrame = runtime.SampleFrame;
 83 pub const SampleKind = runtime.SampleKind;
 84 pub const StartOptions = runtime.StartOptions;
 85 pub const ThreadWakeupOptions = runtime.ThreadWakeupOptions;
 86 pub const Zone = runtime.Zone;
 87 
 88 pub const start = instrumentation.start;
 89 pub const stop = instrumentation.stop;
 90 pub const tracedAllocator = instrumentation.tracedAllocator;
 91 pub const namedAllocator = instrumentation.namedAllocator;
 92 pub const zone = instrumentation.zone;
 93 pub const zoneAt = instrumentation.zoneAt;
 94 pub const zoneColor = instrumentation.zoneColor;
 95 pub const zoneColorAt = instrumentation.zoneColorAt;
 96 pub const lockable = instrumentation.lockable;
 97 pub const lockableAt = instrumentation.lockableAt;
 98 pub const sharedLockable = instrumentation.sharedLockable;
 99 pub const sharedLockableAt = instrumentation.sharedLockableAt;
100 pub const frameMark = instrumentation.frameMark;
101 pub const frameMarkNamed = instrumentation.frameMarkNamed;
102 pub const sample = instrumentation.sample;
103 pub const sampleKind = instrumentation.sampleKind;
104 pub const sampleWeighted = instrumentation.sampleWeighted;
105 pub const sampleStack = instrumentation.sampleStack;
106 pub const sampleStackWeighted = instrumentation.sampleStackWeighted;
107 pub const newFiber = instrumentation.newFiber;
108 pub const newFiberHint = instrumentation.newFiberHint;
109 pub const newFiberNamed = instrumentation.newFiberNamed;
110 pub const newFiberNamedHint = instrumentation.newFiberNamedHint;
111 pub const gpuContext = instrumentation.gpuContext;
112 pub const contextSwitch = instrumentation.contextSwitch;
113 pub const threadWakeup = instrumentation.threadWakeup;
114 pub const threadContext = instrumentation.threadContext;
115 pub const threadPid = instrumentation.threadPid;
116 pub const cpuTopology = instrumentation.cpuTopology;
117 pub const systemTime = instrumentation.systemTime;
118 pub const systemPower = instrumentation.systemPower;
119 pub const hardwareSample = instrumentation.hardwareSample;
120 pub const message = instrumentation.message;
121 pub const appInfo = instrumentation.appInfo;
122 pub const plotConfig = instrumentation.plotConfig;
123 pub const plot = instrumentation.plot;
124 pub const plotFloat = instrumentation.plotFloat;
125 pub const plotInt = instrumentation.plotInt;
126 pub const alloc = instrumentation.alloc;
127 pub const allocNamed = instrumentation.allocNamed;
128 pub const free = instrumentation.free;
129 pub const freeNamed = instrumentation.freeNamed;
130 pub const freeSized = instrumentation.freeSized;
131 pub const freeSizedNamed = instrumentation.freeSizedNamed;
132 pub const setThreadName = instrumentation.setThreadName;
133 pub const isConnected = instrumentation.isConnected;