From af0bf0f006813d188bfdd085b5158b7237db96f4 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 30 Apr 2021 22:14:51 +0000 Subject: [PATCH] scripts: add bpftrace.sh This script simplifies execution of bpftrace scripts for SPDK application analysis. The script should be invoked as: scripts/bpftrace.sh `pidof spdk_tgt` script.bt where 'script.bt' is the name of the bpftrace script you wish to execute. The script helps simplify the following: 1) replace __EXE__ markers in the bpftrace script with the full path of the spdk executable (required for usdt probes); it uses /proc//exe to get the full path 2) replace __PID__ markers in the bpftrace script with the PID of the spdk process under analysis - this allows for doing things like filtering system call counts for just the SPDK process 3) invoke bpftrace with the -p option Signed-off-by: Jim Harris Change-Id: Ib271f26efe4ba326d951a7b30f61b22be755dda7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7710 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu --- scripts/bpftrace.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 scripts/bpftrace.sh diff --git a/scripts/bpftrace.sh b/scripts/bpftrace.sh new file mode 100755 index 000000000..d35714b15 --- /dev/null +++ b/scripts/bpftrace.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +if [ $# -lt 2 ]; then + echo "usage: $0