Added support to run benchmarks under System Tap (on Linux)
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 20 Apr 2015 14:17:58 +0100
changeset 269 e1872c56d1d0
parent 268 ee1fd4a6e836
child 270 c50baf9166d2
Added support to run benchmarks under System Tap (on Linux)
s/stx/benchmark-runner.sh
--- a/s/stx/benchmark-runner.sh	Mon Apr 20 12:53:16 2015 +0100
+++ b/s/stx/benchmark-runner.sh	Mon Apr 20 14:17:58 2015 +0100
@@ -36,6 +36,19 @@
         --callgrind)
             CALLGRIND="valgrind -v --smc-check=all-non-file --tool=callgrind --instr-atstart=no --collect-jumps=yes --cache-sim=yes --branch-sim=yes"
             ;;
+        --stap)
+            shift
+            if [ -z "$1" ]; then 
+                echo "--stap requires systemtap script to run"
+                exit 1
+            fi
+            if [ ! -r "$1" ]; then
+                echo "$1 is not a readable systemtap script"
+                echo "--stap requires systemtap script to run"
+                exit 1
+            fi
+            STAPSCRIPT=$1
+            ;;
         -T*)
             VM_OPTS="$VM_OPTS $1"
             ;;
@@ -55,19 +68,23 @@
 DIR=`dirname $0`
 if [ ! -z "$DEBUGGER" ]; then
     exec $DEBUGGER $VM
-fi
-if [ ! -z "$CALLGRIND" ]; then
+elif [ ! -z "$CALLGRIND" ]; then
     JITMAP=$(mktemp --suffix=.txt)
-    echo "JIT map saved to: $JITMAP"
-    exec $CALLGRIND $VM 			\
+    $CALLGRIND $VM 				\
         $VM_OPTS 				\
         -I -Xdump-compile-map=$JITMAP 		\
         --execute "$DIR/benchmark-runner.rc"    \
         $SMALLTALK_OPTS
+    echo "JIT map saved to: $JITMAP"
+    exit $?
+elif [ ! -z "$STAPSCRIPT" ]; then
+    stap                                                                       \
+        --unprivileged $STAPSCRIPT -I "$TOP/stx/hacking/tapset"                \
+        -c "$VM $VM_OPTS --execute $DIR/benchmark-runner.rc $SMALLTALK_OPTS"
+    exit $?
+else
+    exec "$VM" \
+        $VM_OPTS 					\
+        -I  --execute "$DIR/benchmark-runner.rc" 	\
+        $SMALLTALK_OPTS
 fi
-
-
-exec "$VM" \
-    $VM_OPTS 					\
-    -I  --execute "$DIR/benchmark-runner.rc" 	\
-    $SMALLTALK_OPTS