tiny.profiling.help
Defined in tiny.profiling.
API (2)
Actions
Public operations.
Values and defaults
Public values and defaults.
Source
Source: src/profiling/help.zig
zig
const std = @import("std");const pretty_usage = @import("pretty_usage");const sys = @import("sys");const Allocator = std.mem.Allocator;const profile_options = [_]pretty_usage.Option{ .{ .flags = "--suite smoke|standard|all", .summary = "Select a workload suite." }, .{ .flags = "--workload name", .summary = "Select a workload by catalog name or build step." }, .{ .flags = "--json", .summary = "Render machine-readable JSON." },};const run_options = [_]pretty_usage.Option{ .{ .flags = "--suite smoke|standard|all", .summary = "Select a workload suite." }, .{ .flags = "--workload name", .summary = "Select a workload by catalog name or build step." }, .{ .flags = "--dry-run", .summary = "Print the plan without running child build steps." }, .{ .flags = "--continue-on-failure", .summary = "Continue after a workload exits nonzero." }, .{ .flags = "--output-dir path", .summary = "Write run artifacts under a profiling output directory." }, .{ .flags = "--run-id id", .summary = "Use a stable run artifact directory name." }, .{ .flags = "--save-baseline name", .summary = "Save the completed run as a named baseline." }, .{ .flags = "--execution-scope binary|step|mixed", .summary = "Measure binaries, whole build steps, or whole steps except for workloads that require direct child configuration." }, .{ .flags = "--warmup-repeat count", .summary = "Run the prepared process 0-100 times before measurement; " ++ "warmups are unprofiled and retain only the last output artifacts.", }, .{ .flags = "--measure-repeat count", .summary = "Repeat the ordinary measured process 1-100 times. Every " ++ "measured execution retains stdout, stderr, benchmark JSONL, and " ++ "its structured receipt. Values above one conflict with host, " ++ "Tracy, or causal lanes.", }, .{ .flags = "--bench-filter fragment", .summary = "Run only suite benchmarks whose name contains the fragment." }, .{ .flags = "--interleave-seed seed", .summary = "Randomly interleave ordinary process repetitions with a " ++ "reproducible seed; requires 2+ workloads, --measure-repeat > 1, " ++ "and --continue-on-failure.", }, .{ .flags = "--capture-control-repeat count", .summary = "Measure active capture perturbation with 1-50 binary-scope " ++ "same-build control/capture pairs; requires a capture lane.", }, .{ .flags = "--capture-control-seed seed", .summary = "Set the reproducible within-pair order seed for capture controls.", }, .{ .flags = "--counters", .summary = "Wrap the selected execution scope in perf stat and summarize counters." }, .{ .flags = "--energy", .summary = "Capture repeated system hardware-domain joules and watts; " ++ "requires a supported and permitted perf energy PMU.", }, .{ .flags = "--counter-events list", .summary = "Perf stat expression; defaults to page faults plus strongly " ++ "grouped IPC and branch-miss inputs; implies --counters.", }, .{ .flags = "--counter-group-size count", .summary = "Limit events per separate perf stat workload execution; 0 keeps one execution; implies --counters." }, .{ .flags = "--counter-repeat count", .summary = "Retain and summarize repeated perf stat workload executions; " ++ "defaults to 3; implies --counters.", }, .{ .flags = "--sampled", .summary = "Wrap the selected execution scope in perf record and summarize hot symbols." }, .{ .flags = "--sampled-frequency hz", .summary = "Set the perf sampling frequency; implies --sampled.", }, .{ .flags = "--sampled-min-samples count", .summary = "Require this many samples before attribution is supported; implies --sampled.", }, .{ .flags = "--coverage", .summary = "Run benchmark binaries under kcov for source-line coverage; defaults the build to Debug." }, .{ .flags = "--causal", .summary = "Start the Coz experiment worker inside each benchmark for causal speedup evidence." }, .{ .flags = "--causal-min-time seconds", .summary = "Stretch each selected benchmark to at least this wall time so experiment rounds complete; implies --causal." }, .{ .flags = "--causal-filter fragment", .summary = "Run only suite benchmarks whose name contains the fragment; implies --causal." }, .{ .flags = "--dhat", .summary = "Build each workload's benchmark binary and run it under valgrind DHAT for heap evidence." }, .{ .flags = "--tracy", .summary = "Build direct benchmark binaries with Tracy and retain raw and summary JSONL traces." }, .{ .flags = "--trace-allocations", .summary = "Force lib/bench allocation trace events for every selected workload." }, .{ .flags = "--offcpu", .summary = "Build each workload's benchmark binary and attach an offcputime sidecar for blocked-time evidence." }, .{ .flags = "--offcpu-mode time|stacks", .summary = "Blocked-time flavor: offcputime durations or bpftrace stack counts; implies --offcpu." }, .{ .flags = "--offcpu-tool name", .summary = "Off-CPU profiler executable; implies --offcpu (defaults offcputime-bpfcc or bpftrace by mode)." }, .{ .flags = "--json", .summary = "Print the selected plan as JSON without running child build steps." },};const compare_options = [_]pretty_usage.Option{ .{ .flags = "--output path, -o path", .summary = "Write comparison JSON to a file." },};const experiment_options = [_]pretty_usage.Option{ .{ .flags = "--output-dir path", .summary = "Write experiment artifacts under a profiling output directory." }, .{ .flags = "--run-id id", .summary = "Use a stable experiment artifact directory name." }, .{ .flags = "--dry-run", .summary = "Validate and print the typed plan without building or executing variants." }, .{ .flags = "--json", .summary = "Print the validated plan for a dry run or the completed receipt." },};const iteration_options = [_]pretty_usage.Option{ .{ .flags = "--output-dir path", .summary = "Write iteration artifacts under a profiling output directory." }, .{ .flags = "--run-id id", .summary = "Use a stable iteration artifact directory name." }, .{ .flags = "--dry-run", .summary = "Validate and print the typed iteration plan without editing or building." }, .{ .flags = "--json", .summary = "Print the validated plan for a dry run or the completed receipt." },};const question_options = [_]pretty_usage.Option{ .{ .flags = "regression|latency|rss|allocation|hotspot|blocked|energy|history|build", .summary = "Select the performance question." }, .{ .flags = "--workload name", .summary = "Bind a catalog workload for run and history questions." }, .{ .flags = "--plan path", .summary = "Bind a typed experiment or iteration plan." }, .{ .flags = "--baseline name|path", .summary = "Add a compatible analysis baseline to run-based routes." }, .{ .flags = "--run-id id", .summary = "Bind the capture and follow-up artifact path." }, .{ .flags = "--json", .summary = "Render the typed route as JSON." },};const analyze_options = [_]pretty_usage.Option{ .{ .flags = "--baseline name|path", .summary = "Compare against a saved baseline, manifest, results stream, or run directory." }, .{ .flags = "--threshold percent", .summary = "Report wall, metric, memory, and priority regressions above a percent threshold." }, .{ .flags = "--top count", .summary = "Limit slowest and memory-heavy rankings." }, .{ .flags = "--json", .summary = "Render machine-readable JSON." },};const memory_options = [_]pretty_usage.Option{ .{ .flags = "--top count", .summary = "Limit workload, memory metric, and scope rows." }, .{ .flags = "--min-bytes count", .summary = "Hide memtrace scopes below this retained/live byte floor." }, .{ .flags = "--json", .summary = "Render machine-readable JSON." },};const cycle_options = [_]pretty_usage.Option{ .{ .flags = "--suite smoke|standard|all", .summary = "Select the workload suite for this cycle." }, .{ .flags = "--workload name", .summary = "Cycle only the named workloads instead of a whole suite." }, .{ .flags = "--baseline name", .summary = "Rolling baseline pointer to compare against and rotate." }, .{ .flags = "--output-dir path", .summary = "Write cycle run artifacts under a profiling output directory." }, .{ .flags = "--keep count", .summary = "Retain at most this many cycle run directories." }, .{ .flags = "--threshold percent", .summary = "Report regressions above a percent threshold." }, .{ .flags = "--top count", .summary = "Limit ranking rows in the written analysis." }, .{ .flags = "--execution-scope binary|step|mixed", .summary = "Measure binaries, whole build steps, or direct-configured workloads within an otherwise whole-step cycle; cycle defaults to binary." }, .{ .flags = "--warmup-repeat count", .summary = "Run each prepared process 0-100 unprofiled times before measurement.", }, .{ .flags = "--measure-repeat count", .summary = "Repeat each ordinary measured process 1-100 times. Every " ++ "measured execution retains stdout, stderr, benchmark JSONL, and " ++ "its structured receipt. Values above one conflict with host " ++ "capture lanes.", }, .{ .flags = "--interleave-seed seed", .summary = "Randomly interleave ordinary process repetitions with a " ++ "reproducible seed; requires 2+ workloads, --measure-repeat > 1, " ++ "and completion-on-failure.", }, .{ .flags = "--capture-control-repeat count", .summary = "Measure active host-capture perturbation with 1-50 " ++ "binary-scope same-build control/capture pairs.", }, .{ .flags = "--capture-control-seed seed", .summary = "Set the reproducible within-pair order seed for capture controls.", }, .{ .flags = "--counters", .summary = "Wrap the selected execution scope in perf stat and summarize counters." }, .{ .flags = "--energy", .summary = "Capture repeated system hardware-domain joules and watts; " ++ "requires a supported and permitted perf energy PMU.", }, .{ .flags = "--counter-events list", .summary = "Perf stat expression; defaults to page faults plus strongly " ++ "grouped IPC and branch-miss inputs; implies --counters.", }, .{ .flags = "--counter-group-size count", .summary = "Limit events per separate perf stat workload execution; 0 keeps one execution; implies --counters." }, .{ .flags = "--counter-repeat count", .summary = "Retain and summarize repeated perf stat workload executions; " ++ "defaults to 3; implies --counters.", }, .{ .flags = "--sampled", .summary = "Wrap the selected execution scope in perf record and summarize hot symbols." }, .{ .flags = "--sampled-frequency hz", .summary = "Set the perf sampling frequency; implies --sampled.", }, .{ .flags = "--sampled-min-samples count", .summary = "Require this many samples before attribution is supported; implies --sampled.", }, .{ .flags = "--stop-on-failure", .summary = "Stop at the first failing workload instead of completing the suite." },};const baseline_options = [_]pretty_usage.Option{ .{ .flags = "save name run", .summary = "Save a run directory, manifest, or results stream as a named baseline." }, .{ .flags = "show name|path", .summary = "Resolve and print a baseline or run reference." }, .{ .flags = "list", .summary = "List saved profiling baselines." }, .{ .flags = "delete name", .summary = "Delete a saved profiling baseline." }, .{ .flags = "prune --keep-last N [--older-than 14d] [--dry-run]", .summary = "Prune saved baseline pointers by age or count." },};const check_options = [_]pretty_usage.Option{ .{ .flags = "package", .summary = "Check root registration and profiling steps for this package." }, .{ .flags = "--all", .summary = "Check root registration and profiling steps for every package." }, .{ .flags = "--json", .summary = "Render machine-readable JSON." },};const code_layout_options = [_]pretty_usage.Option{ .{ .flags = "--json", .summary = "Render machine-readable JSON." },};const web_options = [_]pretty_usage.Option{ .{ .flags = "--profiling-dir path", .summary = "Read run artifacts from a profiling output directory." }, .{ .flags = "--output path", .summary = "Write the static site to this directory instead of <profiling-dir>/site." }, .{ .flags = "--serve", .summary = "Serve the site over HTTP and regenerate when new runs land." }, .{ .flags = "--port n", .summary = "Listen on this port in serve mode (default 8787)." }, .{ .flags = "--address host", .summary = "Bind this address in serve mode (default 127.0.0.1)." }, .{ .flags = "--json", .summary = "Render machine-readable JSON." },};const plan_help = pretty_usage.Help{ .name = "tiny-profile-tests plan", .summary = "Print the selected monorepo profiling plan.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "plan [options]" } }, .{ .build = .{ .step = "profile-plan", .args = "[options]" } }, }, .options = profile_options[0..],};const catalog_help = pretty_usage.Help{ .name = "tiny-profile-tests catalog", .summary = "Print every registered profiling workload.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "catalog [--json]" } }, .{ .build = .{ .step = "profile-catalog", .args = "[--json]" } }, }, .options = &.{ .{ .flags = "--json", .summary = "Render machine-readable JSON." }, },};const run_help = pretty_usage.Help{ .name = "tiny-profile-tests run", .summary = "Run selected profiling workloads through package-owned build steps.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "run [options] [-- forwarded args]" } }, .{ .build = .{ .step = "profile-run", .args = "[options] [-- forwarded args]" } }, }, .options = run_options[0..],};const compare_help = pretty_usage.Help{ .name = "tiny-profile-tests compare", .summary = "Compare two profile summary artifacts using lib/capture evidence.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "compare BASE SUMMARY [--output path]" } }, .{ .build = .{ .step = "profile-compare", .args = "BASE SUMMARY [--output path]" } }, }, .options = compare_options[0..],};const experiment_help = pretty_usage.Help{ .name = "tiny-profile-tests experiment", .summary = "Run a resettable paired baseline/candidate experiment from a typed plan.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "experiment PLAN [options]" } }, .{ .build = .{ .step = "profile-experiment", .args = "PLAN [options]" } }, }, .options = experiment_options[0..],};const iteration_help = pretty_usage.Help{ .name = "tiny-profile-tests iteration", .summary = "Probe resident edit iteration against an isolated clean build.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "iteration PLAN [options]" } }, .{ .build = .{ .step = "profile-iteration", .args = "PLAN [options]" } }, }, .options = iteration_options[0..],};const question_help = pretty_usage.Help{ .name = "tiny-profile-tests question", .summary = "Route a performance question to the owning evidence collector.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "question KIND [options]" } }, .{ .build = .{ .step = "profile-question", .args = "KIND [options]" } }, }, .options = question_options[0..],};const analyze_help = pretty_usage.Help{ .name = "tiny-profile-tests analyze", .summary = "Analyze a captured monorepo profiling run.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "analyze RUN [options]" } }, .{ .build = .{ .step = "profile-analyze", .args = "RUN [options]" } }, }, .options = analyze_options[0..],};const memory_help = pretty_usage.Help{ .name = "tiny-profile-tests memory", .summary = "Report memory accountability for a captured profiling run.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "memory RUN [options]" } }, .{ .build = .{ .step = "profile-memory", .args = "RUN [options]" } }, }, .options = memory_options[0..],};const cycle_help = pretty_usage.Help{ .name = "tiny-profile-tests cycle", .summary = "Run one rolling profiling cycle: run the suite, analyze against the previous cycle, rotate the baseline, prune old cycle runs.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "cycle [options] [-- forwarded args]" } }, .{ .build = .{ .step = "profile-cycle", .args = "[options] [-- forwarded args]" } }, }, .options = cycle_options[0..],};const baseline_help = pretty_usage.Help{ .name = "tiny-profile-tests baseline", .summary = "Save or resolve profiling run baselines.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "baseline save NAME RUN" } }, .{ .command = .{ .name = "tiny-profile-tests", .args = "baseline show NAME" } }, .{ .command = .{ .name = "tiny-profile-tests", .args = "baseline list" } }, .{ .command = .{ .name = "tiny-profile-tests", .args = "baseline delete NAME" } }, .{ .command = .{ .name = "tiny-profile-tests", .args = "baseline prune --keep-last N [--older-than 14d] [--dry-run]" } }, .{ .build = .{ .step = "profile-baseline", .args = "save NAME RUN" } }, }, .options = baseline_options[0..],};const check_help = pretty_usage.Help{ .name = "tiny-profile-tests check", .summary = "Check the static catalog against selected package profiling build steps.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "check PACKAGE [--json]" } }, .{ .command = .{ .name = "tiny-profile-tests", .args = "check --all [--json]" } }, .{ .build = .{ .step = "profile-check", .args = "PACKAGE [--json]" } }, .{ .build = .{ .step = "profile-check-all", .args = "[--json]" } }, }, .options = check_options[0..],};const code_layout_help = pretty_usage.Help{ .name = "tiny-profile-tests code-layout", .summary = "Fingerprint executable ELF sections without build metadata.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "code-layout BINARY... [--json]" } }, .{ .build = .{ .step = "profile-tests", .args = "code-layout BINARY... [--json]" } }, }, .options = code_layout_options[0..],};const recovery_options = [_]pretty_usage.Option{ .{ .flags = "--slo-ms count", .summary = "Set the approved process-cold recovery SLO." }, .{ .flags = "--project-file label=operation:path", .summary = "Add one file to a named store projection." }, .{ .flags = "--project-bytes label=operation:count", .summary = "Add explicit bytes to a named store projection." }, .{ .flags = "--json", .summary = "Render machine-readable capacity evidence." },};const recovery_help = pretty_usage.Help{ .name = "tiny-profile-tests recovery", .summary = "Derive bounded recovery capacities and reject unsafe store growth.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "recovery CURVES --slo-ms COUNT [options]" } }, .{ .build = .{ .step = "profile-tests", .args = "recovery CURVES --slo-ms COUNT [options]" } }, }, .options = recovery_options[0..],};const web_help = pretty_usage.Help{ .name = "tiny-profile-tests web", .summary = "Generate the static profiling web viewer from recorded run artifacts.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "web [options]" } }, .{ .build = .{ .step = "profile-web", .args = "[options]" } }, }, .options = web_options[0..],};pub const help = pretty_usage.Help{ .name = "tiny-profile-tests", .summary = "Plan, run, analyze, and compare monorepo profiling workloads.", .usages = &.{ .{ .command = .{ .name = "tiny-profile-tests", .args = "<command> [args]" } }, .{ .build = .{ .step = "profile-tests", .args = "<command> [args]" } }, }, .groups = &.{ .{ .title = "Profiling", .commands = &.{ .{ .name = "plan", .summary = "Print a suite plan.", .detail = &plan_help }, .{ .name = "catalog", .summary = "Print the registered workload catalog.", .detail = &catalog_help }, .{ .name = "run", .summary = "Run selected workload steps.", .detail = &run_help }, .{ .name = "experiment", .summary = "Compare two immutable variants.", .detail = &experiment_help }, .{ .name = "iteration", .summary = "Verify one resident edit/revert lane.", .detail = &iteration_help }, .{ .name = "question", .summary = "Route a performance question.", .detail = &question_help }, .{ .name = "cycle", .summary = "Run a rolling baseline cycle.", .detail = &cycle_help }, .{ .name = "analyze", .summary = "Analyze captured run artifacts.", .detail = &analyze_help }, .{ .name = "memory", .summary = "Report memory accountability.", .detail = &memory_help }, .{ .name = "baseline", .summary = "Save and resolve run baselines.", .detail = &baseline_help }, .{ .name = "check", .summary = "Check catalog drift.", .detail = &check_help }, .{ .name = "code-layout", .summary = "Fingerprint executable code layout.", .detail = &code_layout_help }, .{ .name = "recovery", .summary = "Derive recovery capacity gates.", .detail = &recovery_help }, .{ .name = "compare", .summary = "Compare profile summaries.", .detail = &compare_help }, .{ .name = "web", .summary = "Generate the static web viewer.", .detail = &web_help }, } }, }, .examples = &.{ .{ .command = "zig build profile-plan -- --suite standard", .summary = "Inspect the default suite." }, .{ .command = "zig build profile-run -- --suite smoke --save-baseline main-smoke", .summary = "Run the smoke profiling lane and save a baseline." }, .{ .command = "zig build profile-experiment -- experiment.json", .summary = "Run a paired experiment and save its audit receipt." }, .{ .command = "zig build profile-iteration -- iteration.json", .summary = "Verify a semantic edit, clean equivalence, and exact revert." }, .{ .command = "zig build profile-question -- hotspot --workload gpalloc.allocator", .summary = "Select the supported hotspot collection lane." }, .{ .command = "zig build profile-cycle", .summary = "Run one rolling smoke cycle against the previous cycle." }, .{ .command = "zig build profile-analyze -- zig-out/profiling/run-id --baseline main-smoke", .summary = "Analyze a run against a saved baseline." }, .{ .command = "zig build profile-run -- --workload gpalloc.allocator --trace-allocations", .summary = "Capture allocation events for a memory report." }, .{ .command = "zig build profile-memory -- zig-out/profiling/run-id", .summary = "Summarize memory accountability for a captured run." }, .{ .command = "zig build profile-tests -- compare base.summary.json candidate.summary.json", .summary = "Compare two captured summaries." }, .{ .command = "zig build profile-tests -- code-layout zig-out/bin/bench --json", .summary = "Fingerprint executable code sections." }, .{ .command = "zig build profile-web", .summary = "Generate the web viewer and print the index path." }, .{ .command = "zig build profile-web -- --serve", .summary = "Serve the web viewer locally and refresh as runs land." }, },};pub fn writeCommandHelp(allocator: Allocator, args: []const []const u8) !u8 { var stdout_buffer: [8192]u8 = undefined; var stdout_writer = sys.stdio.stdout().writer(std.Options.debug_io, &stdout_buffer); defer stdout_writer.interface.flush() catch {}; var stderr_buffer: [8192]u8 = undefined; var stderr_writer = sys.stdio.stderr().writer(std.Options.debug_io, &stderr_buffer); defer stderr_writer.interface.flush() catch {}; return try pretty_usage.writeCommandPathHelpOrError( allocator, &stdout_writer.interface, &stderr_writer.interface, help, args, .{ .layout = .{ .width = 88 }, .suggestions = .{ .enabled = true }, .parent_fallback_help = true, }, );}Source: src/profiling/root.zig:17
zig
pub const help = @import("help.zig");Audit
| Definitions | 3 |
|---|---|
| Public names | 3 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |