diff --git a/.github/workflows/shfmt.yml b/.github/workflows/shfmt.yml new file mode 100644 index 000000000..ac527064c --- /dev/null +++ b/.github/workflows/shfmt.yml @@ -0,0 +1,25 @@ +name: shfmt +on: + push: + pull_request: + branches: + - main + - devel +env: + FLAGS: "-i 2 -ci -d" +jobs: + shfmt: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install shfmt + run: | + curl -sS https://webi.sh/shfmt | sh + - name: Run shfmt check + run: | + # check formatting of standard bash files + shfmt ${FLAGS} . + # check formatting of `*.sh.in` files + sh_in=$(find . -iname *.sh.in) + shfmt ${FLAGS} ${sh_in} diff --git a/backends/cuda/tracer_cuda.sh.in b/backends/cuda/tracer_cuda.sh.in index 3e1d5f1c8..c9f347451 100644 --- a/backends/cuda/tracer_cuda.sh.in +++ b/backends/cuda/tracer_cuda.sh.in @@ -16,16 +16,15 @@ whichlib() { # In OpenSUSE ldconfig, is in '/sbin'. PATH=$PATH:/sbin ldconfig -vNX $(echo $LD_LIBRARY_PATH | sed 's/:/ /g') 2>/dev/null | - awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ + awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ match($1, "^lib") && match($1, p) { print header "/" $1}' } whichlib64_head() { # This function return only the first lib found # This avoid a broken pipe error when the old pattern `whichlib64 $foo | head - n1` was used - for lib in $(whichlib $1) - do - if objdump -a $lib | grep 64 > /dev/null; then + for lib in $(whichlib $1); do + if objdump -a $lib | grep 64 >/dev/null; then echo $lib break fi @@ -33,48 +32,78 @@ whichlib64_head() { } display_help() { - echo "Usage:" - echo " $(basename $0) [options] [--] " - echo " --help Show this screen" - echo " --version Print the version string" - echo " --cudart Trace CUDA runtime on top of CUDA driver" - echo " -a, --arguments Extract argument infos and values" - echo " -p, --profiling Enable profiling" - echo " -e, --exports Trace export functions" - echo " -v, --visualize Visualize trace on thefly" - echo " --properties Dump devices infos" - echo " --sample Sample performance counters" - exit 1 + echo "Usage:" + echo " $(basename $0) [options] [--] " + echo " --help Show this screen" + echo " --version Print the version string" + echo " --cudart Trace CUDA runtime on top of CUDA driver" + echo " -a, --arguments Extract argument infos and values" + echo " -p, --profiling Enable profiling" + echo " -e, --exports Trace export functions" + echo " -v, --visualize Visualize trace on thefly" + echo " --properties Dump devices infos" + echo " --sample Sample performance counters" + exit 1 } display_version() { - cat $datadir/version - exit 1 + cat $datadir/version + exit 1 } while true; do case "$1" in - --help ) display_help; exit;; - --version ) display_version; exit;; - --cudart ) shift; cudart=1;; - -a | --arguments ) shift; arguments=1;; - -p | --profiling ) shift; profiling=1; export LTTNG_UST_CUDA_PROFILE=1;; - -e | --exports ) shift; exports=1;; - -v | --visualize ) shift; lttng_view=1;; - --properties ) shift; properties=1;; - --sample ) shift; sample=1;; - -- ) shift; break ;; - * ) break ;; + --help) + display_help + exit + ;; + --version) + display_version + exit + ;; + --cudart) + shift + cudart=1 + ;; + -a | --arguments) + shift + arguments=1 + ;; + -p | --profiling) + shift + profiling=1 + export LTTNG_UST_CUDA_PROFILE=1 + ;; + -e | --exports) + shift + exports=1 + ;; + -v | --visualize) + shift + lttng_view=1 + ;; + --properties) + shift + properties=1 + ;; + --sample) + shift + sample=1 + ;; + --) + shift + break + ;; + *) break ;; esac done if [ "$#" -eq 0 ]; then - display_help + display_help fi lttng-sessiond --daemonize --quiet -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng-relayd --daemonize lttng create thapi-cuda-session --live else @@ -83,37 +112,29 @@ fi lttng enable-channel --userspace --blocking-timeout=inf blocking-channel lttng add-context --userspace --channel=blocking-channel -t vpid -t vtid lttng enable-event --channel=blocking-channel --userspace lttng_ust_cuda:* -if [ ! -z "$cudart" ] -then +if [ ! -z "$cudart" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_cudart:* fi -if [ ! -z "$arguments" ] -then +if [ ! -z "$arguments" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_cuda_args:* fi -if [ ! -z "$profiling" ] -then +if [ ! -z "$profiling" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_cuda_profiling:* fi -if [ ! -z "$exports" ] -then +if [ ! -z "$exports" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_cuda_exports:* fi -if [ ! -z "$properties" ] -then +if [ ! -z "$properties" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_cuda_properties:* fi -if [ ! -z "$sample" ] -then +if [ ! -z "$sample" ]; then export LTTNG_UST_SAMPLING=1 lttng enable-channel --userspace nonblocking-channel lttng enable-event --channel=nonblocking-channel --userspace lttng_ust_sampling:* fi -if [ -z "$LTTNG_UST_CUDA_LIBCUDA" ] -then +if [ -z "$LTTNG_UST_CUDA_LIBCUDA" ]; then LTTNG_UST_CUDA_LIBCUDA=$(whichlib64_head libcuda.so) - if [ -n "$LTTNG_UST_CUDA_LIBCUDA" ] - then + if [ -n "$LTTNG_UST_CUDA_LIBCUDA" ]; then export LTTNG_UST_CUDA_LIBCUDA="$LTTNG_UST_CUDA_LIBCUDA" export LD_LIBRARY_PATH=$pkglibdir/cuda:$LD_LIBRARY_PATH fi @@ -123,13 +144,10 @@ fi export LD_PRELOAD=$pkglibdir/cuda/libcuda.so:$LD_PRELOAD export LTTNG_UST_ALLOW_BLOCKING=1 export LTTNG_UST_CUDA_VERBOSE=1 -if [ ! -z "$cudart" ] -then - if [ -z "$LTTNG_UST_CUDART_LIBCUDART" ] - then +if [ ! -z "$cudart" ]; then + if [ -z "$LTTNG_UST_CUDART_LIBCUDART" ]; then LTTNG_UST_CUDART_LIBCUDART=$(whichlib64_head libcudart.so) - if [ -n "$LTTNG_UST_CUDART_LIBCUDART" ] - then + if [ -n "$LTTNG_UST_CUDART_LIBCUDART" ]; then export LTTNG_UST_CUDART_LIBCUDART="$LTTNG_UST_CUDART_LIBCUDART" export LD_LIBRARY_PATH=$pkglibdir/cudart:$LD_LIBRARY_PATH fi @@ -149,15 +167,13 @@ ctrl_c() { trap ctrl_c INT -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng view --viewer="babeltrace_thapi --backend cuda --context --live" & PID=$! fi "$@" lttng stop lttng destroy -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then wait $PID fi diff --git a/backends/hip/tracer_hip.sh.in b/backends/hip/tracer_hip.sh.in index b0faf4c5e..e048dfe27 100644 --- a/backends/hip/tracer_hip.sh.in +++ b/backends/hip/tracer_hip.sh.in @@ -16,16 +16,15 @@ whichlib() { # In OpenSUSE ldconfig, is in '/sbin'. PATH=$PATH:/sbin ldconfig -vNX $(echo $LD_LIBRARY_PATH | sed 's/:/ /g') 2>/dev/null | - awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ + awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ match($1, "^lib") && match($1, p) { print header "/" $1}' } whichlib64_head() { # This function return only the first lib found # This avoid a broken pipe error when the old pattern `whichlib64 $foo | head - n1` was used - for lib in $(whichlib $1) - do - if objdump -a $lib | grep 64 > /dev/null; then + for lib in $(whichlib $1); do + if objdump -a $lib | grep 64 >/dev/null; then echo $lib break fi @@ -33,36 +32,47 @@ whichlib64_head() { } display_help() { - echo "Usage:" - echo " $(basename $0) [options] [--] " - echo " --help Show this screen" - echo " --version Print the version string" - echo " -v, --visualize Visualize trace on the fly" - exit 1 + echo "Usage:" + echo " $(basename $0) [options] [--] " + echo " --help Show this screen" + echo " --version Print the version string" + echo " -v, --visualize Visualize trace on the fly" + exit 1 } display_version() { - cat $datadir/version - exit 1 + cat $datadir/version + exit 1 } while true; do case "$1" in - --help ) display_help; exit;; - --version ) display_version; exit;; - -v | --visualize ) shift; lttng_view=1;; - -- ) shift; break ;; - * ) break ;; + --help) + display_help + exit + ;; + --version) + display_version + exit + ;; + -v | --visualize) + shift + lttng_view=1 + ;; + --) + shift + break + ;; + *) break ;; esac done if [ "$#" -eq 0 ]; then - display_help + display_help fi lttng-sessiond --daemonize --quiet -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng-relayd --daemonize lttng create thapi-hip-session --live else @@ -71,11 +81,9 @@ fi lttng enable-channel --userspace --blocking-timeout=inf blocking-channel lttng add-context --userspace --channel=blocking-channel -t vpid -t vtid lttng enable-event --channel=blocking-channel --userspace lttng_ust_hip:* -if [ -z "$LTTNG_UST_HIP_LIBAMDHIP64" ] -then +if [ -z "$LTTNG_UST_HIP_LIBAMDHIP64" ]; then LTTNG_UST_HIP_LIBAMDHIP64=$(whichlib64_head libamdhip64.so) - if [ -n "$LTTNG_UST_HIP_LIBAMDHIP64" ] - then + if [ -n "$LTTNG_UST_HIP_LIBAMDHIP64" ]; then export LTTNG_UST_HIP_LIBAMDHIP64="$LTTNG_UST_HIP_LIBAMDHIP64" export LD_LIBRARY_PATH=$pkglibdir/hip:$LD_LIBRARY_PATH fi @@ -95,15 +103,13 @@ ctrl_c() { trap ctrl_c INT -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng view --viewer="babeltrace_thapi --backend hip --context --live" & PID=$! fi "$@" lttng stop lttng destroy -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then wait $PID fi diff --git a/backends/itt/tracer_itt.sh.in b/backends/itt/tracer_itt.sh.in index 3409fadc3..0e2f59473 100644 --- a/backends/itt/tracer_itt.sh.in +++ b/backends/itt/tracer_itt.sh.in @@ -7,30 +7,39 @@ datarootdir=@datarootdir@ datadir=@datadir@ display_help() { - echo "Usage:" - echo " $(basename $0) [options] [--] " - echo " --help Show this screen" - echo " --version Print the version string" - exit 1 + echo "Usage:" + echo " $(basename $0) [options] [--] " + echo " --help Show this screen" + echo " --version Print the version string" + exit 1 } display_version() { - cat $datadir/version - exit 1 + cat $datadir/version + exit 1 } intel_extensions=true while true; do case "$1" in - --help ) display_help; exit;; - --version ) display_version; exit;; - -- ) shift; break ;; - * ) break ;; + --help) + display_help + exit + ;; + --version) + display_version + exit + ;; + --) + shift + break + ;; + *) break ;; esac done if [ "$#" -eq 0 ]; then - display_help + display_help fi lttng-sessiond --daemonize --quiet diff --git a/backends/mpi/tracer_mpi.sh.in b/backends/mpi/tracer_mpi.sh.in index 4504009b3..55343f6ca 100644 --- a/backends/mpi/tracer_mpi.sh.in +++ b/backends/mpi/tracer_mpi.sh.in @@ -16,16 +16,15 @@ whichlib() { # In OpenSUSE ldconfig, is in '/sbin'. PATH=$PATH:/sbin ldconfig -vNX $(echo $LD_LIBRARY_PATH | sed 's/:/ /g') 2>/dev/null | - awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ + awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ match($1, "^lib") && match($1, p) { print header "/" $1}' } whichlib64_head() { # This function return only the first lib found # This avoid a broken pipe error when the old pattern `whichlib64 $foo | head - n1` was used - for lib in $(whichlib $1) - do - if objdump -a $lib | grep 64 > /dev/null; then + for lib in $(whichlib $1); do + if objdump -a $lib | grep 64 >/dev/null; then echo $lib break fi @@ -33,36 +32,47 @@ whichlib64_head() { } display_help() { - echo "Usage:" - echo " $(basename $0) [options] [--] " - echo " --help Show this screen" - echo " --version Print the version string" - echo " -v, --visualize Visualize trace on the fly" - exit 1 + echo "Usage:" + echo " $(basename $0) [options] [--] " + echo " --help Show this screen" + echo " --version Print the version string" + echo " -v, --visualize Visualize trace on the fly" + exit 1 } display_version() { - cat $datadir/version - exit 1 + cat $datadir/version + exit 1 } while true; do case "$1" in - --help ) display_help; exit;; - --version ) display_version; exit;; - -v | --visualize ) shift; lttng_view=1;; - -- ) shift; break ;; - * ) break ;; + --help) + display_help + exit + ;; + --version) + display_version + exit + ;; + -v | --visualize) + shift + lttng_view=1 + ;; + --) + shift + break + ;; + *) break ;; esac done if [ "$#" -eq 0 ]; then - display_help + display_help fi lttng-sessiond --daemonize --quiet -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng-relayd --daemonize lttng create thapi-mpi-session --live else @@ -71,11 +81,9 @@ fi lttng enable-channel --userspace --blocking-timeout=inf blocking-channel lttng add-context --userspace --channel=blocking-channel -t vpid -t vtid lttng enable-event --channel=blocking-channel --userspace lttng_ust_mpi:* -if [ -z "$LTTNG_UST_MPI_LIBMPI" ] -then +if [ -z "$LTTNG_UST_MPI_LIBMPI" ]; then LTTNG_UST_MPI_LIBMPI=$(whichlib64_head libmpi.so) - if [ -n "$LTTNG_UST_MPI_LIBMPI" ] - then + if [ -n "$LTTNG_UST_MPI_LIBMPI" ]; then export LTTNG_UST_MPI_LIBMPI="$LTTNG_UST_MPI_LIBMPI" export LD_LIBRARY_PATH=$pkglibdir/mpi:$LD_LIBRARY_PATH fi @@ -95,15 +103,13 @@ ctrl_c() { trap ctrl_c INT -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng view --viewer="babeltrace_thapi --backend mpi --context --live" & PID=$! fi "$@" lttng stop lttng destroy -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then wait $PID fi diff --git a/backends/omp/tracer_omp.sh.in b/backends/omp/tracer_omp.sh.in index 7260d45ff..bc5158d02 100644 --- a/backends/omp/tracer_omp.sh.in +++ b/backends/omp/tracer_omp.sh.in @@ -7,39 +7,50 @@ datarootdir=@datarootdir@ datadir=@datadir@ display_help() { - echo "Usage:" - echo " $(basename $0) [options] [--] " - echo " --help Show this screen" - echo " --version Print the version string" - echo " --disable-intel-extensions Disable Intel extensions" - echo " --sample Sample performance counters" - exit 1 + echo "Usage:" + echo " $(basename $0) [options] [--] " + echo " --help Show this screen" + echo " --version Print the version string" + echo " --disable-intel-extensions Disable Intel extensions" + echo " --sample Sample performance counters" + exit 1 } display_version() { - cat $datadir/version - exit 1 + cat $datadir/version + exit 1 } intel_extensions=true while true; do case "$1" in - --help ) display_help; exit;; - --version ) display_version; exit;; - --disable-intel-extensions) intel_extensions=false shift;; - --sample ) shift; sample=1;; - -- ) shift; break ;; - * ) break ;; + --help) + display_help + exit + ;; + --version) + display_version + exit + ;; + --disable-intel-extensions) intel_extensions=false shift ;; + --sample) + shift + sample=1 + ;; + --) + shift + break + ;; + *) break ;; esac done if [ "$#" -eq 0 ]; then - display_help + display_help fi lttng-sessiond --daemonize --quiet -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng-relayd --daemonize lttng create thapi-ompt-session --live else @@ -52,11 +63,10 @@ lttng enable-event --channel=blocking-channel --userspace lttng_ust_ompt:* export OMP_TOOL_LIBRARIES=$libdir/libTracerOMPT.so export LTTNG_UST_ALLOW_BLOCKING=1 -if [ "$intel_extensions" = true ] ; then - export LTTNG_UST_OMP_INTEL=1 +if [ "$intel_extensions" = true ]; then + export LTTNG_UST_OMP_INTEL=1 fi -if [ ! -z "$sample" ] -then +if [ ! -z "$sample" ]; then export LTTNG_UST_SAMPLING=1 lttng enable-channel --userspace nonblocking-channel lttng enable-event --channel=nonblocking-channel --userspace lttng_ust_sampling:* @@ -72,15 +82,13 @@ ctrl_c() { trap ctrl_c INT -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng view --viewer="babeltrace_thapi --backend omp --context --live" & PID=$! fi "$@" lttng stop lttng destroy -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then wait $PID fi diff --git a/backends/opencl/tracer_opencl.sh.in b/backends/opencl/tracer_opencl.sh.in index 8ff8486d9..0f0469678 100644 --- a/backends/opencl/tracer_opencl.sh.in +++ b/backends/opencl/tracer_opencl.sh.in @@ -16,16 +16,15 @@ whichlib() { # In OpenSUSE ldconfig, is in '/sbin'. PATH=$PATH:/sbin ldconfig -vNX $(echo $LD_LIBRARY_PATH | sed 's/:/ /g') 2>/dev/null | - awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ + awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ match($1, "^lib") && match($1, p) { print header "/" $1}' } whichlib64_head() { # This function return only the first lib found # This avoid a broken pipe error when the old pattern `whichlib64 $foo | head - n1` was used - for lib in $(whichlib $1) - do - if objdump -a $lib | grep 64 > /dev/null; then + for lib in $(whichlib $1); do + if objdump -a $lib | grep 64 >/dev/null; then echo $lib break fi @@ -33,60 +32,114 @@ whichlib64_head() { } display_help() { - echo "Usage:" - echo " $(basename $0) [options] [--] " - echo " --help Show this screen" - echo " --version Print the version string" - echo " -l, --lightweight Filter out som high traffic functions" - echo " -p, --profiling Enable profiling" - echo " -s, --source Dump program sources to disk" - echo " -a, --arguments Dump argument and kernel infos" - echo " -b, --build Dump program build infos" - echo " -h, --host-profile Gather precise host profiling information" - echo " -d, --dump Dump kernels input and output to disk" - echo " -i, --iteration VALUE Dump inputs and outputs for kernel with enqueue counter VALUE" - echo " -s, --iteration-start VALUE Dump inputs and outputs for kernels starting with enqueue counter VALUE" - echo " -e, --iteration-end VALUE Dump inputs and outputs for kernels until enqueue counter VALUE" - echo " -v, --visualize Visualize trace on thefly" - echo " --devices Dump devices information" - echo " --sample Sample performance counters" - exit 1 + echo "Usage:" + echo " $(basename $0) [options] [--] " + echo " --help Show this screen" + echo " --version Print the version string" + echo " -l, --lightweight Filter out som high traffic functions" + echo " -p, --profiling Enable profiling" + echo " -s, --source Dump program sources to disk" + echo " -a, --arguments Dump argument and kernel infos" + echo " -b, --build Dump program build infos" + echo " -h, --host-profile Gather precise host profiling information" + echo " -d, --dump Dump kernels input and output to disk" + echo " -i, --iteration VALUE Dump inputs and outputs for kernel with enqueue counter VALUE" + echo " -s, --iteration-start VALUE Dump inputs and outputs for kernels starting with enqueue counter VALUE" + echo " -e, --iteration-end VALUE Dump inputs and outputs for kernels until enqueue counter VALUE" + echo " -v, --visualize Visualize trace on thefly" + echo " --devices Dump devices information" + echo " --sample Sample performance counters" + exit 1 } display_version() { - cat $datadir/version - exit 1 + cat $datadir/version + exit 1 } while true; do case "$1" in - --help ) display_help; exit;; - --version ) display_version; exit;; - -l | --lightweight ) shift; lightweight=1;; - -p | --profiling ) shift; profiling=1;; - -s | --source ) shift; src=1;; - -a | --arguments ) shift; arguments=1;; - -b | --build ) shift; build=1;; - -h | --host-profile) shift; export LTTNG_UST_OPENCL_HOST_PROFILE=1;; - -d | --dump ) shift; export LTTNG_UST_OPENCL_DUMP=1;; - -i | --iteration ) shift; export LTTNG_UST_OPENCL_DUMP=1; export LTTNG_UST_OPENCL_DUMP_START=$1; export LTTNG_UST_OPENCL_DUMP_END=$1; shift ;; - -s | --iteration-start ) shift; export LTTNG_UST_OPENCL_DUMP=1; export LTTNG_UST_OPENCL_DUMP_START=$1; shift ;; - -e | --iteration-end ) shift; export LTTNG_UST_OPENCL_DUMP=1; export LTTNG_UST_OPENCL_DUMP_END=$1; shift ;; - -v | --visualize) shift; lttng_view=1;; - --devices ) shift; devices=1;; - --sample ) shift; sample=1;; - -- ) shift; break ;; - * ) break ;; + --help) + display_help + exit + ;; + --version) + display_version + exit + ;; + -l | --lightweight) + shift + lightweight=1 + ;; + -p | --profiling) + shift + profiling=1 + ;; + -s | --source) + shift + src=1 + ;; + -a | --arguments) + shift + arguments=1 + ;; + -b | --build) + shift + build=1 + ;; + -h | --host-profile) + shift + export LTTNG_UST_OPENCL_HOST_PROFILE=1 + ;; + -d | --dump) + shift + export LTTNG_UST_OPENCL_DUMP=1 + ;; + -i | --iteration) + shift + export LTTNG_UST_OPENCL_DUMP=1 + export LTTNG_UST_OPENCL_DUMP_START=$1 + export LTTNG_UST_OPENCL_DUMP_END=$1 + shift + ;; + -s | --iteration-start) + shift + export LTTNG_UST_OPENCL_DUMP=1 + export LTTNG_UST_OPENCL_DUMP_START=$1 + shift + ;; + -e | --iteration-end) + shift + export LTTNG_UST_OPENCL_DUMP=1 + export LTTNG_UST_OPENCL_DUMP_END=$1 + shift + ;; + -v | --visualize) + shift + lttng_view=1 + ;; + --devices) + shift + devices=1 + ;; + --sample) + shift + sample=1 + ;; + --) + shift + break + ;; + *) break ;; esac done if [ "$#" -eq 0 ]; then - display_help + display_help fi lttng-sessiond --daemonize --quiet -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng-relayd --daemonize lttng create thapi-opencl-session --live else @@ -95,45 +148,35 @@ fi lttng enable-channel --userspace --blocking-timeout=inf blocking-channel lttng add-context --userspace --channel=blocking-channel -t vpid -t vtid lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl:* -x lttng_ust_opencl:clSetKernelArg*,lttng_ust_opencl:clGetKernelArg*,lttng_ust_opencl:clSetKernelExecInfo* -if [ -z "$lightweight" ] -then +if [ -z "$lightweight" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl:clSetKernelArg*,lttng_ust_opencl:clGetKernelArg*,lttng_ust_opencl:clSetKernelExecInfo* fi -if [ ! -z "$profiling" ] -then +if [ ! -z "$profiling" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl_profiling:* fi -if [ ! -z "$src" ] -then +if [ ! -z "$src" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl_source:* fi -if [ ! -z "$arguments" ] -then +if [ ! -z "$arguments" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl_arguments:* fi -if [ ! -z "$devices" ] -then +if [ ! -z "$devices" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl_devices:* fi -if [ ! -z "$build" ] -then +if [ ! -z "$build" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl_build:* fi -if [ ! -z "$sample" ] -then +if [ ! -z "$sample" ]; then export LTTNG_UST_SAMPLING=1 lttng enable-channel --userspace nonblocking-channel lttng enable-event --channel=nonblocking-channel --userspace lttng_ust_sampling:* fi -if [ ! -z "$LTTNG_UST_OPENCL_DUMP" ] -then +if [ ! -z "$LTTNG_UST_OPENCL_DUMP" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_opencl_dump:* fi -if [ -z "$LTTNG_UST_OPENCL_LIBOPENCL" ] -then +if [ -z "$LTTNG_UST_OPENCL_LIBOPENCL" ]; then LTTNG_UST_OPENCL_LIBOPENCL=$(whichlib64_head libOpenCL.so) - if [ -n "$LTTNG_UST_OPENCL_LIBOPENCL" ] - then + if [ -n "$LTTNG_UST_OPENCL_LIBOPENCL" ]; then export LTTNG_UST_OPENCL_LIBOPENCL="$LTTNG_UST_OPENCL_LIBOPENCL" export LD_LIBRARY_PATH=$pkglibdir/opencl:$LD_LIBRARY_PATH fi @@ -153,15 +196,13 @@ ctrl_c() { trap ctrl_c INT -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng view --viewer="babeltrace_thapi --backend cl --context --live" & PID=$! fi "$@" lttng stop lttng destroy -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then wait $PID fi diff --git a/backends/ze/tracer_ze.sh.in b/backends/ze/tracer_ze.sh.in index 9741af9d7..ef9e4c476 100644 --- a/backends/ze/tracer_ze.sh.in +++ b/backends/ze/tracer_ze.sh.in @@ -16,16 +16,15 @@ whichlib() { # In OpenSUSE ldconfig, is in '/sbin'. PATH=$PATH:/sbin ldconfig -vNX $(echo $LD_LIBRARY_PATH | sed 's/:/ /g') 2>/dev/null | - awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ + awk -v p=$1 'match($1, ":") { header=substr($1, 1, length($1)-1)} \ match($1, "^lib") && match($1, p) { print header "/" $1}' } whichlib64_head() { # This function return only the first lib found # This avoid a broken pipe error when the old pattern `whichlib64 $foo | head - n1` was used - for lib in $(whichlib $1) - do - if objdump -a $lib | grep 64 > /dev/null; then + for lib in $(whichlib $1); do + if objdump -a $lib | grep 64 >/dev/null; then echo $lib break fi @@ -33,48 +32,79 @@ whichlib64_head() { } display_help() { - echo "Usage:" - echo " $(basename $0) [options] [--] " - echo " --help Show this screen" - echo " --version Print the version string" - echo " -b, --build Dump module build infos" - echo " -p, --profiling Enable profiling" - echo " -v, --visualize Visualize trace on thefly" - echo " --properties Dump drivers and devices properties" - echo " --memory Dump memory properties" - echo " --structs Dump chained structs" - echo " --sample Sample performance counters" - exit 1 + echo "Usage:" + echo " $(basename $0) [options] [--] " + echo " --help Show this screen" + echo " --version Print the version string" + echo " -b, --build Dump module build infos" + echo " -p, --profiling Enable profiling" + echo " -v, --visualize Visualize trace on thefly" + echo " --properties Dump drivers and devices properties" + echo " --memory Dump memory properties" + echo " --structs Dump chained structs" + echo " --sample Sample performance counters" + exit 1 } display_version() { - cat $datadir/version - exit 1 + cat $datadir/version + exit 1 } while true; do case "$1" in - --help ) display_help; exit;; - --version ) display_version; exit;; - -b | --build ) shift; build=1;; - -p | --profiling ) shift; profiling=1; export LTTNG_UST_ZE_PROFILE=1;; - -v | --visualize ) shift; lttng_view=1;; - --properties ) shift; properties=1;; - --memory ) shift; memory=1;; - --structs ) shift; structs=1; export LTTNG_UST_ZE_CHAINED_STRUCTS=1;; - --sample ) shift; sample=1;; - -- ) shift; break ;; - * ) break ;; + --help) + display_help + exit + ;; + --version) + display_version + exit + ;; + -b | --build) + shift + build=1 + ;; + -p | --profiling) + shift + profiling=1 + export LTTNG_UST_ZE_PROFILE=1 + ;; + -v | --visualize) + shift + lttng_view=1 + ;; + --properties) + shift + properties=1 + ;; + --memory) + shift + memory=1 + ;; + --structs) + shift + structs=1 + export LTTNG_UST_ZE_CHAINED_STRUCTS=1 + ;; + --sample) + shift + sample=1 + ;; + --) + shift + break + ;; + *) break ;; esac done if [ "$#" -eq 0 ]; then - display_help + display_help fi lttng-sessiond --daemonize --quiet -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng-relayd --daemonize lttng create thapi-ze-session --live else @@ -85,41 +115,33 @@ lttng add-context --userspace --channel=blocking-channel -t vpid -t vtid lttng enable-event --channel=blocking-channel --userspace lttng_ust_ze:* lttng enable-event --channel=blocking-channel --userspace lttng_ust_zet:* lttng enable-event --channel=blocking-channel --userspace lttng_ust_zes:* -if [ ! -z "$structs" ] -then +if [ ! -z "$structs" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_ze_structs:* lttng enable-event --channel=blocking-channel --userspace lttng_ust_zet_structs:* lttng enable-event --channel=blocking-channel --userspace lttng_ust_zes_structs:* fi -if [ ! -z "$profiling" ] -then +if [ ! -z "$profiling" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_ze_profiling:* fi ze_disable_events_memory="lttng_ust_ze_properties:memory_info_properties,lttng_ust_ze_properties:memory_info_range" -if [ ! -z "$properties" ] -then +if [ ! -z "$properties" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_ze_properties:* -x ${ze_disable_events_memory} fi -if [ ! -z "$memory" ] -then +if [ ! -z "$memory" ]; then lttng enable-event --channel=blocking-channel --userspace ${ze_disable_events_memory} fi -if [ ! -z "$build" ] -then +if [ ! -z "$build" ]; then lttng enable-event --channel=blocking-channel --userspace lttng_ust_ze_build:* fi -if [ ! -z "$sample" ] -then +if [ ! -z "$sample" ]; then export LTTNG_UST_SAMPLING=1 lttng enable-channel --userspace nonblocking-channel lttng enable-event --channel=nonblocking-channel --userspace lttng_ust_sampling:* lttng enable-event --channel=nonblocking-channel --userspace lttng_ust_ze_sampling:* fi -if [ -z "$LTTNG_UST_ZE_LIBZE_LOADER" ] -then +if [ -z "$LTTNG_UST_ZE_LIBZE_LOADER" ]; then LTTNG_UST_ZE_LIBZE_LOADER=$(whichlib64_head libze_loader.so) - if [ -n "$LTTNG_UST_ZE_LIBZE_LOADER" ] - then + if [ -n "$LTTNG_UST_ZE_LIBZE_LOADER" ]; then export LTTNG_UST_ZE_LIBZE_LOADER="$LTTNG_UST_ZE_LIBZE_LOADER" export LD_LIBRARY_PATH=$pkglibdir/ze:$LD_LIBRARY_PATH fi @@ -139,15 +161,13 @@ ctrl_c() { trap ctrl_c INT -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then lttng view --viewer="babeltrace_thapi --backend ze --context --live" & PID=$! fi "$@" lttng stop lttng destroy -if [ ! -z "$lttng_view" ] -then +if [ ! -z "$lttng_view" ]; then wait $PID fi diff --git a/integration_tests/abnormal_usr_bin_exit.bats b/integration_tests/abnormal_usr_bin_exit.bats index 0f16ab4db..eeeb08dfb 100644 --- a/integration_tests/abnormal_usr_bin_exit.bats +++ b/integration_tests/abnormal_usr_bin_exit.bats @@ -1,8 +1,8 @@ bats_require_minimum_version 1.5.0 @test "exit_code_propagated" { - run -55 iprof -- bash -c "exit 55" - run -55 iprof --no-analysis -- bash -c "exit 55" + run -55 iprof -- bash -c "exit 55" + run -55 iprof --no-analysis -- bash -c "exit 55" } @test "signaling_propagated_mpi" { diff --git a/integration_tests/backend_itt.bats b/integration_tests/backend_itt.bats index a77c4f4f8..7c4b74b99 100644 --- a/integration_tests/backend_itt.bats +++ b/integration_tests/backend_itt.bats @@ -18,4 +18,3 @@ bats_require_minimum_version 1.5.0 grep "Example.Domain:Task 2" ./itt_out_py_c-style.txt grep "Example.Domain:Task 1" ./itt_out_py_c-style.txt } - diff --git a/integration_tests/backend_mpi.bats b/integration_tests/backend_mpi.bats index 07d49dfc6..b30d04219 100644 --- a/integration_tests/backend_mpi.bats +++ b/integration_tests/backend_mpi.bats @@ -1,8 +1,8 @@ @test "backend_mpi_sanity_check" { - mpicc ./integration_tests/mpi_helloworld.c -o mpi_helloworld - iprof --backends mpi --analysis-output out.txt -- ./mpi_helloworld - grep MPI_Init out.txt - grep MPI_Finalize out.txt + mpicc ./integration_tests/mpi_helloworld.c -o mpi_helloworld + iprof --backends mpi --analysis-output out.txt -- ./mpi_helloworld + grep MPI_Init out.txt + grep MPI_Finalize out.txt } # TODO: Working CI MPICH for Fortran IntelMPI tracer @@ -12,4 +12,3 @@ # grep MPI_Init out_f90.txt # grep MPI_Finalize out_f90.txt # } - diff --git a/integration_tests/general.bats b/integration_tests/general.bats index 974bbd1c6..2144fc859 100644 --- a/integration_tests/general.bats +++ b/integration_tests/general.bats @@ -1,105 +1,105 @@ bats_require_minimum_version 1.5.0 teardown_file() { - rm -rf $THAPI_HOME/thapi-traces + rm -rf $THAPI_HOME/thapi-traces } @test "default_summary" { - total_count=$( iprof --backend cl -- clinfo | awk -F'|' '/Total/ {print int($4)}' ) - [ "$total_count" -ge 1 ] + total_count=$(iprof --backend cl -- clinfo | awk -F'|' '/Total/ {print int($4)}') + [ "$total_count" -ge 1 ] } @test "json_summary" { - iprof --json --analysis-output out.json --json clinfo - total_count=$( jq '.host["1"].data.Total.call' out.json ) - [ "$total_count" -ge 1 ] + iprof --json --analysis-output out.json --json clinfo + total_count=$(jq '.host["1"].data.Total.call' out.json) + [ "$total_count" -ge 1 ] } @test "archive_summary" { - total_count=$( iprof --backend cl --archive clinfo | awk -F'|' '/Total/ {print int($4)}' ) - [ "$total_count" -ge 1 ] + total_count=$(iprof --backend cl --archive clinfo | awk -F'|' '/Total/ {print int($4)}') + [ "$total_count" -ge 1 ] } @test "default_trace" { - iprof -t clinfo | wc -l + iprof -t clinfo | wc -l } @test "default_timeline" { - run -0 iprof -l -- clinfo - [[ "$output" =~ "THAPI: Perfetto trace location" ]] - rm out.pftrace + run -0 iprof -l -- clinfo + [[ "$output" =~ "THAPI: Perfetto trace location" ]] + rm out.pftrace } @test "replay_summary" { - iprof clinfo - iprof -r + iprof clinfo + iprof -r } @test "no-analysis_output" { - run -0 clinfo - out1=$(echo "$output" | grep -v 'Max clock frequency' | grep -v ' Device LUID') + run -0 clinfo + out1=$(echo "$output" | grep -v 'Max clock frequency' | grep -v ' Device LUID') - run -0 --separate-stderr iprof --no-analysis -- clinfo - out2=$(echo "$output" | grep -v 'Max clock frequency' | grep -v ' Device LUID') - err2=$stderr + run -0 --separate-stderr iprof --no-analysis -- clinfo + out2=$(echo "$output" | grep -v 'Max clock frequency' | grep -v ' Device LUID') + err2=$stderr - [[ "$out1" == "$out2" ]] - [[ "$err2" =~ "THAPI: Trace location" ]] + [[ "$out1" == "$out2" ]] + [[ "$err2" =~ "THAPI: Trace location" ]] } @test "stderr_output" { - run --separate-stderr iprof -- bash -c "echo \"error\" >&2" - [[ "$stderr" =~ "error" ]] + run --separate-stderr iprof -- bash -c "echo \"error\" >&2" + [[ "$stderr" =~ "error" ]] } @test "no-analysis_all" { - iprof --no-analysis -- clinfo - iprof -r - iprof -t -r | wc -l - run -0 iprof -l -r - [[ "$output" =~ "THAPI: Perfetto trace location" ]] - rm out.pftrace + iprof --no-analysis -- clinfo + iprof -r + iprof -t -r | wc -l + run -0 iprof -l -r + [[ "$output" =~ "THAPI: Perfetto trace location" ]] + rm out.pftrace } @test "trace-output_all" { - iprof --trace-output trace_1 -- clinfo - iprof -r trace_1 - rm -rf trace_1 + iprof --trace-output trace_1 -- clinfo + iprof -r trace_1 + rm -rf trace_1 - iprof --trace-output trace_2 -t -- clinfo | wc -l - iprof -t -r trace_2 | wc -l - rm -rf trace_2 + iprof --trace-output trace_2 -t -- clinfo | wc -l + iprof -t -r trace_2 | wc -l + rm -rf trace_2 - iprof --trace-output trace_3 -l out1.pftrace -- clinfo - iprof -l out2.pftrace -r trace_3 - rm -rf trace_3 out1.pftrace out2.pftrace + iprof --trace-output trace_3 -l out1.pftrace -- clinfo + iprof -l out2.pftrace -r trace_3 + rm -rf trace_3 out1.pftrace out2.pftrace } @test "timeline_output" { - iprof -l roger.pftrace -- clinfo - rm roger.pftrace + iprof -l roger.pftrace -- clinfo + rm roger.pftrace } # Assert Failure @test "replay_negative" { - iprof -- clinfo - run iprof -t -r - [ "$status" != 0 ] - run iprof -l -r - [ "$status" != 0 ] - - iprof -l -- clinfo - run iprof -t -r - [ "$status" != 0 ] - rm out.pftrace + iprof -- clinfo + run iprof -t -r + [ "$status" != 0 ] + run iprof -l -r + [ "$status" != 0 ] + + iprof -l -- clinfo + run iprof -t -r + [ "$status" != 0 ] + rm out.pftrace } @test "error_code_when_no_trace" { - run -0 iprof sleep 1 - [[ "$output" =~ "WARN -- : No source found" ]] + run -0 iprof sleep 1 + [[ "$output" =~ "WARN -- : No source found" ]] } @test "read_stdin" { - run bats_pipe echo "FOO" \| iprof cat - [[ "$output" =~ "FOO" ]] + run bats_pipe echo "FOO" \| iprof cat + [[ "$output" =~ "FOO" ]] } diff --git a/integration_tests/light_iprof_only_sync.sh b/integration_tests/light_iprof_only_sync.sh index 88a42b61d..a0588eeb8 100755 --- a/integration_tests/light_iprof_only_sync.sh +++ b/integration_tests/light_iprof_only_sync.sh @@ -15,10 +15,10 @@ RT_SIGNAL_FINISH=$((SIGRTMIN + 3)) # Signal handler for capturing signals handle_signal() { - echo "$PARENT_PID $(date) | Received signal $1 from sync_daemon" - if [ "$1" == "RT_SIGNAL_READY" ]; then - SIGNAL_RECEIVED="true" - fi + echo "$PARENT_PID $(date) | Received signal $1 from sync_daemon" + if [ "$1" == "RT_SIGNAL_READY" ]; then + SIGNAL_RECEIVED="true" + fi } # Setup trap for ready signal sent from signal daemon @@ -26,24 +26,24 @@ trap 'handle_signal RT_SIGNAL_READY' $RT_SIGNAL_READY # Function to wait for RT_SIGNAL_READY wait_for_signal() { - while [[ "$SIGNAL_RECEIVED" == "false" ]]; do - sleep 0.1 # Small sleep to prevent busy looping - done + while [[ "$SIGNAL_RECEIVED" == "false" ]]; do + sleep 0.1 # Small sleep to prevent busy looping + done } # To avoid race condition, `SIGNAL_RECEIVED` need to be set # before spawning or signaling the daemon spawn_daemon_blocking() { - SIGNAL_RECEIVED="false" - sync_daemon_"${THAPI_SYNC_DAEMON}" $PARENT_PID & - DAEMON_PID=$! - wait_for_signal + SIGNAL_RECEIVED="false" + sync_daemon_"${THAPI_SYNC_DAEMON}" $PARENT_PID & + DAEMON_PID=$! + wait_for_signal } send_signal_blocking() { - SIGNAL_RECEIVED="false" - kill -"$1" $DAEMON_PID - wait_for_signal + SIGNAL_RECEIVED="false" + kill -"$1" $DAEMON_PID + wait_for_signal } echo "$PARENT_PID $(date) | Spawn Daemon" diff --git a/integration_tests/parallel_execution.bats b/integration_tests/parallel_execution.bats index f650627e0..d603098bb 100644 --- a/integration_tests/parallel_execution.bats +++ b/integration_tests/parallel_execution.bats @@ -1,16 +1,16 @@ teardown_file() { - rm -rf $THAPI_HOME/thapi-traces + rm -rf $THAPI_HOME/thapi-traces } launch_mpi() { - # timeout just to avoid burning too much hours when bug are introduced + # timeout just to avoid burning too much hours when bug are introduced timeout 40s $MPIRUN "$@" } # THAPI_SYNC_DAEMON=fs Tests @test "sync_daemon_fs" { - THAPI_SYNC_DAEMON=fs launch_mpi -n 2 ./integration_tests/light_iprof_only_sync.sh clinfo + THAPI_SYNC_DAEMON=fs launch_mpi -n 2 ./integration_tests/light_iprof_only_sync.sh clinfo } @test "iprof_fs" { @@ -21,14 +21,14 @@ launch_mpi() { } @test "sync_daemon_fs_launching_mpi_app" { - mpicc ./integration_tests/mpi_helloworld.c -o mpi_helloworld - THAPI_SYNC_DAEMON=fs launch_mpi -n 2 iprof ./mpi_helloworld + mpicc ./integration_tests/mpi_helloworld.c -o mpi_helloworld + THAPI_SYNC_DAEMON=fs launch_mpi -n 2 iprof ./mpi_helloworld } # THAPI_SYNC_DAEMON=MPI Tests @test "sync_daemon_mpi" { - THAPI_SYNC_DAEMON=mpi launch_mpi -n 2 ./integration_tests/light_iprof_only_sync.sh clinfo + THAPI_SYNC_DAEMON=mpi launch_mpi -n 2 ./integration_tests/light_iprof_only_sync.sh clinfo } @test "iprof_mpi" { @@ -39,7 +39,7 @@ launch_mpi() { } @test "sync_daemon_mpi_launching_mpi_app" { - mpicc ./integration_tests/mpi_helloworld.c -o mpi_helloworld - # Current bug in the CI where `mpi_finalize_session` hang - THAPI_SYNC_DAEMON_MPI_NO_FINALIZE=1 THAPI_SYNC_DAEMON=mpi launch_mpi -n 2 iprof ./mpi_helloworld + mpicc ./integration_tests/mpi_helloworld.c -o mpi_helloworld + # Current bug in the CI where `mpi_finalize_session` hang + THAPI_SYNC_DAEMON_MPI_NO_FINALIZE=1 THAPI_SYNC_DAEMON=mpi launch_mpi -n 2 iprof ./mpi_helloworld } diff --git a/integration_tests/sampling.bats b/integration_tests/sampling.bats index 2c64562c3..acd090af4 100644 --- a/integration_tests/sampling.bats +++ b/integration_tests/sampling.bats @@ -1,38 +1,36 @@ teardown_file() { - rm -rf $THAPI_HOME/thapi-traces + rm -rf $THAPI_HOME/thapi-traces } @test "sampling_heartbeat" { - LTTNG_UST_ZE_SAMPLING_ENERGY=0 LTTNG_UST_SAMPLING_HEARTBEAT=1 \ - iprof --no-analysis --sample --trace-output heartbeat_trace --\ - bash -c 'sleep 2' - babeltrace_thapi --no-restrict heartbeat_trace | grep "{foo: 16}" - [ $(babeltrace_thapi --no-restrict heartbeat_trace | grep -c "{foo: 32}") == 1 ] + LTTNG_UST_ZE_SAMPLING_ENERGY=0 LTTNG_UST_SAMPLING_HEARTBEAT=1 \ + iprof --no-analysis --sample --trace-output heartbeat_trace -- bash -c 'sleep 2' + babeltrace_thapi --no-restrict heartbeat_trace | grep "{foo: 16}" + [ $(babeltrace_thapi --no-restrict heartbeat_trace | grep -c "{foo: 32}") == 1 ] } @test "sampling_cxi" { - # cleanup & prepare fake CXI device and telemetry - rm -rf test_cxi test_device test_counter_list cxi_trace_test - mkdir -p test_device/cxi0/device/telemetry/ - echo "0@12345.0" > test_device/cxi0/device/telemetry/test_counter - echo "test_counter" > test_counter_list - mkdir test_cxi - ln -s "$(pwd)/test_device/cxi0" test_cxi/cxi0 + # cleanup & prepare fake CXI device and telemetry + rm -rf test_cxi test_device test_counter_list cxi_trace_test + mkdir -p test_device/cxi0/device/telemetry/ + echo "0@12345.0" >test_device/cxi0/device/telemetry/test_counter + echo "test_counter" >test_counter_list + mkdir test_cxi + ln -s "$(pwd)/test_device/cxi0" test_cxi/cxi0 - # after 1s, change the counter so a message is pushed - ( - sleep 1 - echo "9999@12345.0" > test_device/cxi0/device/telemetry/test_counter - ) & + # after 1s, change the counter so a message is pushed + ( + sleep 1 + echo "9999@12345.0" >test_device/cxi0/device/telemetry/test_counter + ) & - # run profiler with CXI backend for 2s - LTTNG_UST_CXI_SAMPLING_CXI_COUNTERS_FILE="$(pwd)/test_counter_list" \ - LTTNG_UST_CXI_SAMPLING_CXI_BASE="$(pwd)/test_cxi" \ + # run profiler with CXI backend for 2s + LTTNG_UST_CXI_SAMPLING_CXI_COUNTERS_FILE="$(pwd)/test_counter_list" \ + LTTNG_UST_CXI_SAMPLING_CXI_BASE="$(pwd)/test_cxi" \ iprof --no-analysis --sample --backend cxi \ - --trace-output cxi_trace_test -- bash -c 'sleep 2' + --trace-output cxi_trace_test -- bash -c 'sleep 2' - # assert there is at least one CXI counter sample reporting the difference from the initial - babeltrace_thapi --no-restrict cxi_trace_test | grep -a "value: 9999" + # assert there is at least one CXI counter sample reporting the difference from the initial + babeltrace_thapi --no-restrict cxi_trace_test | grep -a "value: 9999" } - diff --git a/utils/test_wrapper_thapi_text_pretty.sh.in b/utils/test_wrapper_thapi_text_pretty.sh.in index 281df3fb8..b81cbf090 100644 --- a/utils/test_wrapper_thapi_text_pretty.sh.in +++ b/utils/test_wrapper_thapi_text_pretty.sh.in @@ -10,7 +10,7 @@ set -euxo pipefail # We use `abs_top` on this file, because if not the relative path will be related to `utils` # but called in `backend/` -# +# # Note: separate arguments for subdir and be to handle opencl, which uses # subdir=opencl and be=cl. Other backends pass the same string for both. subdir="$1" @@ -47,7 +47,7 @@ ${CC:-gcc} -o "${folder_name}/libTestSource.so" \ -I . -I "${source_path}" \ $(pkg-config --cflags babeltrace2) -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Werror \ $(pkg-config --libs babeltrace2) --shared \ - -Wl,--whole-archive "${source_archive}" -Wl,--no-whole-archive \ + -Wl,--whole-archive "${source_archive}" -Wl,--no-whole-archive \ "${source_callback_c}" # Run Plugin and Verify output @@ -74,7 +74,7 @@ ln -f @abs_top_builddir@/${subdir}/.libs/"${lib_name}" "${folder_name}/" ${bt2_cmd} --plugin-path="${folder_name}" \ --component=source."${be}"test.test \ --component="${test_component}" \ - > "${current_output_bt_text_pretty}" + >"${current_output_bt_text_pretty}" diff "${input_thapi_text_pretty%.*}.bt_text_pretty" "${current_output_bt_text_pretty}"