From 330b39fcc8d2865c18415d81c5877db4bbc125a3 Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Mon, 2 Feb 2026 19:28:47 -0500 Subject: [PATCH 1/4] check for recon-util in $PATH --- libexec/profile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libexec/profile b/libexec/profile index fefe609977..4085e05b72 100755 --- a/libexec/profile +++ b/libexec/profile @@ -27,6 +27,9 @@ stub=${stub%%.*} which asprof >& /dev/null [ "$?" -ne 0 ] && echo 'ERROR: asprof is not in $PATH.' && exit 9 +which recon-util >& /dev/null +[ "$?" -ne 0 ] && echo 'ERROR: recon-util is not in $PATH.' && exit 9 + recon-util -y $yaml -n $nevents -o pro_$stub.hipo -i $data >& pro_$stub.log & pid_bash=$! From 7e68c463f4fc0375152c0b0a8b29abda9ff3ff9d Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Mon, 2 Feb 2026 21:07:37 -0500 Subject: [PATCH 2/4] add flexibility --- libexec/profile | 53 ++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/libexec/profile b/libexec/profile index 4085e05b72..50d659278c 100755 --- a/libexec/profile +++ b/libexec/profile @@ -1,36 +1,42 @@ #!/bin/bash -set -e - -# configure: -event=cpu #nativemem +event=cpu format=flat -nevents=1000 seconds=12 -yaml=etc/services/data-ai-uber.yml -while getopts y:n:f:e:s:h opt +usage="Usage: profile [-h] [-s seconds] [-w seconds] [-e event] [-f format] [--] executable args" +usage2="Usage: profile [-h] [-s seconds] [-w seconds] [-e cpu|alloc|nativemem|lock|cache-misses] [-f flat|traces|collapsed|flamegraph|tree|jfr|otlp] [--] executable args" + +while getopts s:f:e:o:w:h opt do case $opt in s) seconds=$OPTARG ;; - y) yaml=$OPTARG ;; - n) nevents=$OPTARG ;; f) format=$OPTARG ;; e) event=$OPTARG ;; - h) echo "\nUsage: profile [-y YAML] [-n #] [-e EVENT] datafile" && exit 0 ;; + o) stub=$OPTARG ;; + w) warmup=$OPTARG ;; + h) echo $usage2 && exit 0 ;; + --) break ;; + \?) echo $usage && exit 1 ;; +# :) echo $usage && exit 2 ;; esac done + shift $((OPTIND-1)) -data=$1 -stub=$(basename $data) -stub=${stub%%.*} +executable=$1 +arguments=${@:2} which asprof >& /dev/null -[ "$?" -ne 0 ] && echo 'ERROR: asprof is not in $PATH.' && exit 9 +[ "$?" -ne 0 ] && echo 'ERROR: asprof is not in $PATH.' && exit 3 + +which $executable >& /dev/null +[ "$?" -ne 0 ] && echo "ERROR: $executable is not in \$PATH." && exit 4 + +echo "Running asprof on '$executable $arguments' ..." + +set -e -which recon-util >& /dev/null -[ "$?" -ne 0 ] && echo 'ERROR: recon-util is not in $PATH.' && exit 9 +$executable $arguments >& asprof_$stub.log -recon-util -y $yaml -n $nevents -o pro_$stub.hipo -i $data >& pro_$stub.log & pid_bash=$! echo PID1=$pid_bash @@ -41,14 +47,15 @@ echo PID2=$pid_java ps waux && ps -p $pid_java -echo "Waiting for 60 seconds of CoatJava warmup ..." -for x in $(seq 60); do let y=60-$x && echo -e -n "\r$y ..." && sleep 1; done +echo "Waiting for $warmup seconds of warmup ..." +for x in $(seq $warmup); do let y=$warmup-$x && echo -e -n "\r$y ..." && sleep 1; done -tail -n 42 pro_$stub.log +# This 42 is probably for recon-util: +tail -n 42 asprof_$stub.log -asprof --title "Coatjava - asprof - $event" -e $event \ - -d $seconds -o $format -f pro_${format}_${event}_$stub $pid_java +asprof --title "Coatjava:asprof:$executable:$event" -e $event \ + -d $seconds -o $format -f asprof_${format}_${event}_$stub $pid_java kill -9 $pid_java -rm -f pro_$stub.hipo +rm -f asprof_$stub.hipo From 483af33b3328f2f931a4ab4d283e140c38a9109e Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Mon, 23 Feb 2026 22:09:25 -0500 Subject: [PATCH 3/4] cleanup help printout --- libexec/profile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/profile b/libexec/profile index 50d659278c..05cf1ad9be 100755 --- a/libexec/profile +++ b/libexec/profile @@ -4,7 +4,7 @@ event=cpu format=flat seconds=12 usage="Usage: profile [-h] [-s seconds] [-w seconds] [-e event] [-f format] [--] executable args" -usage2="Usage: profile [-h] [-s seconds] [-w seconds] [-e cpu|alloc|nativemem|lock|cache-misses] [-f flat|traces|collapsed|flamegraph|tree|jfr|otlp] [--] executable args" +usage2="Usage: profile [options] executable args\nOptions:\n\t[-h] [-s seconds] [-w seconds]\n\t[-e cpu|alloc|nativemem|lock|cache-misses]\n\t[-f flat|traces|collapsed|flamegraph|tree|jfr|otlp]" while getopts s:f:e:o:w:h opt do @@ -14,7 +14,7 @@ do e) event=$OPTARG ;; o) stub=$OPTARG ;; w) warmup=$OPTARG ;; - h) echo $usage2 && exit 0 ;; + h) echo -e $usage2 && exit 0 ;; --) break ;; \?) echo $usage && exit 1 ;; # :) echo $usage && exit 2 ;; From 428c7d063b5bc624930941d250fede61327324e2 Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Mon, 23 Feb 2026 22:11:35 -0500 Subject: [PATCH 4/4] cleanup --- libexec/profile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libexec/profile b/libexec/profile index 05cf1ad9be..19da5dbd5c 100755 --- a/libexec/profile +++ b/libexec/profile @@ -3,7 +3,7 @@ event=cpu format=flat seconds=12 -usage="Usage: profile [-h] [-s seconds] [-w seconds] [-e event] [-f format] [--] executable args" +usage1="Usage: profile [-h] [-s seconds] [-w seconds] [-e event] [-f format] [--] executable args" usage2="Usage: profile [options] executable args\nOptions:\n\t[-h] [-s seconds] [-w seconds]\n\t[-e cpu|alloc|nativemem|lock|cache-misses]\n\t[-f flat|traces|collapsed|flamegraph|tree|jfr|otlp]" while getopts s:f:e:o:w:h opt @@ -16,8 +16,8 @@ do w) warmup=$OPTARG ;; h) echo -e $usage2 && exit 0 ;; --) break ;; - \?) echo $usage && exit 1 ;; -# :) echo $usage && exit 2 ;; + \?) echo $usage1 && exit 1 ;; +# :) echo $usage1 && exit 2 ;; esac done @@ -26,10 +26,10 @@ executable=$1 arguments=${@:2} which asprof >& /dev/null -[ "$?" -ne 0 ] && echo 'ERROR: asprof is not in $PATH.' && exit 3 +[ "$?" -ne 0 ] && echo 'ERROR: asprof is not in $PATH.' && echo -e $usage2 && exit 3 which $executable >& /dev/null -[ "$?" -ne 0 ] && echo "ERROR: $executable is not in \$PATH." && exit 4 +[ "$?" -ne 0 ] && echo "ERROR: $executable is not in \$PATH." && echo -e $usage2 && exit 4 echo "Running asprof on '$executable $arguments' ..."