luvcraft/frame-performance.lisp
One body serves sampled and unsampled frames. Besides making the
semantic guarantee obvious, this keeps a large render pass from
appearing twice in the compiler IR at every timing boundary.
Tracy watches the same frame path live, where the sample struct above watches a fixed batch of frames and prints the result. The two are meant to answer different questions: the benchmark says whether a change moved the numbers, and Tracy says where a frame that felt wrong actually went.
Start Tracy for luvcraft and answer whether the profiler is running.
Nothing is recorded until a viewer connects, so this is safe to leave on. Call it before starting a session if you want the production workers to appear under their own names: a thread can only introduce itself to a profiler that is already running, and luvcraft's workers introduce themselves as they start.
Whether Luvcraft's capture is starting, recording, or freezing its trace.
Publish an asynchronous capture start and return its reserved pathname.
Publish one graceful stop without waiting for trace finalization.
Atomically start or stop Luvcraft's one Tracy capture generation.
Open pathname or Luvcraft's last frozen trace without blocking the caller.
Reveal pathname or Luvcraft's last frozen trace without blocking the caller.
Terminally detach Luvcraft's current controller without waiting on it.
Detachment is atomic and precedes release, so a later game session obtains a fresh controller even while the prior capture finishes on its owner thread.
Describe luvcraft's plots to a viewer, once per connection.
Plot configuration reaches only a viewer that is already listening, and a capture may begin at any frame, so the description is re-sent on each fresh connection rather than once at startup.
A capture launched from F9 initializes Tracy on its control worker. Name the actual rendering lane when it first observes that viewer rather than leaving the control worker called main.
Return median, p95, mean, and maximum milliseconds over samples.
Return the median, p95, mean, and maximum milliseconds for reader.
Return measured samples up to streaming settlement, or all when unsettled.
Print a bounded human-readable summary of benchmark.
note: completion-limited time is submit-to-shared-event wall time, ~ not a GPU timestamp.~%
Write every benchmark sample as stable, comparison-friendly CSV.
(name-and-options &body slot-descriptions)Define an ordinary structure whose annotated slots publish quantity meaning. The runtime representation and accessors are still those of DEFSTRUCT. #FLRFU8
((sample accessor zone) &body body)Sample a two-dimensional texture through a sampler at a UV coordinate.
(specification &body body)Measure BODY with concise ambient zone syntax. SPECIFICATION is either a zone name or (NAME :VALUE FORM). This is the ordinary spelling for a meaningful region inside a definition; ZDEFUN and ZDEFMETHOD cover whole definitions.
((name &key (tracy-value nil tracy-value-supplied-p)) &body body)Measure BODY as nested zone NAME for whichever measurement is watching. TRACY-VALUE, when supplied, is attached to the Tracy zone at exit. It does not affect the bounded CPU trace, whose zones retain time and runtime costs. Two independent things may be: a Tracy viewer attached to this image, and an opt-in…
Logical conjunction of tests and raw truth values.
Division of two represented quantities.
Subtraction or unary negation.
The per-frame counts luvcraft draws alongside its Tracy zones.
Whether the connected viewer has been told how to draw luvcraft's plots.
()Start Tracy for luvcraft and answer whether the profiler is running. Nothing is recorded until a viewer connects, so this is safe to leave on. Call it before starting a session if you want the production workers to appear under their own names: a thread can only introduce itself to a profiler that is already running,…
(&key (application-name "luv"))Load the Tracy client, start the profiler, and answer whether it is running. The client collects on demand, so starting it does not begin a capture: it makes this image discoverable, and zones start recording when a viewer connects. Leaving it started is the intended state for a durable image.
True while this image is offering zones to a Tracy viewer.
The shared subprocess owner for this Lisp application's captures.
(&key application-name directory
(runtime (make-instance 'native-tracy-capture-runtime))
(open-on-completion-p t)
(graceful-stop-seconds 5.0d0))Logical disjunction of tests and raw truth values.
(controller)(controller)(controller)(controller)Request one graceful stop and return immediately. Concurrent and repeated calls publish only one interrupt for a generation.
(controller)(&optional pathname)(controller &optional pathname)(&optional pathname)(controller &optional pathname)()Terminally detach Luvcraft's current controller without waiting on it. Detachment is atomic and precedes release, so a later game session obtains a fresh controller even while the prior capture finishes on its owner thread.
(controller)Detach CONTROLLER immediately and asynchronously stop its owned capture. This operation is terminal and idempotent. It never waits for capture finalization or for a profiler window.
()Describe luvcraft's plots to a viewer, once per connection. Plot configuration reaches only a viewer that is already listening, and a capture may begin at any frame, so the description is re-sent on each fresh connection rather than once at startup.
Logical negation of one test or raw truth value.
(name)Name the calling thread in Tracy's timeline, if the profiler is running. Worker threads are worth naming as they start: an unnamed thread still gets a lane, but the lane is a thread id rather than a job. A thread that starts before START-TRACY keeps the anonymous lane, so start Tracy before the session whose threads…
(name &key (format :number) (step t) (fill nil) (color 0))Describe how the viewer should draw plot NAME. STEP suits a quantity that holds its value between changes, such as a count of resident chunks, rather than one that is sampled continuously.
(samples reader)Multiplication and scalar scaling.
Test whether one compatible scalar is less than another.
The minimum of compatible quantities.
The maximum of compatible quantities.
Addition over compatible quantities.
(benchmark reader)(benchmark &optional (stream *standard-output*))Test whether one compatible scalar is greater than another.
(benchmark pathname)
Small, explicit measurements of the actual luvcraft frame path.