code wiki / (root) / nx_blkprofile.nx

nx_blkprofile.nx

buildroot/runtime/nx_blkprofile.nx

23039 B455 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_blkprofile.nx -- THE BURST PROFILER for the D-state admission witness. Rung DG1, /compare/degradation. WHY THIS EXISTS, IN THE CONF'S OWN WORDS. knowledge/build_admit.conf carries blocked_samples and blocked_gap_ms -- THE SMOOTHED WITNESS -- and leaves them DELIBERATELY UNARMED behind a written work order: "sample procs_blocked at a fixed interval for a few minutes and find the shortest span over which the median stops tracking the bursts ... Then write the sample count, the gap, and the run that produced them on this line." That derivation had never been run, so a capability the conf itself measured at roughly 42 percent of build refusals sat inert. THIS ORGAN IS THAT DERIVATION. IT REFUSES TO RECOMMEND A SPAN IT DID NOT MEASURE. Every row below is produced by replaying a REAL recorded series through the REAL median, so a recommendation here is a measurement, never a taste. IT COMPOSES THE SHIPPING RULERS AND RE-IMPLEMENTS NEITHER. ioa_measure reads /proc/stat exactly as nx_build_admit does, and ioa_median IS the median nx_build_admit applies once armed. The verdicts in the span table are therefore the verdicts THE ARMED GATE WOULD HAVE PRODUCED on this series -- not an approximation, and not a second ruler that can drift from the first. THE LATENCY COLUMN IS NOT DECORATION. The conf refuses arming until that cost is measured, because the span is paid by EVERY caller of the admission check -- the clock dispatcher's pre-dispatch call included. A span that fixes admission and stalls the dispatcher has moved the defect, not removed it. TWO TIMESCALES, TWO VERBS. `live` samples fine enough to resolve a 2-12 s burst. `jrnl` re-reads the procchurn journal the estate ALREADY writes, for the long-run base rate at zero added load -- a second reader of an old log, never a second collector. NO CLOCK IS READ. sys_time_ms is ABSENT-PROVEN in this runtime (buildroot/runtime, corpus_complete=1), so the window is reported as NOMINAL and derived from the sample count and interval. The added-latency column needs no clock either: a sampler that sleeps a span pays that span BY CONSTRUCTION.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_ioadmit_lib.nx nx_blkprofile.nx

imports: nx_syscalls.nxnx_ioadmit_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main bp_werr sys_write bp_slen sys_exit sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ ioa_measure sys_mmap ↻ rm_read sys_openat_rd sys_read sys_close ioa_ncpu rm_field rm_slen sys_munmap bp_atoi bp_slen ↻ sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read ↻ sys_munmap ↻ sys_close ↻ bp_slen ↻

structs

none

consts

33const BP_STDOUT: i64 = 1
34const BP_STDERR: i64 = 2
35const BP_OUTCAP: i64 = 262144
36const BP_MAX_SAMPLES: i64 = 8192
37const BP_SAMPLE_BYTES: i64 = 65536
38const BP_HIST_MAX: i64 = 512
39const BP_HIST_BYTES: i64 = 4096
40const BP_KBUF_BYTES: i64 = 256
41const BP_MEAS_BYTES: i64 = 64
42const BP_SIMOUT_BYTES: i64 = 64
43const BP_BOX_BYTES: i64 = 64
44const BP_UNREADABLE: i64 = 0 - 1
45const BP_EXIT_USAGE: i64 = 2
46const BP_EXIT_UNMEASURED: i64 = 3
47const BP_DEF_DUR_S: i64 = 180
48const BP_DEF_INTERVAL_MS: i64 = 200
49const BP_DEF_K: i64 = 5
50const BP_NSPANS: i64 = 8
51const BP_CONV_TOL_PERMIL: i64 = 10
52const BP_MS_PER_S: i64 = 1000
53const BP_PERMIL: i64 = 1000
54const BP_CH_MINUS: i64 = 45
55const BP_CH_0: i64 = 48
56const BP_CH_9: i64 = 57
57const BP_CH_LIVE: i64 = 108
58const BP_CH_JRNL: i64 = 106
63const BP_JRNL: *u8 = "knowledge/status/procchurn.jrnl"
64const BP_JRNL_UP: *u8 = "../knowledge/status/procchurn.jrnl"
67const BP_BLOCKED_KEY: *u8 = "blocked="

functions

69func bp_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 3: bp_werrbp_atoimain
70func bp_werr(s: *u8) -> i64 { sys_write(BP_STDERR, s, bp_slen(s)); return 0 }
called by 1: main calls 2: sys_writebp_slen
72func bp_puts(b: *u8, off: i64, s: *u8) -> i64
called by 1: main
79func bp_puti(b: *u8, off: i64, v: i64) -> i64
called by 1: main
98func bp_atoi(s: *u8) -> i64
called by 1: main calls 1: bp_slen
117func bp_span_at(i: i64) -> i64
called by 1: main
132func bp_pct(hist: *i64, n: i64, permil: i64) -> i64
called by 1: main
150func bp_sim(s: *i64, n: i64, interval_ms: i64, k: i64, span_ms: i64, bar: i64, kbuf: *i64, out: *i64) -> i64
called by 1: main calls 1: ioa_median
178func main(argc: i64, argv: *i64) -> i64