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/synapse/blob/main/scripts/p65-sample-report.sh # synapse A component of the AienOS ecosystem. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `synapse / scripts / p65-sample-report.sh` 62 lines ยท 3864 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # Issue #65 Stage A: fold gdb stack samples (from p65-gdb-sample.sh) into thread-sample counts. 3 # Usage: p65-sample-report.sh 4 # Only threads whose stack contains (for example synapse_submit) are counted. 5 # Every such thread-sample gets: 6 # state : run (user code) or wait: <- when frame #0 is a 7 # system call wrapper (futex, fdatasync, pwrite, ...) 8 # phase : the callee frame directly under the anchor (where in the operation the thread is) 9 # leaf : for run samples, the leaf-most frame that names a crate or libc area. Frames from 10 # std/core and frames with crate-relative paths (src/...) are skipped so that inlined 11 # helpers are charged to the crate that called them. 12 # incl : for run samples, every crate present between frame #0 and the anchor (counted once 13 # per thread-sample), i.e. inclusive time. 14 set -euo pipefail 15 samples=$1; anchor=$2 16 awk -v anchor="$anchor" ' 17 function base(f, a,n){ sub(/:[0-9]+$/,"",f); n=split(f,a,"/"); return a[n] } 18 function crate(fn,file, a,b,n,i,c){ 19 if (file ~ /registry\/src\//) { n=split(file,a,"/"); for (i=1;i= 0) { 31 total++ 32 f0=fname[0]; st="run" 33 if (f0 ~ /^(syscall|__GI_|__libc_|__futex|futex|fsync|fdatasync|__lll|pthread_cond|__pthread|clock_nanosleep|epoll|poll|sched_yield)/ && f0 !~ /malloc|free|calloc|realloc|mem/) { 34 st="wait:" f0 35 for (i=1;i0) ? fname[ai-1] "@" base(ffile[ai-1]) : "self" 38 PS[ph " | " (st=="run" ? "run" : "wait")]++ 39 S[st]++ 40 if (st=="run") { 41 runs++ 42 lf=""; for (i=0;i