tiny.coz
Overview · API · Code relationships · Verification · Audit
Overview
A caller with a profile full of hot lines still has to guess which line is worth optimizing. The package answers that question by measuring what a speedup of one code region would do to the whole program's rate of progress, called causal profiling.
A program marks where its useful work completes using either one counter or a pair of counters. Bumping a named counter records a progress point. A named pair of begin and end counters whose difference gives the work in flight between them forms a latency scope.
To test a line, the runtime conducts one run of a drawn speedup for a fixed duration, called an experiment. The runtime samples which line each thread is running through the performance counters and matches each sample against the line the current experiment selected. The experiment draws a speedup for that selected line, from zero to the whole sample period. The runtime applies this speedup by holding the rest of the program back. The nanoseconds a thread is held back so that the selected line runs relatively faster form the delay. A thread whose sample lands on the selected line is credited with that delay, and every other thread waits until it has caught up to the global delay. The runtime measures the gap between the credited line and the delayed remainder. The fraction of the sample period the selected line is credited with, from zero to one, is the virtual speedup the experiment reports. Each experiment runs for a duration that doubles or halves toward a target number of progress-point deltas, followed by a cool-off period.
The runtime writes the run as a stream of JSON lines carrying startup, experiment, throughput, latency, and sampling records. Analysis reads that stream and reports, for each selected line and progress point, the program speedup measured at each virtual speedup, the slope through those points, and a support status saying how much of the curve the run covered.
The marker calls do nothing while no runtime is installed, so a program can keep them in place for builds that run without the profiler.
Definitions
Actions
Public operations.
begininstallProfilerprogressNameduninstallProfilercatchUpendpostBlockpreBlockprofilerPresentScopeinstallSamplingHandlerprogressruntimeUnavailablescope
Types and contracts
Public types and contracts.
ProfileFileCounterCounterKindExperimentRunOptionsExperimentStepOptionsExperimentStepResultRuntimeOptionsSamplerThreadRegistryProfilerRuntime
Namespaces
Public namespaces.
delayexperimentabiprofilepath_filtersignalsloaded_filessamplerprofile_fileprogress_pointsource_mapanalysisregistrydebug_infoprofilerthread
Code relationships
Direct static dependencies extracted from parsed source by semantic graph analysis.
Uses: tiny.hypothesis, tiny.sys, tiny.termtex
Used by: tiny.bench, tiny.deadalloc, tiny.deflate, tiny.machine, tiny.pretty, tiny.profiling, tiny.python, tiny.sdfii, tiny.sql, tiny.tldr, tiny.trace
Verification
No verification records are cataloged for this module in this build.
Audit
| Evidence | Value |
|---|---|
| Source | lib/coz/src/root.zig |
| Definitions | 0 of 42 documented |
| Members | 0 of 0 documented |
| Public names | 42 API, 346 indexed |
| Version | 26.7.0 |
| Revision | daab053ee433 |