Commit d97b9c5d authored by Thomas Applencourt's avatar Thomas Applencourt

Remove one more .in

parent 9238f68e
Pipeline #12202 failed with stage
#!/usr/bin/env bash
exec_prefix=@prefix@
libdir=@libdir@
bindir=@bindir@
pkglibdir=$libdir/@PACKAGE@
display_help() {
echo "$(basename $0): a tracer / summarizer of OpenCL and L0 calls"
echo "Usage:"
echo " $(basename $0) -h | --help "
echo " $(basename $0) [option]... <application> <application-arguments>"
echo " $(basename $0) [option]... -r [<trace>]..."
echo
echo " -h, --help Show this screen"
echo " -e, --extended Print information for each Hostname / Process / Thread / Device"
echo " -t, --trace Display the trace"
echo " -a, --asm Dump in your current directory low level kernels informations (asm,isa,visa,...)."
echo " -r, --replay <application> <application-arguments> will be traited as pathes to traces folders ($HOME/lttng-traces/...)"
echo " If no arguments are provided, will use the latest trace available"
echo
echo " Example:"
echo " $(basename $0) ./a.out"
echo
echo "$(basename $0) will save the trace in $HOME/lttng-traces/"
echo " Please tidy up from time to time"
echo " __ "
echo "For complain, praise, bug repport please use: <(o )___"
echo " https://xgitlab.cels.anl.gov/heteroflow/tracer ( ._> /"
echo " or send email to {apl,bvideau}@anl.gov \`---'"
exit 1
}
# Find all location of a `.so`
whichlib() {
# Output of ldconfig:
#/usr/lib32:
# libstdc++.so.6 -> libstdc++.so.6.0.26
# After the awk:
# -> /usr/lib32/libstdc++.so.6
# 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)} \
match($1, "^lib") && match($1, p) { print header "/" $1}'
}
trace_and_summary() {
if [ -z "$@" ]; then
display_help
fi
lttng-sessiond $quiet --daemonize
lttng $quiet create iprof
#Using blocking more to trace event record loss
lttng $quiet enable-channel --userspace --blocking-timeout=inf blocking-channel
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_build:infos*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_profiling:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_arguments:kernel_info
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_devices:device_name
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_zet:*
export LTTNG_UST_ZE_PROFILE=1
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze_profiling:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze_properties:*
lttng $quiet add-context --userspace --channel=blocking-channel -t vpid -t vtid
#Preventing trace event record loss
if [ -z "$LTTNG_UST_OPENCL_LIBOPENCL" ]
then
export LTTNG_UST_OPENCL_LIBOPENCL=$(whichlib libOpenCL.so | head -n 1)
fi
if [ -z "$LTTNG_UST_ZE_LIBZE_LOADER" ]
then
export LTTNG_UST_ZE_LIBZE_LOADER=$(whichlib libze_loader.so | head -n 1)
fi
#Preventing trace event record loss
export LTTNG_UST_ALLOW_BLOCKING=1
export LD_PRELOAD=$libdir/libTracerOpenCL.so:$LD_PRELOAD
export LD_LIBRARY_PATH=$pkglibdir/opencl:$LD_LIBRARY_PATH
export LD_PRELOAD=$libdir/libTracerZE.so:$LD_PRELOAD
export LD_LIBRARY_PATH=$pkglibdir/ze:$LD_LIBRARY_PATH
lttng $quiet start
trap 'trace_epilogue' EXIT SIGABRT SIGSEGV
"$@"
}
trace_epilogue() {
lttng $quiet stop
lttng $quiet destroy
summary
}
summary() {
if [ -z "$@" ]; then
lltng_last_session=$(ls -dt $HOME/lttng-traces/* | head -1)
echo "Trace location:" $lltng_last_session
echo
else
lltng_last_session=$@
fi
# Check that the argument are trace.
# We don't quote the $lltng_last_session, to be able to loop over hit.
# Should be cleaner to use bash arrays.
for f in $lltng_last_session; do
if [ ! -d "$f" ]; then
echo "$f is not a trace folder"
exit 1
fi
done
if [ -n "$trace" ]; then
# Todo filter direcly in the babeltrace
$bindir/babeltrace_opencl $lltng_last_session | grep lttng_ust_opencl
$bindir/babeltrace_ze $lltng_last_session | grep lttng_ust_ze
fi
ocl_output=$(babeltrace2 --plugin-path=$libdir --component=sink.clprof.dispatch --params="display=$display" ${lltng_last_session})
if [ -n "$ocl_output" ]; then
echo "== OpenCL == "
echo "$ocl_output"
fi
ze_output=$(babeltrace2 --plugin-path=$libdir --component=sink.zeprof.dispatch --params="display=$display" ${lltng_last_session})
if [ -n "$ze_output" ]; then
echo "== Level0 == "
echo "$ze_output"
fi
}
# _
# |_) _. ._ _ o ._ _ /\ ._ _
# | (_| | _> | | | (_| /--\ | (_| \/
# _| _|
display="compact";
if [[ $# -eq 0 ]]; then
display_help
fi
while (( "$#" )); do
case "$1" in
-h | --help) display_help; exit ;;
-e | --extented) shift; display="extended" ;;
-r | --replay) shift; replay=true ;;
-d | --debug) shift; debug=true ;;
-a | --asm) shift; asm=true ;;
-t | --trace) shift; trace=true ;;
--) shift; break ;;
*) break ;;
esac
done
if [ -n "$debug" ]; then
export LIBBABELTRACE2_INIT_LOG_LEVEL=WARNING
export BABELTRACE_CLI_LOG_LEVEL=WARNING
else
quiet="--quiet"
fi
if [ -n "$asm" ]; then
export IGC_ShaderDumpEnable=1
export IGC_DumpToCurrentDir=1
fi
if [ -n "$replay" ]; then
summary "$@"
else
trace_and_summary "$@"
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment