Created
March 29, 2023 08:09
-
-
Save wkz/5cad71d7a823cd9c495ac8eaf89be478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
usage() | |
{ | |
cat <<EOF | |
usage: $0 [-h] [-a <period>] | |
Measure bridge ingress times. Without -a, print each packet's ingress | |
time. With -a, aggregate data in <period> sized buckets (in | |
nanoseconds). | |
EOF | |
} | |
case $(uname -m) in | |
*64) | |
ptrsz=8 | |
;; | |
*) | |
ptrsz=4 | |
;; | |
esac | |
while getopts "a:h" opt; do | |
case ${opt} in | |
a) | |
agg=$OPTARG | |
;; | |
h) | |
usage | |
exit | |
;; | |
esac | |
done | |
shift $((OPTIND - 1)) | |
ply " | |
k:br_handle_frame | |
{ | |
in[mem(arg0, $ptrsz)] = time; | |
} | |
k:br_pass_frame_up / in[arg0] / | |
{ | |
`[ \"$agg\" ] || echo \"print(time - in[arg0]);\"` | |
`[ \"$agg\" ] && echo \"@[(time - in[arg0]) / $agg] = count();\"` | |
delete in[arg0]; | |
} | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment