Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tools/argus/r8_leaf.awk # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / argus / r8_leaf.awk` 11 lines ยท 1028 bytes Raw Blame History 1 # Main-thread samples by leaf and caller (speed2). Input: `perf script -F event,ip,sym` of 2 # `perf record --no-inherit -g -e instructions:u,cycles -c 50000` runs. Vars: cfg, R (runs). 3 # Output: cfg, event, M events/run (period 50000), "[k] " if the leaf is kernel, leaf <- caller. 4 # blocks: header line "event:" then frames "\taddr sym (dso)". Key = [k] if leaf is kernel, then first user sym <- its caller. 5 function flush() { if (ev == "") return; key = (kern ? "[k] " : "") u1 " <- " u2; n[ev "\t" key]++; t[ev]++; ev = "" } 6 /^ *armv8/ { flush(); ev = ($1 ~ /instr/) ? "instr" : "cycles"; first = 1; kern = 0; u1 = "?"; u2 = "?"; nu = 0; next } 7 /^\t/ { a = $1; s = $2; if (first) { kern = (a ~ /^ffff/); first = 0 } 8 if (a !~ /^ffff/) { nu++; if (nu == 1) u1 = s; else if (nu == 2) u2 = s } next } 9 /^$/ { flush() } 10 END { flush(); for (k in n) { split(k, x, "\t"); printf "%s\t%s\t%.3f\t%s\n", cfg, x[1], n[k] * 50000 / R / 1e6, x[2] } 11 for (e in t) printf "%s\t%s\t%.3f\tTOTAL\n", cfg, e, t[e] * 50000 / R / 1e6 }