3a0f624499
Also add scripts/bpf/nvmf.bt to enable and log these probes. This patch also adds a script that can generate a bpftrace script snippet with string maps for needed enumerations (currently nvmf_tgt_state and spdk_nvmf_subsystem_state). This allows us to dynamically generate this from the source code, and can be extended for other enums we may want to add in the future. Thanks to Michal Berger for converting my original gen_enums.py script into gen_enums.sh! Signed-off-by: Jim Harris <james.r.harris@intel.com> Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: Iff34a6218aef40055ac14932eea5fc00e1c8bcf5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7194 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
16 lines
381 B
Bash
Executable File
16 lines
381 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if [ $# -lt 2 ]; then
|
|
echo "usage: $0 <pid> <script>"
|
|
exit 1
|
|
fi
|
|
SCRIPTS_DIR=$(readlink -f $(dirname $0))
|
|
BIN_PATH=$(readlink -f /proc/$1/exe)
|
|
BPF_SCRIPT=$($SCRIPTS_DIR/bpf/gen_enums.sh)
|
|
BPF_SCRIPT+=$(sed "s#__EXE__#${BIN_PATH}#g" "${@:2}" | sed "s#__PID__#${1}#g")
|
|
if [ -n "$ECHO_SCRIPT" ]; then
|
|
echo "$BPF_SCRIPT"
|
|
fi
|
|
bpftrace -p $1 -e "$BPF_SCRIPT"
|