|
Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
|
Русская версия · Measurement tools
These contributor tools exercise bounded document viewing and verify generated source windows. Build the test-only targets described in the measurement guide. Python 3.8+ with its standard library is needed for the generator and contract driver; Python is not an SDK dependency. MiB means 1,048,576 bytes; all reported *_ns durations use nanoseconds. No measurement result or cross-size performance guarantee is established by the commands on this page.
document_corpus.py writes deterministic UTF-8 SQL or Markdown bytes in bounded buffers. Repeated 256-byte units include a decimal marker for each logical MiB. An optional long first line precedes the repeated units. The manifest records logical and physical extents, SHA-256 hashes, the pattern and generator hash. Gzip uses level 1 and timestamp zero.
Choose a new output name on each generation; existing files are rejected. For gzip, add --gzip to generation and --kind gzip to both probes, using a build with gzip enabled. For Markdown, generate --format markdown, select UI --language markdown, and use oracle --pattern markdown.
| Generator argument | Meaning and bounds | Default |
|---|---|---|
| --output PATH | New data file; parent must exist, output and PATH.manifest.json must be absent | Required |
| --size-mib N | Exact logical size, 1–8192 MiB | 16 |
| --format sql\|markdown | Known source pattern | sql |
| --long-line-mib N | First-line length including newline, 0–size-mib; zero disables | 0 |
| --gzip | Compress generated bytes; logical size remains the same | Off |
| --help | Show help without destination or generation | Off |
Generation requires free space for the logical size plus 64 MiB, including gzip runs. It creates only the selected data file and adjacent manifest, prints the manifest JSON to stdout, and removes this run's partial files on a reported generation/I/O failure. Exit 0 means success/help, 2 means invalid arguments or preflight rejection, and 1 means generation/I/O failure. Inputs, OS caches and settings are not changed.
document_ui.cpp runs the production managed scene, scheduler and background executor. One cold descriptor, one byte source and one SourceBudget root serve all visible viewers. The total viewport is 120×40 cells: one full view or four 60×20 quadrants. The headless sink counts and discards output; no native window, physical display acknowledgement or retained terminal transcript is involved.
| UI argument | Meaning and bounds | Default |
|---|---|---|
| --file PATH | Existing regular file; owned literal UTF-8 path without home/environment expansion | Required except with --idle |
| --kind plain\|gzip | Raw or decompressed source bytes | plain |
| --language plain\|mysql\|markdown | Text/highlight profile | plain |
| --views N | 1 or 4 visible viewers | 1 |
| --budget-mib N | Shared source credit limit, 1–4096 MiB; excludes unrelated process allocations | 128 |
| --timeout-ms N | Whole-workload deadline, 1–3,600,000 ms | 60,000 |
| --samples N | Retained prefix samples per measured phase, 1–1,000,000 | 8192 |
| --tail-work-turns N | Managed text-tail quanta per job, 1–255; 1 disables batching | 32 |
| --idle | Same Application facade with no DocumentViews, for a separate memory baseline run | Off |
| --help | Show help without file I/O, Application construction or terminal work | Off |
The finite plan contains initial preparation, row and page scrolling, Home, byte 4096, End, bytes immediately before/at/after 4 GiB, and Home again. Targets outside a known extent, or targets whose extent is unknown, are skipped. The report distinguishes planned, started, observed, completed and skipped stages. Views of stages never observed have an empty views array. Requests use checked viewer references between prepared frames. Gzip End may discover the logical extent by reading the archive; a cold compressed seek can replay a long prefix.
first_accepted_output_frame_ns can describe a loading frame. initial_text_ready_observed_ns is a scheduler-timer observation after initial text readiness; it is not the time of the first rendered content frame. initial_text_ready_observation_uncertainty_ns records its observation gap. Per-stage first_output_frame_observed_ns and settled_ns are also timer observations. Unreached times are null. The observer reports the actual Application phases; the API exposes no separate UI_TASK phase.
Phase and timer distributions report count, retained prefix and overflow. p50_ns and p95_ns use nearest-rank percentiles only when the set is nonempty and no sample was discarded. Otherwise valid is false and percentiles are null. The timer's lateness describes scheduler responsiveness; independent memory-sampler ticks do not establish UI responsiveness.
Provider counters distinguish logical admitted bytes from physical provider bytes and report UI-thread I/O violations. Memory snapshots distinguish current process memory, OS lifetime peaks and sampled maxima. Windows private memory is process commit; resident memory is working set. Linux resident values use RSS and HWM; private commit fields are unavailable and remain null. Source-budget peaks are sampled rather than instrumented allocation maxima. The root's own metadata remains charged while it lives: cleanup separately reports returned credits, page/work/consumer counts and actual root destruction.
The probe prints bounded JSON to stdout and diagnostics to stderr. It never changes the input or creates result files. Exit 0 means complete/help, 2 means invalid CLI/input or unavailable requested gzip support, and 1 means incomplete execution, timeout or runtime failure. Inspect complete, workload_failed, stage observations and errors together with the exit status.
The JSON records preparation_quantum_bytes and tail_work_turns for the actual tested policy.
document_oracle.cpp uses internal worker preparation to compare returned text with the generator's position-dependent bytes and source maps with a sequential lexical oracle. It checks target-window coverage and EOF; explicit EXACT recovery must produce exact source-qualified roles. This executable does not run an Application event loop or render terminal pixels. Four view states retain separate windows on the same source/root; their preparations run serially on a worker.
| Oracle argument | Meaning and bounds | Default |
|---|---|---|
| --file PATH | Generated fixture; use matching pattern, logical size and first-line size | Required except with --check |
| --kind plain\|gzip | Raw or gzip fixture | plain |
| --pattern sql\|markdown | Generator pattern used by the byte/role oracle | sql |
| --size-mib N | Expected logical extent, 1–8192 MiB | 1 |
| --long-line-mib N | Generated first-line size, 0–size-mib MiB | 0 |
| --views N | 1 or 4 retained worker view states | 1 |
| --evictions N | Additional distinct anchors for retained-checkpoint cycles, 0–64; not a proven eviction count | 40 |
| --timeout-ms N | Whole worker-operation deadline, 1–1,800,000 ms | 60,000 |
| --exact | Add explicit EXACT recovery at the middle anchor after earlier stages | Off |
| --check | Run four negative navigation/EXACT contract checks without files | Off |
| --help | Show help without inputs | Off |
The shared credit limit is fixed at 128 MiB. AUTO may stop with readable preview colors after its bounded refinement budget. A preview frame is not evidence of globally exact syntax. The report separates terminal syntax state from retained frame state when AUTO finishes without publishing a new frame. Exact source maps are checked where exactness is claimed; --exact is a separate request that may scan the entire prefix or reuse checkpoints from earlier stages. It is not a guaranteed cold-prefix benchmark or a check of every document byte. With a 1024 MiB file consisting of one 1024 MiB line, this anchor is inside the line at 512 MiB. The UI probe uses AUTO and does not perform this recovery as a condition of ordinary seeking.
JSON includes worker first-frame/settled times, turns, verified text bytes, source-map counts, exact-map counts, color mismatches, admission counters, sampled source budget, process memory and cleanup. Its first_frame_ns is a worker preparation measurement, with a different boundary from UI output timing. Exit 0 means complete/help/check, 2 means invalid CLI or unavailable gzip support, and 1 means timeout, runtime or oracle failure. A missing file fails during runtime provider access. No input changes, output files or cache flushing occur.
test_document_probes.py requires --ui-exe PATH and --oracle-exe PATH; --gzip additionally enables gzip binary contracts (off by default). --help requires neither executable and runs no tests. It uses temporary small fixtures and finite child-process timeouts, checks help, invalid CLI, Unicode paths, one/four views, cleanup, sample overflow, deadline, AUTO preview and oracle failures, and removes its temporary files/processes. Exit 0 means the checks passed, 1 means a check failed, and 2 means invalid CLI or missing executables. It creates no persistent receipt files.
Run large qualification matrices separately from per-commit regressions. Use separate probe processes for repetitions, preserve their stdout/stderr and input manifests, and record revision, compiler, configuration, platform, kind, language, view count, budget and deadline. Compare idle and loaded runs with the same instrumentation settings. A new process does not prove cold OS file-cache state: these tools neither flush caches nor alter global settings. Source credits, process memory, accepted output and physical display remain separate quantities.