Commit e3709309 authored by Thomas Applencourt's avatar Thomas Applencourt

Update *prof

parent eb23f7ed
Pipeline #12175 canceled with stage
#!/usr/bin/env bash #!/usr/bin/env bash
exec_prefix=@prefix@ exec_prefix=@prefix@
libdir=@libdir@ libdir=@libdir@
bindir=@bindir@
pkglibdir=$libdir/@PACKAGE@ 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` # Find all location of a `.so`
whichlib() { whichlib() {
# Output of ldconfig: # Output of ldconfig:
...@@ -17,14 +44,17 @@ whichlib() { ...@@ -17,14 +44,17 @@ whichlib() {
match($1, "^lib") && match($1, p) { print header "/" $1}' match($1, "^lib") && match($1, p) { print header "/" $1}'
} }
trace() { trace_and_summary() {
quiet="--quiet" if [ -z "$@" ]; then
lttng-sessiond --daemonize $quiet display_help
lttng $quiet create thapi-opencl-session fi
lttng-sessiond $quiet --daemonize
lttng $quiet create iprof
#Using blocking more to trace event record loss #Using blocking more to trace event record loss
lttng $quiet enable-channel --userspace --blocking-timeout=inf blocking-channel 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:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_build:infos* 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_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_arguments:kernel_info
...@@ -32,6 +62,7 @@ trace() { ...@@ -32,6 +62,7 @@ trace() {
lttng $quiet add-context --userspace --channel=blocking-channel -t vpid -t vtid lttng $quiet add-context --userspace --channel=blocking-channel -t vpid -t vtid
#Preventing trace event record loss
if [ -z "$LTTNG_UST_OPENCL_LIBOPENCL" ] if [ -z "$LTTNG_UST_OPENCL_LIBOPENCL" ]
then then
export LTTNG_UST_OPENCL_LIBOPENCL=$(whichlib libOpenCL.so | head -n 1) export LTTNG_UST_OPENCL_LIBOPENCL=$(whichlib libOpenCL.so | head -n 1)
...@@ -52,33 +83,74 @@ trace_epilogue() { ...@@ -52,33 +83,74 @@ trace_epilogue() {
summary summary
} }
summary() { summary() {
if [ -z "$path" ]; then if [ -z "$@" ]; then
lltng_last_session=$(ls -dt $HOME/lttng-traces/thapi-opencl-session* | head -1) lltng_last_session=$(ls -dt $HOME/lttng-traces/* | head -1)
echo "Trace location " $lltng_last_session echo "Trace location:" $lltng_last_session
echo echo
else else
lltng_last_session=$path 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
fi fi
babeltrace2 --plugin-path=$libdir --component=sink.clprof.dispatch --params="display=$display" ${lltng_last_session}
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
} }
# _ # _
# |_) _. ._ _ o ._ _ /\ ._ _ # |_) _. ._ _ o ._ _ /\ ._ _
# | (_| | _> | | | (_| /--\ | (_| \/ # | (_| | _> | | | (_| /--\ | (_| \/
# _| _| # _| _|
display="compact" display="compact";
if [[ $# -eq 0 ]]; then
display_help
fi
while (( "$#" )); do while (( "$#" )); do
case "$1" in case "$1" in
-h | --help) display_help; exit ;;
-e | --extented) shift; display="extended" ;; -e | --extented) shift; display="extended" ;;
-r | --replay) shift; path=$@; replay=true ;; -r | --replay) shift; replay=true ;;
-- ) shift; break ;; -d | --debug) shift; debug=true ;;
-a | --asm) shift; asm=true ;;
-t | --trace) shift; trace=true ;;
--) shift; break ;;
*) break ;; *) break ;;
esac esac
done done
if [ -z "$replay" ]; then if [ -n "$debug" ]; then
trace "$@" 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 fi
summary $path if [ -n "$replay" ]; then
summary "$@"
else
trace_and_summary "$@"
fi
...@@ -5,7 +5,7 @@ bindir=@bindir@ ...@@ -5,7 +5,7 @@ bindir=@bindir@
pkglibdir=$libdir/@PACKAGE@ pkglibdir=$libdir/@PACKAGE@
display_help() { display_help() {
echo "$(basename $0): a tracing / summarizer of OpenCL and L0 Calls" echo "$(basename $0): a tracer / summarizer of OpenCL and L0 Calls"
echo "Usage:" echo "Usage:"
echo " $(basename $0) -h | --help " echo " $(basename $0) -h | --help "
echo " $(basename $0) [option]... <application> <application-arguments>" echo " $(basename $0) [option]... <application> <application-arguments>"
...@@ -15,13 +15,13 @@ display_help() { ...@@ -15,13 +15,13 @@ display_help() {
echo " -e, --extended Print information for each Hostname / Process / Thread / Device" echo " -e, --extended Print information for each Hostname / Process / Thread / Device"
echo " -t, --trace Display the trace" echo " -t, --trace Display the trace"
echo " -a, --asm Dump in your current directory low level kernels informations (asm,isa,visa,...)." echo " -a, --asm Dump in your current directory low level kernels informations (asm,isa,visa,...)."
echo " -r, --replay Allow you to replay an old trace. Take a path as argument ($HOME/lttng-traces/...)" echo " -r, --replay <application> <application-arguments> will be traited as pathes to traces folders ($HOME/lttng-traces/...)"
echo " If no argument is provided, will use the latest trace available" echo " If no arguments are provided, will use the latest trace available"
echo echo
echo " Example:" echo " Example:"
echo " $(basename $0) ./a.out" echo " $(basename $0) ./a.out"
echo echo
echo "iprof will save the trace in $HOME/lttng-traces/" echo "$(basename $0) will save the trace in $HOME/lttng-traces/"
echo " Please tidy up from time to time" echo " Please tidy up from time to time"
echo " __ " echo " __ "
echo "For complain, praise, bug repport please use: <(o )___" echo "For complain, praise, bug repport please use: <(o )___"
...@@ -45,6 +45,10 @@ whichlib() { ...@@ -45,6 +45,10 @@ whichlib() {
} }
trace_and_summary() { trace_and_summary() {
if [ -z "$@" ]; then
display_help
fi
lttng-sessiond $quiet --daemonize lttng-sessiond $quiet --daemonize
lttng $quiet create iprof lttng $quiet create iprof
#Using blocking more to trace event record loss #Using blocking more to trace event record loss
...@@ -91,12 +95,12 @@ trace_epilogue() { ...@@ -91,12 +95,12 @@ trace_epilogue() {
summary() { summary() {
if [ -z "$path" ]; then if [ -z "$@" ]; then
lltng_last_session=$(ls -dt $HOME/lttng-traces/* | head -1) lltng_last_session=$(ls -dt $HOME/lttng-traces/* | head -1)
echo "Trace location:" $lltng_last_session echo "Trace location:" $lltng_last_session
echo echo
else else
lltng_last_session=$path lltng_last_session=$@
fi fi
# Check that the argument are trace. # Check that the argument are trace.
# We don't quote the $lltng_last_session, to be able to loop over hit. # We don't quote the $lltng_last_session, to be able to loop over hit.
...@@ -142,7 +146,7 @@ while (( "$#" )); do ...@@ -142,7 +146,7 @@ while (( "$#" )); do
case "$1" in case "$1" in
-h | --help) display_help; exit ;; -h | --help) display_help; exit ;;
-e | --extented) shift; display="extended" ;; -e | --extented) shift; display="extended" ;;
-r | --replay) shift; path=$@; replay=true ;; -r | --replay) shift; replay=true ;;
-d | --debug) shift; debug=true ;; -d | --debug) shift; debug=true ;;
-a | --asm) shift; asm=true ;; -a | --asm) shift; asm=true ;;
-t | --trace) shift; trace=true ;; -t | --trace) shift; trace=true ;;
...@@ -164,7 +168,7 @@ if [ -n "$asm" ]; then ...@@ -164,7 +168,7 @@ if [ -n "$asm" ]; then
fi fi
if [ -n "$replay" ]; then if [ -n "$replay" ]; then
summary summary "$@"
else else
trace_and_summary "$@" trace_and_summary "$@"
fi fi
#!/usr/bin/env bash #!/usr/bin/env bash
exec_prefix=@prefix@ exec_prefix=@prefix@
libdir=@libdir@ libdir=@libdir@
bindir=@bindir@
pkglibdir=$libdir/@PACKAGE@ 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` # Find all location of a `.so`
whichlib() { whichlib() {
# Output of ldconfig: # Output of ldconfig:
...@@ -17,22 +44,25 @@ whichlib() { ...@@ -17,22 +44,25 @@ whichlib() {
match($1, "^lib") && match($1, p) { print header "/" $1}' match($1, "^lib") && match($1, p) { print header "/" $1}'
} }
trace() { trace_and_summary() {
quiet="--quiet" if [ -z "$@" ]; then
display_help
fi
lttng-sessiond $quiet --daemonize lttng-sessiond $quiet --daemonize
lttng $quiet create thapi-ze-session lttng $quiet create iprof
#Using blocking more to trace event record loss #Using blocking more to trace event record loss
lttng $quiet enable-channel --userspace --blocking-timeout=inf blocking-channel lttng $quiet enable-channel --userspace --blocking-timeout=inf blocking-channel
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze:* lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_zet:* lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_zet:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_zes:*
export LTTNG_UST_ZE_PROFILE=1 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_profiling:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze_properties:* lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze_properties:*
lttng $quiet add-context --userspace --channel=blocking-channel -t vpid -t vtid lttng $quiet add-context --userspace --channel=blocking-channel -t vpid -t vtid
#Preventing trace event record loss
if [ -z "$LTTNG_UST_ZE_LIBZE_LOADER" ] if [ -z "$LTTNG_UST_ZE_LIBZE_LOADER" ]
then then
export LTTNG_UST_ZE_LIBZE_LOADER=$(whichlib libze_loader.so | head -n 1) export LTTNG_UST_ZE_LIBZE_LOADER=$(whichlib libze_loader.so | head -n 1)
...@@ -53,15 +83,36 @@ trace_epilogue() { ...@@ -53,15 +83,36 @@ trace_epilogue() {
summary summary
} }
summary() { summary() {
if [ -z "$path" ]; then if [ -z "$@" ]; then
lltng_last_session=$(ls -dt $HOME/lttng-traces/thapi-ze-session* | head -1) lltng_last_session=$(ls -dt $HOME/lttng-traces/* | head -1)
echo "Trace location:" $lltng_last_session echo "Trace location:" $lltng_last_session
echo echo
else else
lltng_last_session=$path 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_ze $lltng_last_session | grep lttng_ust_ze
fi fi
babeltrace2 --plugin-path=$libdir --component=sink.zeprof.dispatch --params="display=$display" ${lltng_last_session}
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
} }
# _ # _
...@@ -69,17 +120,37 @@ summary() { ...@@ -69,17 +120,37 @@ summary() {
# | (_| | _> | | | (_| /--\ | (_| \/ # | (_| | _> | | | (_| /--\ | (_| \/
# _| _| # _| _|
display="compact"; display="compact";
if [[ $# -eq 0 ]]; then
display_help
fi
while (( "$#" )); do while (( "$#" )); do
case "$1" in case "$1" in
-h | --help) display_help; exit ;;
-e | --extented) shift; display="extended" ;; -e | --extented) shift; display="extended" ;;
-r | --replay) shift; path=$@; replay=true ;; -r | --replay) shift; replay=true ;;
-d | --debug) shift; debug=true ;;
-a | --asm) shift; asm=true ;;
-t | --trace) shift; trace=true ;;
--) shift; break ;; --) shift; break ;;
*) break ;; *) break ;;
esac esac
done done
if [ -z "$replay" ]; then if [ -n "$debug" ]; then
trace "$@" 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 fi
summary $path 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