scripts/bpftrace.sh: redirect output to file
Allow redirecting output to file. Using simple "if" for an environment variable, as script arguments number is variable and using getops seems like an overkill. Signed-off-by: Karol Latecki <karol.latecki@intel.com> Change-Id: I7e219bb1fd6377bc20c44b76cec3685b32e9316c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8643 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
ecd46370d9
commit
348ff890ad
@ -3,6 +3,9 @@ set -e
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "usage: $0 <pid> <script>"
|
||||
echo ""
|
||||
echo "Environment variable BPF_OUTFILE can be set to save results to a file"
|
||||
echo "rather than print to stdout."
|
||||
exit 1
|
||||
fi
|
||||
SCRIPTS_DIR=$(readlink -f $(dirname $0))
|
||||
@ -12,4 +15,5 @@ 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"
|
||||
|
||||
bpftrace -p $1 -e "$BPF_SCRIPT" ${BPF_OUTFILE:+-o "$BPF_OUTFILE"}
|
||||
|
Loading…
Reference in New Issue
Block a user